示例#1
0
 public function testValidateModification()
 {
     $l = new Link($this->container);
     $r = $l->validateModification(array('id' => 20, 'label' => 'a', 'opposite_id' => 0));
     $this->assertTrue($r[0]);
     $r = $l->validateModification(array('id' => 20, 'label' => 'a', 'opposite_id' => '1'));
     $this->assertTrue($r[0]);
     $r = $l->validateModification(array('id' => 20, 'label' => 'relates to', 'opposite_id' => '1'));
     $this->assertFalse($r[0]);
     $r = $l->validateModification(array('id' => 20, 'label' => '', 'opposite_id' => '1'));
     $this->assertFalse($r[0]);
     $r = $l->validateModification(array('label' => '', 'opposite_id' => '1'));
     $this->assertFalse($r[0]);
     $r = $l->validateModification(array('id' => 20, 'opposite_id' => '1'));
     $this->assertFalse($r[0]);
     $r = $l->validateModification(array('label' => 'test'));
     $this->assertFalse($r[0]);
 }