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