function testSetDontReInsertSameRecordsIfTheyExists()
 {
     $group1 = $this->_initGroup();
     $group2 = $this->_initGroup();
     $group3 = $this->_initGroup();
     $group4 = $this->_initGroup();
     $user = $this->_createUserAndSave(array($group1, $group2, $group3));
     $table = lmbDBAL::table('user_for_test2group_for_test', $this->conn);
     $records = $table->select()->getArray();
     $this->assertEqual(count($records), 3);
     $collection = new lmbARManyToManyCollection('groups', $user);
     $collection->set(array($group1, $group2, $group3, $group4));
     $new_records = $table->select()->getArray();
     $this->assertEqual(count($new_records), 4);
     $this->assertEqual($records[0]['id'], $new_records[0]['id']);
     $this->assertEqual($records[1]['id'], $new_records[1]['id']);
     $this->assertEqual($records[2]['id'], $new_records[2]['id']);
     $this->assertEqual($new_records[3]['user_id'], $user->getId());
 }
Beispiel #2
0
 function testTableMethodUsingDefaultConnection()
 {
     $table = lmbDBAL::table('test_db_table');
     $this->assertIsA($table, 'lmbTableGateway');
     $this->assertEqual($table->getTableName(), 'test_db_table');
 }