These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | |||
3 | /* |
||
4 | * This file is part of the Sonata Project package. |
||
5 | * |
||
6 | * (c) Thomas Rabaix <[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 Sonata\EasyExtendsBundle\Tests\Mapper; |
||
13 | |||
14 | use Doctrine\Common\Persistence\ManagerRegistry; |
||
15 | use Doctrine\ORM\Mapping\ClassMetadataInfo; |
||
16 | use Sonata\EasyExtendsBundle\Mapper\DoctrineORMMapper; |
||
17 | |||
18 | class DoctrineORMMapperTest extends \PHPUnit_Framework_TestCase |
||
19 | { |
||
20 | /** |
||
21 | * @var ManagerRegistry |
||
22 | */ |
||
23 | private $doctrine; |
||
24 | |||
25 | /** |
||
26 | * @var ClassMetadataInfo |
||
27 | */ |
||
28 | private $metadata; |
||
29 | |||
30 | public function setUp() |
||
31 | { |
||
32 | $this->doctrine = $this->getMock('Doctrine\Common\Persistence\ManagerRegistry', array(), array(), '', false); |
||
33 | $this->metadata = $this->getMock('Doctrine\ORM\Mapping\ClassMetadataInfo', array(), array(), '', false); |
||
34 | } |
||
35 | |||
36 | public function testLoadDiscriminators() |
||
37 | { |
||
38 | $this->metadata |
||
0 ignored issues
–
show
|
|||
39 | ->expects($this->atLeastOnce()) |
||
40 | ->method('setDiscriminatorMap') |
||
41 | ->with(array('key' => 'discriminator')); |
||
42 | |||
43 | $this->metadata->name = 'class'; |
||
44 | $mapper = new DoctrineORMMapper($this->doctrine); |
||
45 | $mapper->addDiscriminator('class', 'key', 'discriminator'); |
||
46 | |||
47 | $r = new \ReflectionObject($mapper); |
||
48 | $m = $r->getMethod('loadDiscriminators'); |
||
49 | $m->setAccessible(true); |
||
50 | $m->invoke($mapper, $this->metadata); |
||
51 | } |
||
52 | |||
53 | public function testLoadDiscriminatorColumns() |
||
54 | { |
||
55 | $this->metadata |
||
0 ignored issues
–
show
The method
expects() does not seem to exist on object<Doctrine\ORM\Mapping\ClassMetadataInfo> .
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces. This is most likely a typographical error or the method has been renamed.
Loading history...
|
|||
56 | ->expects($this->atLeastOnce()) |
||
57 | ->method('setDiscriminatorColumn') |
||
58 | ->with(array('name' => 'disc')); |
||
59 | |||
60 | $this->metadata->name = 'class'; |
||
61 | $mapper = new DoctrineORMMapper($this->doctrine); |
||
62 | $mapper->addDiscriminatorColumn('class', array('name' => 'disc')); |
||
63 | |||
64 | $r = new \ReflectionObject($mapper); |
||
65 | $m = $r->getMethod('loadDiscriminatorColumns'); |
||
66 | $m->setAccessible(true); |
||
67 | $m->invoke($mapper, $this->metadata); |
||
68 | } |
||
69 | |||
70 | public function testInheritanceTypes() |
||
71 | { |
||
72 | $this->metadata |
||
0 ignored issues
–
show
The method
expects() does not seem to exist on object<Doctrine\ORM\Mapping\ClassMetadataInfo> .
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces. This is most likely a typographical error or the method has been renamed.
Loading history...
|
|||
73 | ->expects($this->atLeastOnce()) |
||
74 | ->method('setInheritanceType') |
||
75 | ->with(1); |
||
76 | |||
77 | $this->metadata->name = 'class'; |
||
78 | $mapper = new DoctrineORMMapper($this->doctrine); |
||
79 | $mapper->addInheritanceType('class', 1); |
||
80 | |||
81 | $r = new \ReflectionObject($mapper); |
||
82 | $m = $r->getMethod('loadInheritanceTypes'); |
||
83 | $m->setAccessible(true); |
||
84 | $m->invoke($mapper, $this->metadata); |
||
85 | } |
||
86 | } |
||
87 |
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.
This is most likely a typographical error or the method has been renamed.