Skip to content

Commit 1395ac8

Browse files
committed
Backported the testsuite fix for Symfony 2.1
1 parent 029977d commit 1395ac8

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

Tests/Provider/BuilderAliasProviderTest.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
use Knp\Bundle\MenuBundle\Provider\BuilderAliasProvider;
66
use Knp\Bundle\MenuBundle\Tests\Stubs\TestKernel;
7+
use Symfony\Component\HttpKernel\Kernel;
78

89
class BuilderAliasProviderTest extends \PHPUnit_Framework_TestCase
910
{
@@ -208,7 +209,11 @@ private function createMockKernelForStub()
208209

209210
private function createTestKernel($childNamespace = 'Bar', $parentNamespace = 'Knp\Bundle\MenuBundle\Tests\Stubs')
210211
{
211-
$bundle = $this->getMock('Knp\Bundle\MenuBundle\Tests\Stubs\ContainerAwareBundleInterface');
212+
$bundleInterface = version_compare(Kernel::VERSION, '2.1-dev', '<')
213+
? 'Knp\Bundle\MenuBundle\Tests\Stubs\ContainerAwareBundleInterface' // Symfony 2.0 misses the extend in the interface
214+
: 'Symfony\Component\HttpKernel\Bundle\BundleInterface';
215+
216+
$bundle = $this->getMock($bundleInterface);
212217
$bundle->expects($this->any())
213218
->method('getNamespace')
214219
->will($this->returnValue($parentNamespace))
@@ -218,7 +223,7 @@ private function createTestKernel($childNamespace = 'Bar', $parentNamespace = 'K
218223
->will($this->returnValue('FooBundle'))
219224
;
220225

221-
$childBundle = $this->getMock('Knp\Bundle\MenuBundle\Tests\Stubs\ContainerAwareBundleInterface');
226+
$childBundle = $this->getMock($bundleInterface);
222227
$childBundle->expects($this->any())
223228
->method('getNamespace')
224229
->will($this->returnValue($childNamespace))

Tests/Stubs/TestKernel.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ public function __construct(array $bundles)
1313
{
1414
$this->mockBundles = $bundles;
1515

16-
parent::__construct('test', true);
16+
parent::__construct('test', false);
1717
}
1818

1919
public function registerBundles()

0 commit comments

Comments
 (0)