File tree 4 files changed +15
-6
lines changed
Bundle/FrameworkBundle/Tests/DependencyInjection
4 files changed +15
-6
lines changed Original file line number Diff line number Diff line change 15
15
use Symfony \Bundle \FullStack ;
16
16
use Symfony \Bundle \FrameworkBundle \Tests \TestCase ;
17
17
use Symfony \Bundle \FrameworkBundle \DependencyInjection \FrameworkExtension ;
18
+ use Symfony \Component \Asset \EventListener \PreloadListener ;
18
19
use Symfony \Component \Cache \Adapter \ApcuAdapter ;
19
20
use Symfony \Component \Cache \Adapter \ChainAdapter ;
20
21
use Symfony \Component \Cache \Adapter \DoctrineAdapter ;
@@ -363,8 +364,6 @@ public function testAssets()
363
364
364
365
$ package = $ container ->getDefinition ((string ) $ packages ['bar_version_strategy ' ]);
365
366
$ this ->assertEquals ('assets.custom_version_strategy ' , (string ) $ package ->getArgument (1 ));
366
-
367
- $ this ->assertTrue ($ container ->hasDefinition ('asset.preload_listener ' ));
368
367
}
369
368
370
369
public function testAssetsDefaultVersionStrategyAsService ()
@@ -377,6 +376,16 @@ public function testAssetsDefaultVersionStrategyAsService()
377
376
$ this ->assertEquals ('assets.custom_version_strategy ' , (string ) $ defaultPackage ->getArgument (1 ));
378
377
}
379
378
379
+ public function testAssetHasPreloadListener ()
380
+ {
381
+ if (!class_exists (PreloadListener::class)) {
382
+ $ this ->markTestSkipped ('Requires asset 3.3 or superior. ' );
383
+ }
384
+
385
+ $ container = $ this ->createContainerFromFile ('assets ' );
386
+ $ this ->assertTrue ($ container ->hasDefinition ('asset.preload_listener ' ));
387
+ }
388
+
380
389
public function testTranslator ()
381
390
{
382
391
$ container = $ this ->createContainerFromFile ('full ' );
Original file line number Diff line number Diff line change @@ -29,7 +29,7 @@ public function testOnKernelResponse()
29
29
$ listener = new PreloadListener ($ manager );
30
30
$ response = new Response ();
31
31
32
- $ event = $ this ->createMock (FilterResponseEvent::class);
32
+ $ event = $ this ->getMockBuilder (FilterResponseEvent::class)-> disableOriginalConstructor ()-> getMock ( );
33
33
$ event ->method ('getResponse ' )->willReturn ($ response );
34
34
35
35
$ listener ->onKernelResponse ($ event );
Original file line number Diff line number Diff line change @@ -55,7 +55,7 @@ public function testGetVersion()
55
55
56
56
public function testGetAndPreloadUrl ()
57
57
{
58
- $ preloadManager = $ this ->createMock (PreloadManagerInterface::class);
58
+ $ preloadManager = $ this ->getMockBuilder (PreloadManagerInterface::class)-> getMock ( );
59
59
$ preloadManager
60
60
->expects ($ this ->exactly (2 ))
61
61
->method ('addResource ' )
Original file line number Diff line number Diff line change @@ -58,7 +58,7 @@ public function testGetUrl()
58
58
59
59
public function testGetAndPreloadUrl ()
60
60
{
61
- $ preloadManager = $ this ->createMock (PreloadManagerInterface::class);
61
+ $ preloadManager = $ this ->getMockBuilder (PreloadManagerInterface::class)-> getMock ( );
62
62
$ preloadManager
63
63
->expects ($ this ->exactly (2 ))
64
64
->method ('addResource ' )
@@ -100,7 +100,7 @@ public function testUndefinedPackage()
100
100
*/
101
101
public function testDoesNotSupportPreloading ()
102
102
{
103
- $ packages = new Packages ($ this ->createMock (PackageInterface::class));
103
+ $ packages = new Packages ($ this ->getMockBuilder (PackageInterface::class)-> getMock ( ));
104
104
$ packages ->getAndPreloadUrl ('/foo ' );
105
105
}
106
106
}
You can’t perform that action at this time.
0 commit comments