Skip to content

Commit

Permalink
Tests added for Fix: ReflectionBuilder doesn't reflect module which b…
Browse files Browse the repository at this point in the history
…elongs types.
  • Loading branch information
FrancisBourre committed Jun 30, 2017
1 parent 5acf62e commit f652c40
Show file tree
Hide file tree
Showing 8 changed files with 50 additions and 1 deletion.
6 changes: 5 additions & 1 deletion test/context/flow/mapTypeAttribute.flow
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
@context( name = 'applicationContext' )
{
@map_type( 'hex.mock.IMockInterface' ) instance = new hex.mock.MockClass();
@map_type( 'hex.mock.IMockInterface' )
instance = new hex.mock.MockClass();

@map_type( 'hex.mock.MockModuleWithInternalType.GetInfosInternalTypedef' )
instance2 = new hex.mock.MockClass();
}
1 change: 1 addition & 0 deletions test/context/xml/mapTypeAttribute.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<root name="applicationContext">

<module id="instance" type="hex.mock.MockClass" map-type="hex.mock.IMockInterface"/>
<module id="instance2" type="hex.mock.MockClass" map-type="hex.mock.MockModuleWithInternalType.GetInfosInternalTypedef"/>

</root>
5 changes: 5 additions & 0 deletions test/hex/compiletime/flow/BasicFlowCompilerTest.hx
Original file line number Diff line number Diff line change
Expand Up @@ -627,6 +627,11 @@ class BasicFlowCompilerTest
Assert.isInstanceOf( instance, MockClass );
Assert.isInstanceOf( instance, IMockInterface );
Assert.equals( instance, this._applicationAssembler.getApplicationContext( "applicationContext", ApplicationContext ).getInjector().getInstance( IMockInterface, "instance" ) );

var instance2 : MockClass = this._getCoreFactory().locate( "instance2" );
Assert.isNotNull( instance2 );
Assert.isInstanceOf( instance2, MockClass );
Assert.equals( instance2, this._applicationAssembler.getApplicationContext( "applicationContext", ApplicationContext ).getInjector().getInstanceWithClassName( "hex.mock.MockModuleWithInternalType.GetInfosInternalTypedef", "instance2" ) );
}

@Test( "test multi map-type attributes" )
Expand Down
4 changes: 4 additions & 0 deletions test/hex/compiletime/flow/BasicStaticFlowCompilerTest.hx
Original file line number Diff line number Diff line change
Expand Up @@ -664,6 +664,10 @@ class BasicStaticFlowCompilerTest
Assert.isInstanceOf( code.locator.instance, MockClass );
Assert.isInstanceOf( code.locator.instance, IMockInterface );
Assert.equals( code.locator.instance, code.applicationContext.getInjector().getInstance( IMockInterface, "instance" ) );

Assert.isNotNull( code.locator.instance2 );
Assert.isInstanceOf( code.locator.instance2, MockClass );
Assert.equals( code.locator.instance2, code.applicationContext.getInjector().getInstanceWithClassName( 'hex.mock.MockModuleWithInternalType.GetInfosInternalTypedef', "instance2" ) );
}

@Test( "test multi map-type attributes" )
Expand Down
4 changes: 4 additions & 0 deletions test/hex/compiletime/xml/BasicStaticXmlCompilerTest.hx
Original file line number Diff line number Diff line change
Expand Up @@ -661,6 +661,10 @@ class BasicStaticXmlCompilerTest
Assert.isInstanceOf( code.locator.instance, MockClass );
Assert.isInstanceOf( code.locator.instance, IMockInterface );
Assert.equals( code.locator.instance, code.applicationContext.getInjector().getInstance( IMockInterface, "instance" ) );

Assert.isNotNull( code.locator.instance2 );
Assert.isInstanceOf( code.locator.instance2, MockClass );
Assert.equals( code.locator.instance2, code.applicationContext.getInjector().getInstanceWithClassName( 'hex.mock.MockModuleWithInternalType.GetInfosInternalTypedef', "instance2" ) );
}

@Test( "test multi map-type attributes" )
Expand Down
6 changes: 6 additions & 0 deletions test/hex/compiletime/xml/BasicXmlCompilerTest.hx
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import hex.mock.MockContextHolder;
import hex.mock.MockFruitVO;
import hex.mock.MockInjectee;
import hex.mock.MockMethodCaller;
import hex.mock.MockModuleWithInternalType.GetInfosInternalTypedef;
import hex.mock.MockObjectWithRegtangleProperty;
import hex.mock.MockProxy;
import hex.mock.MockReceiver;
Expand Down Expand Up @@ -634,6 +635,11 @@ class BasicXmlCompilerTest
Assert.isInstanceOf( instance, MockClass );
Assert.isInstanceOf( instance, IMockInterface );
Assert.equals( instance, this._applicationAssembler.getApplicationContext( "applicationContext", ApplicationContext ).getInjector().getInstance( IMockInterface, "instance" ) );

var instance2 : MockClass = this._getCoreFactory().locate( "instance2" );
Assert.isNotNull( instance2 );
Assert.isInstanceOf( instance2, MockClass );
Assert.equals( instance2, this._applicationAssembler.getApplicationContext( "applicationContext", ApplicationContext ).getInjector().getInstanceWithClassName( 'hex.mock.MockModuleWithInternalType.GetInfosInternalTypedef', "instance2" ) );
}

@Test( "test multi map-type attributes" )
Expand Down
5 changes: 5 additions & 0 deletions test/hex/mock/MockClass.hx
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,9 @@ class MockClass implements IMockInterface implements IAnotherMockInterface
{

}

public function getInfos() : String
{
return 'infos';
}
}
20 changes: 20 additions & 0 deletions test/hex/mock/MockModuleWithInternalType.hx
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package hex.mock;

/**
* ...
* @author Francis Bourre
*/
class MockModuleWithInternalType
{

public function new()
{

}

}

typedef GetInfosInternalTypedef =
{
function getInfos() : String;
}

0 comments on commit f652c40

Please sign in to comment.