|
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\Doctrine\Test\Functional; |
|
13
|
|
|
|
|
14
|
|
|
use Doctrine\Persistence\ObjectManager; |
|
15
|
|
|
use XApi\Repository\Api\Test\Functional\StatementRepositoryTest as BaseStatementRepositoryTest; |
|
16
|
|
|
use XApi\Repository\Doctrine\Repository\Mapping\StatementRepository as MappedStatementRepository; |
|
17
|
|
|
use XApi\Repository\Doctrine\Repository\StatementRepository; |
|
18
|
|
|
use XApi\Repository\Doctrine\Test\StatementRepository as FreshStatementRepository; |
|
19
|
|
|
|
|
20
|
|
|
/** |
|
21
|
|
|
* @author Christian Flothmann <[email protected]> |
|
22
|
|
|
*/ |
|
23
|
|
|
abstract class StatementRepositoryTest extends BaseStatementRepositoryTest |
|
24
|
|
|
{ |
|
25
|
|
|
/** |
|
26
|
|
|
* @var ObjectManager |
|
27
|
|
|
*/ |
|
28
|
|
|
protected $objectManager; |
|
29
|
|
|
|
|
30
|
|
|
/** |
|
31
|
|
|
* @var MappedStatementRepository |
|
32
|
|
|
*/ |
|
33
|
|
|
protected $repository; |
|
34
|
|
|
|
|
35
|
|
|
protected function setUp() |
|
36
|
|
|
{ |
|
37
|
|
|
$this->objectManager = $this->createObjectManager(); |
|
38
|
|
|
$this->repository = $this->createRepository(); |
|
|
|
|
|
|
39
|
|
|
|
|
40
|
|
|
parent::setUp(); |
|
41
|
|
|
} |
|
42
|
|
|
|
|
43
|
|
|
protected function createStatementRepository() |
|
44
|
|
|
{ |
|
45
|
|
|
return new FreshStatementRepository(new StatementRepository($this->repository), $this->objectManager); |
|
46
|
|
|
} |
|
47
|
|
|
|
|
48
|
|
|
protected function cleanDatabase() |
|
49
|
|
|
{ |
|
50
|
|
|
foreach ($this->repository->findStatements(array()) as $statement) { |
|
51
|
|
|
$this->objectManager->remove($statement); |
|
52
|
|
|
} |
|
53
|
|
|
|
|
54
|
|
|
$this->objectManager->flush(); |
|
55
|
|
|
} |
|
56
|
|
|
|
|
57
|
|
|
/** |
|
58
|
|
|
* @return ObjectManager |
|
59
|
|
|
*/ |
|
60
|
|
|
abstract protected function createObjectManager(); |
|
61
|
|
|
|
|
62
|
|
|
/** |
|
63
|
|
|
* @return string |
|
64
|
|
|
*/ |
|
65
|
|
|
abstract protected function getStatementClassName(); |
|
66
|
|
|
|
|
67
|
|
|
private function createRepository() |
|
68
|
|
|
{ |
|
69
|
|
|
return $this->objectManager->getRepository($this->getStatementClassName()); |
|
70
|
|
|
} |
|
71
|
|
|
} |
|
72
|
|
|
|
Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.
Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..