/** * @test */ public function toArrayReturnsArrayOfLink() { $link = new \Bookmarks\Link(); $link->title = 'this is a titel'; $link->url = 'http://abc.de'; $link->tags = array('foo'); $expected = array('title' => 'this is a titel', 'url' => 'http://abc.de', 'tags' => array('foo')); $this->assertEquals($expected, $link->toArray()); }
/** * @test */ public function fromArrayCreatesGroupWithLinks() { $l1 = new \Bookmarks\Link(); $l1->title = 'test'; $l1->url = 'http://abc.de'; $data = array('title' => 'my group', 'links' => array($l1->toArray())); $this->group->fromArray($data); $this->assertEquals('my group', $this->group->title); $this->assertTrue($this->group->issetLink($l1->getId())); }