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\Common\Persistence\ObjectManager; |
15
|
|
|
use Xabbuh\XApi\Model\IRI; |
16
|
|
|
use XApi\Repository\Api\Test\Functional\ActivityRepositoryTest as BaseActivityRepositoryTest; |
17
|
|
|
use XApi\Repository\Doctrine\Repository\ActivityRepository; |
18
|
|
|
use XApi\Repository\Doctrine\Storage\ObjectStorage; |
19
|
|
|
use XApi\Repository\Doctrine\Test\ActivityRepository as FreshActivityRepository; |
20
|
|
|
|
21
|
|
|
/** |
22
|
|
|
* @author Jérôme Parmentier <[email protected]> |
23
|
|
|
*/ |
24
|
|
|
abstract class ActivityRepositoryTest extends BaseActivityRepositoryTest |
25
|
|
|
{ |
26
|
|
|
/** |
27
|
|
|
* @var ObjectManager |
28
|
|
|
*/ |
29
|
|
|
protected $objectManager; |
30
|
|
|
|
31
|
|
|
/** |
32
|
|
|
* @var ObjectStorage |
33
|
|
|
*/ |
34
|
|
|
protected $storage; |
35
|
|
|
|
36
|
|
|
protected function setUp() |
37
|
|
|
{ |
38
|
|
|
$this->objectManager = $this->createObjectManager(); |
39
|
|
|
$this->storage = $this->createStorage(); |
|
|
|
|
40
|
|
|
|
41
|
|
|
parent::setUp(); |
42
|
|
|
} |
43
|
|
|
|
44
|
|
|
protected function createActivityRepository() |
45
|
|
|
{ |
46
|
|
|
return new FreshActivityRepository(new ActivityRepository($this->storage), $this->objectManager); |
47
|
|
|
} |
48
|
|
|
|
49
|
|
|
protected function cleanDatabase() |
50
|
|
|
{ |
51
|
|
|
$this->objectManager->remove($this->storage->findObject( |
52
|
|
|
array( |
53
|
|
|
'type' => 'activity', |
54
|
|
|
'activityId' => IRI::fromString('http://tincanapi.com/conformancetest/activityid')->getValue(), |
55
|
|
|
) |
56
|
|
|
)); |
57
|
|
|
|
58
|
|
|
$this->objectManager->flush(); |
59
|
|
|
} |
60
|
|
|
|
61
|
|
|
/** |
62
|
|
|
* @return ObjectManager |
63
|
|
|
*/ |
64
|
|
|
abstract protected function createObjectManager(); |
65
|
|
|
|
66
|
|
|
/** |
67
|
|
|
* @return string |
68
|
|
|
*/ |
69
|
|
|
abstract protected function getActivityClassName(); |
70
|
|
|
|
71
|
|
|
private function createStorage() |
72
|
|
|
{ |
73
|
|
|
return $this->objectManager->getRepository($this->getActivityClassName()); |
74
|
|
|
} |
75
|
|
|
} |
76
|
|
|
|
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..