88use Codefog \TagsBundle \Manager \ManagerInterface ;
99use Codefog \TagsBundle \ManagerRegistry ;
1010use Codefog \TagsBundle \Test \Fixtures \DummyManager ;
11- use Contao \CoreBundle \Routing \ScopeMatcher ;
1211use Contao \DataContainer ;
1312use PHPUnit \Framework \TestCase ;
14- use Symfony \Component \HttpFoundation \Request ;
15- use Symfony \Component \HttpFoundation \RequestStack ;
1613
1714final class TagManagerListenerTest extends TestCase
1815{
@@ -28,8 +25,6 @@ public function testOnLoadDataContainer(): void
2825 ],
2926 ];
3027
31- $ GLOBALS ['TL_CSS ' ] = [];
32- $ GLOBALS ['TL_JAVASCRIPT ' ] = [];
3328 $ GLOBALS ['TL_CONFIG ' ]['debugMode ' ] = false ;
3429
3530 $ this ->mockListener ()->onLoadDataContainer ('tl_table ' );
@@ -47,13 +42,6 @@ public function testOnLoadDataContainer(): void
4742 ],
4843 $ GLOBALS ['TL_DCA ' ]['tl_table ' ]['fields ' ],
4944 );
50-
51- $ this ->assertContains ('bundles/codefogtags/selectize.min.css ' , $ GLOBALS ['TL_CSS ' ]);
52- $ this ->assertContains ('bundles/codefogtags/backend.min.css ' , $ GLOBALS ['TL_CSS ' ]);
53- $ this ->assertContains ('assets/jquery/js/jquery.min.js ' , $ GLOBALS ['TL_JAVASCRIPT ' ]);
54- $ this ->assertContains ('bundles/codefogtags/selectize.min.js ' , $ GLOBALS ['TL_JAVASCRIPT ' ]);
55- $ this ->assertContains ('bundles/codefogtags/widget.min.js ' , $ GLOBALS ['TL_JAVASCRIPT ' ]);
56- $ this ->assertContains ('bundles/codefogtags/backend.min.js ' , $ GLOBALS ['TL_JAVASCRIPT ' ]);
5745 }
5846
5947 public function testOnLoadDataContainerNoFields (): void
@@ -66,15 +54,7 @@ public function testOnLoadDataContainerNoFields(): void
6654 ->willReturn (new DummyManager ())
6755 ;
6856
69- $ requestStack = $ this ->createConfiguredMock (RequestStack::class, [
70- 'getCurrentRequest ' => new Request (),
71- ]);
72-
73- $ scopeMatcher = $ this ->createConfiguredMock (ScopeMatcher::class, [
74- 'isBackendRequest ' => true ,
75- ]);
76-
77- $ listener = new TagManagerListener ($ registry , $ requestStack , $ scopeMatcher );
57+ $ listener = new TagManagerListener ($ registry );
7858 $ listener ->onLoadDataContainer ('tl_table ' );
7959
8060 $ this ->assertSame ([], $ GLOBALS ['TL_DCA ' ]['tl_table ' ]);
@@ -90,7 +70,6 @@ public function testOnFieldSaveCallback(): void
9070
9171 $ dataContainer = $ this ->createMock (DataContainer::class);
9272 $ dataContainer
93- ->expects ($ this ->exactly (2 ))
9473 ->method ('__get ' )
9574 ->willReturnMap ([
9675 ['table ' , 'tl_table ' ],
@@ -111,7 +90,6 @@ public function testOnFieldSaveCallbackManagerUnsupported(): void
11190
11291 $ dataContainer = $ this ->createMock (DataContainer::class);
11392 $ dataContainer
114- ->expects ($ this ->exactly (2 ))
11593 ->method ('__get ' )
11694 ->willReturnMap ([
11795 ['table ' , 'tl_table ' ],
@@ -134,7 +112,6 @@ public function testOnOptionsCallback(): void
134112
135113 $ dataContainer = $ this ->createMock (DataContainer::class);
136114 $ dataContainer
137- ->expects ($ this ->exactly (2 ))
138115 ->method ('__get ' )
139116 ->willReturnMap ([
140117 ['table ' , 'tl_table ' ],
@@ -155,7 +132,6 @@ public function testOnOptionsCallbackManagerUnsupported(): void
155132
156133 $ dataContainer = $ this ->createMock (DataContainer::class);
157134 $ dataContainer
158- ->expects ($ this ->exactly (2 ))
159135 ->method ('__get ' )
160136 ->willReturnMap ([
161137 ['table ' , 'tl_table ' ],
@@ -174,14 +150,6 @@ private function mockListener($manager = null): TagManagerListener
174150 'get ' => $ manager ?? new DummyManager (),
175151 ]);
176152
177- $ requestStack = $ this ->createConfiguredMock (RequestStack::class, [
178- 'getCurrentRequest ' => new Request (),
179- ]);
180-
181- $ scopeMatcher = $ this ->createConfiguredMock (ScopeMatcher::class, [
182- 'isBackendRequest ' => true ,
183- ]);
184-
185- return new TagManagerListener ($ registry , $ requestStack , $ scopeMatcher );
153+ return new TagManagerListener ($ registry );
186154 }
187155}
0 commit comments