From 4641d4cf77aac54b1c5688a10e78642b8cda2e87 Mon Sep 17 00:00:00 2001 From: Frederic Guillot Date: Sat, 9 May 2015 23:00:23 -0400 Subject: Improve Link::getOppositeLinkId() --- tests/units/LinkTest.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'tests') diff --git a/tests/units/LinkTest.php b/tests/units/LinkTest.php index ebcbcd39..076e1b3b 100644 --- a/tests/units/LinkTest.php +++ b/tests/units/LinkTest.php @@ -36,6 +36,18 @@ class LinkTest extends Base $this->assertNotEquals($link1['opposite_id'], $link2['opposite_id']); } + public function testGetOppositeLinkId() + { + $l = new Link($this->container); + + $this->assertTrue($l->create('Link A')); + $this->assertTrue($l->create('Link B', 'Link C')); + + $this->assertEquals(1, $l->getOppositeLinkId(1)); + $this->assertEquals(3, $l->getOppositeLinkId(2)); + $this->assertEquals(2, $l->getOppositeLinkId(3)); + } + public function testUpdate() { $l = new Link($this->container); -- cgit v1.2.3