/** * @test */ public function fromArrayCreatesLinkWithAllAttributes() { $link = new \Bookmarks\Link(); $link->fromArray(array('title' => 'this is a titel', 'url' => 'http://abc.de', 'tags' => array('foo'))); $this->assertEquals('this is a titel', $link->title); $this->assertEquals('http://abc.de', $link->url); $this->assertEquals(array('foo'), $link->tags); }
/** * @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())); }