Exemple #1
0
 function Test_of_countBySql()
 {
     $AkTestUser = new AkTestUser();
     $this->assertEqual($AkTestUser->countBySql("SELECT COUNT(*) FROM ak_test_users"), count($AkTestUser->find()));
     $this->assertEqual($AkTestUser->countBySql("SELECT COUNT(*) FROM ak_test_users WHERE first_name = 'Tim'"), count($AkTestUser->findAll("first_name = 'Tim'")));
 }
Exemple #2
0
 public function Test_of_findAll()
 {
     $Users = new AkTestUser();
     $Got = $Users->findAll("last_name = 'Williams'");
     $this->assertEqual($Got[0]->first_name, 'Jane');
     if ($FoundUsers = $Users->findAll()) {
         foreach ($FoundUsers as $FoundUser) {
             $this->assertTrue(in_array($FoundUser->first_name, array('Bermi', 'Hilario', 'test_name', 'Alicia', 'John', 'Jane')));
         }
     }
     if ($FoundUsers = $Users->findAll(array('order' => 'first_name'))) {
         $this->assertEqual($FoundUsers[0]->first_name, 'Alicia');
     }
 }