public function testToArrayWithNulls() { $obj = new CollectionJson\Property\Query('http://example.com', 'homepage'); $result = $obj->toArray(); foreach (array('name', 'data', 'prompt') as $key) { $this->assertFalse(array_key_exists($key, $result)); } }
public function testFixtureCollection() { $query = new Property\Query('http://example.org/friends/search', 'search', null, 'Search'); $query->addData(new Property\Data('search')); $tplDatas = array(new Property\Data('full-name', '', 'Full Name'), new Property\Data('email', '', 'Email'), new Property\Data('blog', '', 'Blog'), new Property\Data('avatar', '', 'Avatar')); $items = array(new Collection\Item('http://example.org/friends/jdoe'), new Collection\Item('http://example.org/friends/msmith'), new Collection\Item('http://example.org/friends/rwilliams')); $items[0]->addDataSet(array(new Property\Data('full-name', 'J. Doe', 'Full Name'), new Property\Data('email', '*****@*****.**', 'Email'))); $items[0]->addLinkSet(array(new Property\Link('http://examples.org/blogs/jdoe', 'blog', null, null, 'Blog'), new Property\Link('http://examples.org/images/jdoe', 'avatar', null, 'image', 'Avatar'))); $items[1]->addDataSet(array(new Property\Data('full-name', 'M. Smith', 'Full Name'), new Property\Data('email', '*****@*****.**', 'Email'))); $items[1]->addLinkSet(array(new Property\Link('http://examples.org/blogs/msmith', 'blog', null, null, 'Blog'), new Property\Link('http://examples.org/images/msmith', 'avatar', null, 'image', 'Avatar'))); $items[2]->addDataSet(array(new Property\Data('full-name', 'R. Williams', 'Full Name'), new Property\Data('email', '*****@*****.**', 'Email'))); $items[2]->addLinkSet(array(new Property\Link('http://examples.org/blogs/rwilliams', 'blog', null, null, 'Blog'), new Property\Link('http://examples.org/images/rwilliams', 'avatar', null, 'image', 'Avatar'))); $collection = new Collection('http://example.org/friends/'); $collection->addQuery($query)->setTemplate(new Collection\Template($tplDatas))->addItemSet($items)->addLink(new Property\Link('http://example.org/friends/rss', 'feed')); $this->compareWithFixture($collection, 'collection'); }