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