@@ 200-215 (lines=16) @@ | ||
197 | /** |
|
198 | * @depends testDaoGeneration |
|
199 | */ |
|
200 | public function testForeignKeyInBean() |
|
201 | { |
|
202 | $userDao = new UserDao($this->tdbmService); |
|
203 | $userBean = $userDao->getById(1); |
|
204 | $country = $userBean->getCountry(); |
|
205 | ||
206 | $this->assertEquals('UK', $country->getLabel()); |
|
207 | ||
208 | $userBean2 = $userDao->getById(1); |
|
209 | $this->assertTrue($userBean === $userBean2); |
|
210 | ||
211 | $contactDao = new ContactDao($this->tdbmService); |
|
212 | $contactBean = $contactDao->getById(1); |
|
213 | ||
214 | $this->assertTrue($userBean === $contactBean); |
|
215 | } |
|
216 | ||
217 | /** |
|
218 | * @depends testDaoGeneration |
|
@@ 565-586 (lines=22) @@ | ||
562 | * |
|
563 | * @depends testJointureSave7 |
|
564 | */ |
|
565 | public function testJointureSave8() |
|
566 | { |
|
567 | $roleDao = new RoleDao($this->tdbmService); |
|
568 | $userDao = new UserDao($this->tdbmService); |
|
569 | $user = $userDao->getById(1); |
|
570 | ||
571 | $roles = $user->getRoles(); |
|
572 | foreach ($roles as $role) { |
|
573 | if ($role->getName() === 'my new role') { |
|
574 | $selectedRole = $role; |
|
575 | break; |
|
576 | } |
|
577 | } |
|
578 | $this->assertNotNull($selectedRole); |
|
579 | ||
580 | $this->assertCount(2, $user->getRoles()); |
|
581 | ||
582 | // Expected: relationship removed! |
|
583 | $roleDao->delete($selectedRole); |
|
584 | ||
585 | $this->assertCount(1, $user->getRoles()); |
|
586 | } |
|
587 | ||
588 | /** |
|
589 | * Step 9: Let's test the setXXX method. |