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