Skip to content

Commit c0aff04

Browse files
use phpcr own repository manager and test dev version of phpcr-bundle (#174)
1 parent 9c89256 commit c0aff04

File tree

2 files changed

+20
-6
lines changed

2 files changed

+20
-6
lines changed

src/Functional/BaseTestCase.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
namespace Symfony\Cmf\Component\Testing\Functional;
1313

14+
use Doctrine\Bundle\PHPCRBundle\Test\RepositoryManager;
1415
use Symfony\Bundle\FrameworkBundle\Client;
1516
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
1617
use Symfony\Component\DependencyInjection\Container;
@@ -112,6 +113,10 @@ public function getDbManager($type)
112113
$type
113114
);
114115

116+
if ('phpcr' === strtolower($type) && class_exists(RepositoryManager::class)) {
117+
$className = RepositoryManager::class;
118+
}
119+
115120
if (!class_exists($className)) {
116121
throw new \InvalidArgumentException(sprintf(
117122
'Test DBManager "%s" does not exist.',

tests/Functional/BaseTestCaseTest.php

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,40 +11,46 @@
1111

1212
namespace Symfony\Cmf\Component\Testing\Tests\Functional;
1313

14+
use Doctrine\Bundle\PHPCRBundle\Test\RepositoryManager;
15+
use Symfony\Bundle\FrameworkBundle\Client;
16+
use Symfony\Cmf\Component\Testing\Functional\DbManager\PHPCR;
1417
use Symfony\Cmf\Component\Testing\Tests\Fixtures\TestTestCase;
18+
use Symfony\Component\DependencyInjection\ContainerInterface;
19+
use Symfony\Component\HttpKernel\KernelInterface;
1520

1621
class BaseTestCaseTest extends \PHPUnit_Framework_TestCase
1722
{
1823
private $container;
1924

2025
private $kernel;
2126

27+
/**
28+
* @var TestTestCase
29+
*/
2230
private $testCase;
2331

2432
private $client;
2533

2634
protected function setUp()
2735
{
28-
$this->container = $this->createMock('Symfony\Component\DependencyInjection\ContainerInterface');
36+
$this->container = $this->createMock(ContainerInterface::class);
2937
$this->container->expects($this->any())
3038
->method('get')
3139
->will($this->returnCallback(function ($name) {
32-
$dic = [
33-
'test.client' => $this->client,
34-
];
40+
$dic = ['test.client' => $this->client];
3541

3642
return $dic[$name];
3743
}));
3844

39-
$this->kernel = $this->createMock('Symfony\Component\HttpKernel\KernelInterface');
45+
$this->kernel = $this->createMock(KernelInterface::class);
4046
$this->kernel->expects($this->any())
4147
->method('getContainer')
4248
->willReturn($this->container);
4349

4450
$this->testCase = new TestTestCase();
4551
$this->testCase->setKernel($this->kernel);
4652

47-
$this->client = $this->createMock('Symfony\Bundle\FrameworkBundle\Client');
53+
$this->client = $this->createMock(Client::class);
4854
$this->client->expects($this->any())
4955
->method('getContainer')
5056
->willReturn($this->container);
@@ -81,6 +87,9 @@ public function testDb($dbName, $expected)
8187
'Symfony\Cmf\Component\Testing\Functional\DbManager\%s',
8288
$expected
8389
);
90+
if (PHPCR::class === $className && class_exists(RepositoryManager::class)) {
91+
$className = RepositoryManager::class;
92+
}
8493

8594
$this->assertInstanceOf($className, $res);
8695
}

0 commit comments

Comments
 (0)