예제 #1
0
파일: IOTest.php 프로젝트: Zunair/xataface
 function test_removeRelatedRecord()
 {
     $this->assertTrue(xf_db_num_rows(xf_db_query("SELECT * FROM `Appointments` where `id`=2")) == 1);
     $record =& Dataface_IO::loadRecordById('Profiles/appointments?id=10&appointments::id=2');
     $res = Dataface_IO::removeRelatedRecord($record);
     // This should fail to remove the record because it is a one-to-many relationship,
     // and you can only remove the record if you add the 'delete' flag to allow it
     // to delete the domain record.
     $this->assertTrue(!$res);
     $this->assertTrue(xf_db_num_rows(xf_db_query("SELECT * FROM `Appointments` where `id`=2")) == 1);
     $res = Dataface_IO::removeRelatedRecord($record, true);
     $this->assertTrue($res);
     $this->assertTrue(xf_db_num_rows(xf_db_query("SELECT * FROM `Appointments` where `id`=2")) == 0);
 }