function Test_of_findAllBy() { $Users = new AkTestUser(); $User_arr = $Users->findAllBy("first_name AND last_name", 'Tim', "O'Reilly"); $this->assertTrue($User_arr[0]->first_name == 'Tim' && $User_arr[0]->last_name == "O'Reilly" && $User_arr[0]->user_name == 'tim_oreilly'); $User_arr = $Users->findAllBy("first_name AND last_name", 'Tim', "O'Reilly"); $this->assertTrue($User_arr[0]->first_name == 'Tim' && $User_arr[0]->last_name == "O'Reilly" && $User_arr[0]->user_name == 'tim_oreilly'); $FoundUsers = $Users->findAllBy("first_name OR first_name:begins", 'Tim', 'Al', array('order' => 'last_name ASC')); $this->assertTrue($FoundUsers[0]->first_name == 'Tim'); $this->assertTrue($FoundUsers[1]->first_name == 'Alicia'); $this->assertErrorPattern('/Argument list did not match expected set/', $Users->findAllBy("username", 'tim_oreilly')); $this->assertErrorPattern('/Argument list did not match expected set/', $Users->findAllBy("user_name AND password", 'tim_oreilly')); $AkTestFields = new AkTestField(); $this->assertTrue($AkTestField = $AkTestFields->findAllBy('numeric_field:< AND boolean_field', 4, 'yes')); $this->assertEqual($AkTestField[0]->varchar_field, '2 string'); $this->assertEqual(count($AkTestField), 1); $this->assertTrue($AkTestField = $AkTestFields->findAllBy('varchar_field:begins', 2)); $this->assertEqual($AkTestField[0]->varchar_field, '2 string'); $this->assertEqual(count($AkTestField), 1); $this->assertTrue($AkTestField = $AkTestFields->findAllBy('(varchar_field:begins OR int8_field OR timestamp_field:<) AND tinyint_field:>=', 2, 3, '2005/05/04 23:00:00', 2)); $this->assertEqual($AkTestField[0]->varchar_field, '2 string'); $this->assertEqual($AkTestField[1]->varchar_field, '3 string'); $this->assertEqual($AkTestField[2]->varchar_field, '4 string'); $this->assertEqual(count($AkTestField), 3); $this->assertTrue($AkTestField = $AkTestFields->findAllBy('(varchar_field:begins OR int8_field OR timestamp_field:<) AND tinyint_field:>=', 2, 3, '2005/05/04 23:00:00', 2, array('order' => 'numeric_field DESC'))); $this->assertEqual($AkTestField[0]->varchar_field, '4 string'); $this->assertEqual($AkTestField[1]->varchar_field, '3 string'); $this->assertEqual($AkTestField[2]->varchar_field, '2 string'); $this->assertEqual(count($AkTestField), 3); }