示例#1
0
 public function testBelongsTo()
 {
     $expected = [['id' => 10, 'name' => 'Some test user'], ['id' => 11, 'name' => 'Matches'], ['id' => 12, 'name' => 'Rematch'], ['id' => 12, 'name' => 'Rematch']];
     $users = \ntentan\nibii\tests\models\raw\Users::fetch();
     $i = 0;
     foreach ($users as $user) {
         $this->assertEquals($expected[$i++], $user->{'\\ntentan\\nibii\\tests\\models\\raw\\Roles'}->toArray());
     }
 }
示例#2
0
 public function testDelete()
 {
     Users::filter('id < ?', 3)->delete();
     $queryTable = $this->getConnection()->createQueryTable('users', 'SELECT id, username, role_id, firstname FROM users');
     $this->assertTablesEqual($this->createArrayDataSet(['users' => [['id' => 3, 'username' => 'kwame', 'role_id' => 12, 'firstname' => 'Kwame'], ['id' => 4, 'username' => 'adjoa', 'role_id' => 12, 'firstname' => 'Adjoa']]])->getTable('users'), $queryTable);
 }