Exemplo n.º 1
0
 public function testUniqueValidation()
 {
     $role = Roles::createNew();
     $role->name = 'Matches';
     $response = $role->save();
     $this->assertEquals(false, $response);
     $this->assertEquals(array('name' => array(0 => 'The value of name must be unique')), $role->getInvalidFields());
 }
Exemplo n.º 2
0
 public function testHasMany()
 {
     $role = \ntentan\nibii\tests\models\raw\Roles::fetch(12);
     $results = array(0 => array('id' => 3, 'username' => 'kwame', 'password' => 'coolthings', 'role_id' => 12, 'firstname' => 'Kwame', 'lastname' => 'Nyarko', 'othernames' => NULL, 'status' => 2, 'email' => '*****@*****.**', 'phone' => NULL, 'office' => NULL, 'last_login_time' => NULL, 'is_admin' => NULL), 1 => array('id' => 4, 'username' => 'adjoa', 'password' => 'hahaha', 'role_id' => 12, 'firstname' => 'Adjoa', 'lastname' => 'Boateng', 'othernames' => NULL, 'status' => 2, 'email' => '*****@*****.**', 'phone' => NULL, 'office' => NULL, 'last_login_time' => NULL, 'is_admin' => NULL));
     $this->assertEquals($results, $role->{'\\ntentan\\nibii\\tests\\models\\raw\\Users'}->toArray());
 }