public function testPhotoset() { $result = unserialize(Helpers::mockResult('photoset')); $photoset = new Photoset($result['photoset']); $this->assertNotNull($photoset->id, 'Must have an id'); $this->assertNotNull($photoset->title, 'Must have a title'); $this->assertNotNull($photoset->photos, 'Must have photos'); $this->assertNotNull('\\Vinelab\\Flickr\\Photo', $photoset->photos[0]); $photosetArray = $photoset->toArray(); $this->assertArrayHasKey('title', $photosetArray); $this->assertArrayHasKey('id', $photosetArray['photos'][0]); }
public function testFetchPhotoset() { $this->httpResponseMock->shouldReceive('content')->once()->andReturn(Helpers::mockResult('photoset')); $this->httpClientMock->shouldReceive('get')->once()->andReturn($this->httpResponseMock); $flickr = new Agent($this->configMock, $this->httpClientMock); // IMPORTANT: in case of changing this url, the @param nsid is necessary for the Agent // to differentiate b/w a feed and a photoset $url = 'http://some.valid.url/with/some/path?nsid=123'; $feed = $flickr->fetch($url); $this->assertNotNull($feed); $this->assertInstanceOf('\\Vinelab\\Flickr\\Photoset', $feed, 'Should return a photoset instance'); }
public function testFeed() { $result = unserialize(Helpers::mockResult('feed')); $feed = new Feed($result); $this->assertNotNull($feed->title, 'Must have a title'); $this->assertNotNull($feed->url, 'Must have a url'); $this->assertNotNull($feed->description, 'Must have a description'); $this->assertNotNull($feed->image, 'Must have an image'); $this->assertNotNull($feed->id, 'Must have an id'); $this->assertNotNull($feed->photos, 'Must have an id'); $this->assertInstanceOf('\\Vinelab\\Flickr\\Photo', $feed->photos[0]); $feedArray = $feed->toArray(); $this->assertArrayHasKey('title', $feed->toArray()); $this->assertEquals($feed->title, $feedArray['title']); $this->assertArrayHasKey('id', $feedArray['photos'][0]); $this->assertCount(count($feed->photos), $feedArray['photos']); }
protected function runInstantiationTestOn($photoType) { $photo = new Photo(unserialize(Helpers::mockResult($photoType))); $this->assertInstanceOf('\\Vinelab\\Flickr\\Photo', $photo); $this->assertNotNull($photo->id, 'Must have an id'); $this->assertNotNull($photo->title, 'Must have a title'); $this->assertNotNull($photo->url, 'Must have a url'); $this->assertNotNull($photo->width, 'Must have a width'); $this->assertNotNull($photo->height, 'Must have a height'); $photoArray = $photo->toArray(); $this->assertArrayHasKey('id', $photoArray); $this->assertEquals($photo->id, $photoArray['id']); $this->assertArrayHasKey('title', $photoArray); $this->assertEquals($photo->title, $photoArray['title']); $this->assertArrayHasKey('url', $photoArray); $this->assertEquals($photo->url, $photoArray['url']); $this->assertArrayHasKey('width', $photoArray); $this->assertEquals($photo->width, $photoArray['width']); $this->assertArrayHasKey('height', $photoArray); $this->assertEquals($photo->height, $photoArray['height']); }