@@ 624-641 (lines=18) @@ | ||
621 | /** |
|
622 | * @depends testDaoGeneration |
|
623 | */ |
|
624 | public function testFindOrderBy() |
|
625 | { |
|
626 | $userDao = new TestUserDao($this->tdbmService); |
|
627 | $users = $userDao->getUsersByAlphabeticalOrder(); |
|
628 | ||
629 | $this->assertCount(6, $users); |
|
630 | $this->assertEquals('bill.shakespeare', $users[0]->getLogin()); |
|
631 | $this->assertEquals('jean.dupont', $users[1]->getLogin()); |
|
632 | ||
633 | $users = $userDao->getUsersByCountryOrder(); |
|
634 | $this->assertCount(6, $users); |
|
635 | $countryName1 = $users[0]->getCountry()->getLabel(); |
|
636 | for ($i = 1; $i < 6; $i++) { |
|
637 | $countryName2 = $users[$i]->getCountry()->getLabel(); |
|
638 | $this->assertLessThanOrEqual(0, strcmp($countryName1, $countryName2)); |
|
639 | $countryName1 = $countryName2; |
|
640 | } |
|
641 | } |
|
642 | ||
643 | /** |
|
644 | * @depends testDaoGeneration |
|
@@ 646-663 (lines=18) @@ | ||
643 | /** |
|
644 | * @depends testDaoGeneration |
|
645 | */ |
|
646 | public function testFindFromSqlOrderBy() |
|
647 | { |
|
648 | $userDao = new TestUserDao($this->tdbmService); |
|
649 | $users = $userDao->getUsersFromSqlByAlphabeticalOrder(); |
|
650 | ||
651 | $this->assertCount(6, $users); |
|
652 | $this->assertEquals('bill.shakespeare', $users[0]->getLogin()); |
|
653 | $this->assertEquals('jean.dupont', $users[1]->getLogin()); |
|
654 | ||
655 | $users = $userDao->getUsersFromSqlByCountryOrder(); |
|
656 | $this->assertCount(6, $users); |
|
657 | $countryName1 = $users[0]->getCountry()->getLabel(); |
|
658 | for ($i = 1; $i < 6; $i++) { |
|
659 | $countryName2 = $users[$i]->getCountry()->getLabel(); |
|
660 | $this->assertLessThanOrEqual(0, strcmp($countryName1, $countryName2)); |
|
661 | $countryName1 = $countryName2; |
|
662 | } |
|
663 | } |
|
664 | ||
665 | /** |
|
666 | * @depends testDaoGeneration |