/** * Ensures that userSearch() throws an exception when an invalid e-mail address is given * * @return void */ public function testUserSearchExceptionEmailInvalid() { $this->flickr->getRestClient()->getHttpClient()->setAdapter($this->httpClientAdapterTest); $this->httpClientAdapterTest->setResponse($this->loadResponse(__FUNCTION__)); $this->setExpectedException('Zend\\Service\\Flickr\\Exception\\RuntimeException', 'User not found'); $this->flickr->userSearch('*****@*****.**'); }
/** * Basic testing to ensure that userSearch() works as expected * * @return void */ public function testUserSearchBasic() { $options = array('per_page' => 10, 'page' => 1, 'extras' => 'license, date_upload, date_taken, owner_name, icon_server'); $resultSet = $this->flickr->userSearch('*****@*****.**', $options); $this->assertEquals(16, $resultSet->totalResultsAvailable); $this->assertEquals(10, $resultSet->totalResults()); $this->assertEquals(10, $resultSet->totalResultsReturned); $this->assertEquals(1, $resultSet->firstResultPosition); $this->assertEquals(0, $resultSet->key()); try { $resultSet->seek(-1); $this->fail('Expected OutOfBoundsException not thrown'); } catch (OutOfBoundsException $e) { $this->assertContains('Illegal index', $e->getMessage()); } $resultSet->seek(9); try { $resultSet->seek(10); $this->fail('Expected OutOfBoundsException not thrown'); } catch (OutOfBoundsException $e) { $this->assertContains('Illegal index', $e->getMessage()); } $resultSet->rewind(); $count = 0; foreach ($resultSet as $result) { $this->assertInstanceOf('Zend\\Service\\Flickr\\Result', $result); $count++; } $this->assertEquals(10, $count); }