示例#1
0
 public function testDeleteCompositeSingle()
 {
     // Find WHERE IN u_id = 1 and r_id = 2 (sequece was follow its composite keys order)
     $role_user = Model\Role\User::find(array(1, 2));
     // Consist
     $this->assertInstanceOf('Gas\\ORM', $role_user);
     $this->assertInstanceOf('Gas\\Data', $role_user->record);
     // No way we allow composite table, which define entities, delete itself
     $this->assertFalse($role_user->delete());
 }
示例#2
0
 public function testFindCompositeSeveral()
 {
     // Find sequenced of records (which its paired ids follow its composite keys order)
     $role_users = Model\Role\User::find(array(1, 2), array(3, 2));
     // Should be an array, contain 2 role_user object
     $this->assertCount(2, $role_users);
     foreach ($role_users as $role_user) {
         // Consist
         $this->assertInstanceOf('Gas\\ORM', $role_user);
         $this->assertInstanceOf('Gas\\Data', $role_user->record);
         // Check results
         switch ($role_user->u_id) {
             case '1':
                 $this->assertEquals($role_user->r_id, '2');
                 break;
             case '3':
                 $this->assertEquals($role_user->r_id, '2');
                 break;
         }
     }
 }