@@ 192-207 (lines=16) @@ | ||
189 | /** |
|
190 | * @depends testDaoGeneration |
|
191 | */ |
|
192 | public function testForeignKeyInBean() |
|
193 | { |
|
194 | $userDao = new UserDao($this->tdbmService); |
|
195 | $userBean = $userDao->getById(1); |
|
196 | $country = $userBean->getCountry(); |
|
197 | ||
198 | $this->assertEquals('UK', $country->getLabel()); |
|
199 | ||
200 | $userBean2 = $userDao->getById(1); |
|
201 | $this->assertTrue($userBean === $userBean2); |
|
202 | ||
203 | $contactDao = new ContactDao($this->tdbmService); |
|
204 | $contactBean = $contactDao->getById(1); |
|
205 | ||
206 | $this->assertTrue($userBean === $contactBean); |
|
207 | } |
|
208 | ||
209 | /** |
|
210 | * @depends testDaoGeneration |
|
@@ 538-559 (lines=22) @@ | ||
535 | * |
|
536 | * @depends testJointureSave7 |
|
537 | */ |
|
538 | public function testJointureSave8() |
|
539 | { |
|
540 | $roleDao = new RoleDao($this->tdbmService); |
|
541 | $userDao = new UserDao($this->tdbmService); |
|
542 | $user = $userDao->getById(1); |
|
543 | ||
544 | $roles = $user->getRoles(); |
|
545 | foreach ($roles as $role) { |
|
546 | if ($role->getName() === 'my new role') { |
|
547 | $selectedRole = $role; |
|
548 | break; |
|
549 | } |
|
550 | } |
|
551 | $this->assertNotNull($selectedRole); |
|
552 | ||
553 | $this->assertCount(2, $user->getRoles()); |
|
554 | ||
555 | // Expected: relationship removed! |
|
556 | $roleDao->delete($selectedRole); |
|
557 | ||
558 | $this->assertCount(1, $user->getRoles()); |
|
559 | } |
|
560 | ||
561 | /** |
|
562 | * Step 9: Let's test the setXXX method. |