@@ 64-88 (lines=25) @@ | ||
61 | $this->assertEquals($updated, $this->object->getUpdated()); |
|
62 | } |
|
63 | ||
64 | public function testGetSetRef() |
|
65 | { |
|
66 | $entity = new TestEntity(1); |
|
67 | ||
68 | $em = $this->getMockBuilder(EntityManager::class) |
|
69 | ->disableOriginalConstructor() |
|
70 | ->getMock(); |
|
71 | ||
72 | $repo = $this->getMockBuilder(EntityRepository::class) |
|
73 | ->disableOriginalConstructor() |
|
74 | ->getMock(); |
|
75 | ||
76 | $repo->expects($this->any()) |
|
77 | ->method('find') |
|
78 | ->will($this->returnValue($entity)); |
|
79 | ||
80 | $em->expects($this->any()) |
|
81 | ->method('getRepository') |
|
82 | ->will($this->returnValue($repo)); |
|
83 | ||
84 | $this->object->setRef($entity); |
|
85 | $this->assertEquals(1, $this->object->getRefId()); |
|
86 | $this->assertEquals('Kunstmaan\NodeBundle\Tests\Entity\TestEntity', $this->object->getRefEntityName()); |
|
87 | $this->assertInstanceOf(TestEntity::class, $this->object->getRef($em)); |
|
88 | } |
|
89 | ||
90 | public function testGetDefaultAdminType() |
|
91 | { |
@@ 142-168 (lines=27) @@ | ||
139 | $this->assertEquals('delboy1978uk', $this->object->getOgArticleAuthor()); |
|
140 | } |
|
141 | ||
142 | public function testGetSetRef() |
|
143 | { |
|
144 | $ref = new Redirect(); |
|
145 | $ref->setId(666); |
|
146 | ||
147 | $this->object->setRef($ref); |
|
148 | ||
149 | $em = $this->getMockBuilder(EntityManager::class) |
|
150 | ->disableOriginalConstructor() |
|
151 | ->getMock(); |
|
152 | ||
153 | $repo = $this->getMockBuilder(EntityRepository::class) |
|
154 | ->disableOriginalConstructor() |
|
155 | ->getMock(); |
|
156 | ||
157 | $repo->expects($this->any()) |
|
158 | ->method('find') |
|
159 | ->will($this->returnValue($ref)); |
|
160 | ||
161 | $em->expects($this->any()) |
|
162 | ->method('getRepository') |
|
163 | ->will($this->returnValue($repo)); |
|
164 | ||
165 | $this->assertInstanceOf(Redirect::class, $this->object->getRef($em)); |
|
166 | $this->assertEquals('666', $this->object->getRefId()); |
|
167 | $this->assertEquals(Redirect::class, $this->object->getRefEntityName()); |
|
168 | } |
|
169 | } |
|
170 |