@@ 597-614 (lines=18) @@ | ||
594 | /** |
|
595 | * @depends testDaoGeneration |
|
596 | */ |
|
597 | public function testFindOrderBy() |
|
598 | { |
|
599 | $userDao = new TestUserDao($this->tdbmService); |
|
600 | $users = $userDao->getUsersByAlphabeticalOrder(); |
|
601 | ||
602 | $this->assertCount(6, $users); |
|
603 | $this->assertEquals('bill.shakespeare', $users[0]->getLogin()); |
|
604 | $this->assertEquals('jean.dupont', $users[1]->getLogin()); |
|
605 | ||
606 | $users = $userDao->getUsersByCountryOrder(); |
|
607 | $this->assertCount(6, $users); |
|
608 | $countryName1 = $users[0]->getCountry()->getLabel(); |
|
609 | for ($i = 1; $i < 6; $i++) { |
|
610 | $countryName2 = $users[$i]->getCountry()->getLabel(); |
|
611 | $this->assertLessThanOrEqual(0, strcmp($countryName1, $countryName2)); |
|
612 | $countryName1 = $countryName2; |
|
613 | } |
|
614 | } |
|
615 | ||
616 | /** |
|
617 | * @depends testDaoGeneration |
|
@@ 619-636 (lines=18) @@ | ||
616 | /** |
|
617 | * @depends testDaoGeneration |
|
618 | */ |
|
619 | public function testFindFromSqlOrderBy() |
|
620 | { |
|
621 | $userDao = new TestUserDao($this->tdbmService); |
|
622 | $users = $userDao->getUsersFromSqlByAlphabeticalOrder(); |
|
623 | ||
624 | $this->assertCount(6, $users); |
|
625 | $this->assertEquals('bill.shakespeare', $users[0]->getLogin()); |
|
626 | $this->assertEquals('jean.dupont', $users[1]->getLogin()); |
|
627 | ||
628 | $users = $userDao->getUsersFromSqlByCountryOrder(); |
|
629 | $this->assertCount(6, $users); |
|
630 | $countryName1 = $users[0]->getCountry()->getLabel(); |
|
631 | for ($i = 1; $i < 6; $i++) { |
|
632 | $countryName2 = $users[$i]->getCountry()->getLabel(); |
|
633 | $this->assertLessThanOrEqual(0, strcmp($countryName1, $countryName2)); |
|
634 | $countryName1 = $countryName2; |
|
635 | } |
|
636 | } |
|
637 | ||
638 | /** |
|
639 | * @depends testDaoGeneration |