@@ 602-619 (lines=18) @@ | ||
599 | /** |
|
600 | * @depends testDaoGeneration |
|
601 | */ |
|
602 | public function testFindOrderBy() |
|
603 | { |
|
604 | $userDao = new TestUserDao($this->tdbmService); |
|
605 | $users = $userDao->getUsersByAlphabeticalOrder(); |
|
606 | ||
607 | $this->assertCount(6, $users); |
|
608 | $this->assertEquals('bill.shakespeare', $users[0]->getLogin()); |
|
609 | $this->assertEquals('jean.dupont', $users[1]->getLogin()); |
|
610 | ||
611 | $users = $userDao->getUsersByCountryOrder(); |
|
612 | $this->assertCount(6, $users); |
|
613 | $countryName1 = $users[0]->getCountry()->getLabel(); |
|
614 | for ($i = 1; $i < 6; $i++) { |
|
615 | $countryName2 = $users[$i]->getCountry()->getLabel(); |
|
616 | $this->assertLessThanOrEqual(0, strcmp($countryName1, $countryName2)); |
|
617 | $countryName1 = $countryName2; |
|
618 | } |
|
619 | } |
|
620 | ||
621 | /** |
|
622 | * @depends testDaoGeneration |
|
@@ 624-641 (lines=18) @@ | ||
621 | /** |
|
622 | * @depends testDaoGeneration |
|
623 | */ |
|
624 | public function testFindFromSqlOrderBy() |
|
625 | { |
|
626 | $userDao = new TestUserDao($this->tdbmService); |
|
627 | $users = $userDao->getUsersFromSqlByAlphabeticalOrder(); |
|
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->getUsersFromSqlByCountryOrder(); |
|
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 |