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