public function testGetList()
 {
     $l = new Link($this->container);
     $links = $l->getList();
     $this->assertNotEmpty($links);
     $this->assertCount(12, $links);
     $this->assertEquals('', $links[0]);
     $this->assertEquals('relates to', $links[1]);
     $links = $l->getList(1);
     $this->assertNotEmpty($links);
     $this->assertCount(11, $links);
     $this->assertEquals('', $links[0]);
     $this->assertArrayNotHasKey(1, $links);
     $this->assertEquals('blocks', $links[2]);
     $links = $l->getList(1, false);
     $this->assertNotEmpty($links);
     $this->assertCount(10, $links);
     $this->assertArrayNotHasKey(0, $links);
     $this->assertArrayNotHasKey(1, $links);
     $this->assertEquals('blocks', $links[2]);
     $links = $l->getList(0, false);
     $this->assertNotEmpty($links);
     $this->assertCount(11, $links);
     $this->assertArrayNotHasKey(0, $links);
     $this->assertEquals('relates to', $links[1]);
 }
Beispiel #2
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]);
 }