@@ -20,37 +20,25 @@ public function testShouldImplementRegistryInterface()
2020 $ this ->assertClassImplements (Registry::class, ContainerAwareRegistry::class);
2121 }
2222
23- public function testCouldBeConstructedWithEventsMapAndTransformersMapAsArguments ()
24- {
25- new ContainerAwareRegistry ([], []);
26- }
27-
28- public function testShouldSetContainerToContainerProperty ()
23+ public function testShouldAllowGetTransportNameByEventName ()
2924 {
3025 $ container = new Container ();
3126
32- $ registry = new ContainerAwareRegistry ([], []);
33-
34- $ registry ->setContainer ($ container );
35-
36- $ this ->assertAttributeSame ($ container , 'container ' , $ registry );
37- }
38-
39- public function testShouldAllowGetTransportNameByEventName ()
40- {
4127 $ registry = new ContainerAwareRegistry ([
42- 'fooEvent ' => 'fooTrans ' ,
43- ], []);
28+ 'fooEvent ' => 'fooTrans ' ,
29+ ], [], $ container );
4430
4531 $ this ->assertEquals ('fooTrans ' , $ registry ->getTransformerNameForEvent ('fooEvent ' ));
4632 }
4733
4834 public function testShouldAllowDefineTransportNameAsRegExpPattern ()
4935 {
36+ $ container = new Container ();
37+
5038 $ registry = new ContainerAwareRegistry ([
5139 '/.*/ ' => 'fooRegExpTrans ' ,
5240 'fooEvent ' => 'fooTrans ' ,
53- ], []);
41+ ], [], $ container );
5442
5543 // guard
5644 $ this ->assertEquals ('fooTrans ' , $ registry ->getTransformerNameForEvent ('fooEvent ' ));
@@ -60,9 +48,11 @@ public function testShouldAllowDefineTransportNameAsRegExpPattern()
6048
6149 public function testThrowIfNotSupportedEventGiven ()
6250 {
51+ $ container = new Container ();
52+
6353 $ registry = new ContainerAwareRegistry ([
6454 'fooEvent ' => 'fooTrans ' ,
65- ], []);
55+ ], [], $ container );
6656
6757 $ this ->expectException (\LogicException::class);
6858 $ this ->expectExceptionMessage ('There is no transformer registered for the given event fooNotSupportedEvent ' );
@@ -71,9 +61,11 @@ public function testThrowIfNotSupportedEventGiven()
7161
7262 public function testThrowIfThereIsNoRegisteredTransformerWithSuchName ()
7363 {
64+ $ container = new Container ();
65+
7466 $ registry = new ContainerAwareRegistry ([], [
7567 'fooTrans ' => 'foo_trans_id ' ,
76- ]);
68+ ], $ container );
7769
7870 $ this ->expectException (\LogicException::class);
7971 $ this ->expectExceptionMessage ('There is no transformer named fooNotRegisteredName ' );
@@ -87,8 +79,7 @@ public function testThrowIfContainerReturnsServiceNotInstanceOfEventTransformer(
8779
8880 $ registry = new ContainerAwareRegistry ([], [
8981 'fooTrans ' => 'foo_trans_id ' ,
90- ]);
91- $ registry ->setContainer ($ container );
82+ ], $ container );
9283
9384 $ this ->expectException (\LogicException::class);
9485 $ this ->expectExceptionMessage ('The container must return instance of Enqueue\AsyncEventDispatcher\EventTransformer but got stdClass ' );
@@ -104,8 +95,7 @@ public function testShouldReturnEventTransformer()
10495
10596 $ registry = new ContainerAwareRegistry ([], [
10697 'fooTrans ' => 'foo_trans_id ' ,
107- ]);
108- $ registry ->setContainer ($ container );
98+ ], $ container );
10999
110100 $ this ->assertSame ($ eventTransformerMock , $ registry ->getTransformer ('fooTrans ' ));
111101 }
0 commit comments