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