1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/* |
4
|
|
|
* This file is part of the xAPI package. |
5
|
|
|
* |
6
|
|
|
* (c) Christian Flothmann <[email protected]> |
7
|
|
|
* |
8
|
|
|
* For the full copyright and license information, please view the LICENSE |
9
|
|
|
* file that was distributed with this source code. |
10
|
|
|
*/ |
11
|
|
|
|
12
|
|
|
namespace XApi\Repository\MongoDB\Tests\Functional; |
13
|
|
|
|
14
|
|
|
use Doctrine\Common\Persistence\Mapping\Driver\SymfonyFileLocator; |
15
|
|
|
use Doctrine\Common\Persistence\ObjectManager; |
16
|
|
|
use Doctrine\MongoDB\Connection; |
17
|
|
|
use Doctrine\ODM\MongoDB\Configuration; |
18
|
|
|
use Doctrine\ODM\MongoDB\DocumentManager; |
19
|
|
|
use Doctrine\ODM\MongoDB\Mapping\Driver\XmlDriver; |
20
|
|
|
use XApi\Repository\Doctrine\Test\Functional\StatementRepositoryTest as BaseStatementRepositoryTest; |
21
|
|
|
|
22
|
|
|
/** |
23
|
|
|
* @author Christian Flothmann <[email protected]> |
24
|
|
|
*/ |
25
|
|
|
class StatementRepositoryTest extends BaseStatementRepositoryTest |
26
|
|
|
{ |
27
|
|
|
/** |
28
|
|
|
* @return ObjectManager |
29
|
|
|
*/ |
30
|
|
|
protected function createObjectManager() |
31
|
|
|
{ |
32
|
|
|
$config = new Configuration(); |
33
|
|
|
$config->setProxyDir(__DIR__.'/../proxies'); |
34
|
|
|
$config->setProxyNamespace('Proxy'); |
35
|
|
|
$config->setHydratorDir(__DIR__.'/../hydrators'); |
36
|
|
|
$config->setHydratorNamespace('Hydrator'); |
37
|
|
|
$fileLocator = new SymfonyFileLocator( |
38
|
|
|
array(__DIR__.'/../../metadata' => 'XApi\Repository\Api\Mapping'), |
39
|
|
|
'.mongodb.xml' |
40
|
|
|
); |
41
|
|
|
$driver = new XmlDriver($fileLocator); |
42
|
|
|
$config->setMetadataDriverImpl($driver); |
43
|
|
|
|
44
|
|
|
return DocumentManager::create(new Connection(), $config); |
45
|
|
|
} |
46
|
|
|
|
47
|
|
|
protected function getStatementClassName() |
48
|
|
|
{ |
49
|
|
|
return 'XApi\Repository\Api\Mapping\MappedStatement'; |
50
|
|
|
} |
51
|
|
|
} |
52
|
|
|
|