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