Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 8f1e708

Browse files
committed
Fix tests
1 parent cf1c070 commit 8f1e708

File tree

4 files changed

+15
-6
lines changed

4 files changed

+15
-6
lines changed

src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
use Symfony\Bundle\FullStack;
1616
use Symfony\Bundle\FrameworkBundle\Tests\TestCase;
1717
use Symfony\Bundle\FrameworkBundle\DependencyInjection\FrameworkExtension;
18+
use Symfony\Component\Asset\EventListener\PreloadListener;
1819
use Symfony\Component\Cache\Adapter\ApcuAdapter;
1920
use Symfony\Component\Cache\Adapter\ChainAdapter;
2021
use Symfony\Component\Cache\Adapter\DoctrineAdapter;
@@ -363,8 +364,6 @@ public function testAssets()
363364

364365
$package = $container->getDefinition((string) $packages['bar_version_strategy']);
365366
$this->assertEquals('assets.custom_version_strategy', (string) $package->getArgument(1));
366-
367-
$this->assertTrue($container->hasDefinition('asset.preload_listener'));
368367
}
369368

370369
public function testAssetsDefaultVersionStrategyAsService()
@@ -377,6 +376,16 @@ public function testAssetsDefaultVersionStrategyAsService()
377376
$this->assertEquals('assets.custom_version_strategy', (string) $defaultPackage->getArgument(1));
378377
}
379378

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+
380389
public function testTranslator()
381390
{
382391
$container = $this->createContainerFromFile('full');

src/Symfony/Component/Asset/Tests/EventListener/PreloadListenerTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ public function testOnKernelResponse()
2929
$listener = new PreloadListener($manager);
3030
$response = new Response();
3131

32-
$event = $this->createMock(FilterResponseEvent::class);
32+
$event = $this->getMockBuilder(FilterResponseEvent::class)->disableOriginalConstructor()->getMock();
3333
$event->method('getResponse')->willReturn($response);
3434

3535
$listener->onKernelResponse($event);

src/Symfony/Component/Asset/Tests/PackageTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ public function testGetVersion()
5555

5656
public function testGetAndPreloadUrl()
5757
{
58-
$preloadManager = $this->createMock(PreloadManagerInterface::class);
58+
$preloadManager = $this->getMockBuilder(PreloadManagerInterface::class)->getMock();
5959
$preloadManager
6060
->expects($this->exactly(2))
6161
->method('addResource')

src/Symfony/Component/Asset/Tests/PackagesTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ public function testGetUrl()
5858

5959
public function testGetAndPreloadUrl()
6060
{
61-
$preloadManager = $this->createMock(PreloadManagerInterface::class);
61+
$preloadManager = $this->getMockBuilder(PreloadManagerInterface::class)->getMock();
6262
$preloadManager
6363
->expects($this->exactly(2))
6464
->method('addResource')
@@ -100,7 +100,7 @@ public function testUndefinedPackage()
100100
*/
101101
public function testDoesNotSupportPreloading()
102102
{
103-
$packages = new Packages($this->createMock(PackageInterface::class));
103+
$packages = new Packages($this->getMockBuilder(PackageInterface::class)->getMock());
104104
$packages->getAndPreloadUrl('/foo');
105105
}
106106
}

0 commit comments

Comments
 (0)