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