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 Xabbuh\XApi\Storage\Doctrine\Tests\Functional; |
13
|
|
|
|
14
|
|
|
use Doctrine\Common\Persistence\ObjectManager; |
15
|
|
|
use Xabbuh\XApi\Storage\Api\Test\Functional\StatementRepositoryTest as BaseStatementRepositoryTest; |
16
|
|
|
use Xabbuh\XApi\Storage\Doctrine\Repository\MappedStatementRepository; |
17
|
|
|
use Xabbuh\XApi\Storage\Doctrine\Repository\StatementRepository; |
18
|
|
|
|
19
|
|
|
/** |
20
|
|
|
* @author Christian Flothmann <[email protected]> |
21
|
|
|
*/ |
22
|
|
|
abstract class StatementRepositoryTest extends BaseStatementRepositoryTest |
23
|
|
|
{ |
24
|
|
|
/** |
25
|
|
|
* @var ObjectManager |
26
|
|
|
*/ |
27
|
|
|
protected $objectManager; |
28
|
|
|
|
29
|
|
|
/** |
30
|
|
|
* @var MappedStatementRepository |
31
|
|
|
*/ |
32
|
|
|
protected $repository; |
33
|
|
|
|
34
|
|
|
protected function setUp() |
35
|
|
|
{ |
36
|
|
|
$this->objectManager = $this->createObjectManager(); |
37
|
|
|
$this->repository = $this->createRepository(); |
|
|
|
|
38
|
|
|
|
39
|
|
|
parent::setUp(); |
40
|
|
|
} |
41
|
|
|
|
42
|
|
|
protected function createStatementRepository() |
43
|
|
|
{ |
44
|
|
|
return new StatementRepository($this->repository); |
45
|
|
|
} |
46
|
|
|
|
47
|
|
|
protected function cleanDatabase() |
48
|
|
|
{ |
49
|
|
|
foreach ($this->repository->findMappedStatements(array()) as $statement) { |
50
|
|
|
$this->objectManager->remove($statement); |
51
|
|
|
} |
52
|
|
|
|
53
|
|
|
$this->objectManager->flush(); |
54
|
|
|
} |
55
|
|
|
|
56
|
|
|
/** |
57
|
|
|
* @return ObjectManager |
58
|
|
|
*/ |
59
|
|
|
abstract protected function createObjectManager(); |
60
|
|
|
|
61
|
|
|
/** |
62
|
|
|
* @return string |
63
|
|
|
*/ |
64
|
|
|
abstract protected function getStatementClassName(); |
65
|
|
|
|
66
|
|
|
private function createRepository() |
67
|
|
|
{ |
68
|
|
|
return $this->objectManager->getRepository($this->getStatementClassName()); |
69
|
|
|
} |
70
|
|
|
} |
71
|
|
|
|
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..