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