public function testHistory() { $this->assertEquals(2, $this->history->count()); $requests = $this->history->getRequests(); $this->assertEquals('http://example.com/path/to/receipt', $requests[0]->getUrl()); $this->assertEquals('http://lom.dv/DB416EBE1887/state', $requests[1]->getUrl()); }
public function testHistory() { $this->assertEquals(2, $this->history->count()); $requests = $this->history->getRequests(); $this->assertEquals('http://lom.dv/web/app_dev.php/api/sword/2.0/sd-iri', $requests[0]->getUrl()); $this->assertEquals('http://lom.dv/AA84-E1C03A83A206', $requests[1]->getUrl()); }
/** @test */ public function it_requests_for_access_token_successfully() { $this->thereIsSuccessfullFacebookApiResponse(); $accessToken = $this->adapter->accessToken('correct-code'); $this->assertEquals('access-token', $accessToken); $this->assertThatRequestIsEqual($this->expectedSuccessfulAccessTokenRequest(), $this->history->getLastRequest()); }
public function testHarvest() { $this->commandTester->execute(array('command' => $this->getCommandName())); $deposits = $this->em->getRepository('AppBundle:Deposit')->findBy(array('state' => 'harvest-error')); $this->assertCount(1, $this->history); $this->assertEquals('HEAD', $this->history->getLastRequest()->getMethod()); $this->assertCount(1, $deposits); $this->assertContains('Deposit harvest failed.', $deposits[0]->getProcessingLog()); }
/** * @expectedException \EvdB\OpenExchangeRates\Exception\ResourceNotFound */ public function testJsonpCallbackPresence() { $exchange = $this->buildExchangeRateClient(null, $client = $this->buildClient()); $this->mockResponses($client, [new Response(200)]); $exchange->jsonp('latest', [], 'testMyCallback'); $this->assertEquals('testMyCallback', $this->history->getLastRequest()->getQuery()->get('callback')); //will throw expected exception $exchange->jsonp('invalid', [], 'myInvalidCallback'); }
protected function printLastRequestUrl() { $lastRequest = self::$history->getLastRequest(); if ($lastRequest) { $this->printDebug(sprintf('<comment>%s</comment>: <info>%s</info>', $lastRequest->getMethod(), $lastRequest->getUrl())); } else { $this->printDebug('No request was made.'); } }
public function testHarvest() { $this->commandTester->execute(array('command' => $this->getCommandName())); $this->assertCount(0, $this->em->getRepository('AppBundle:Deposit')->findBy(array('state' => 'harvest-error'))); $this->assertCount(2, $this->em->getRepository('AppBundle:Deposit')->findBy(array('state' => 'harvested'))); $this->assertCount(2, $this->history); $requests = $this->history->getRequests(); $this->assertEquals('HEAD', $requests[0]->getMethod()); $this->assertEquals('GET', $requests[1]->getMethod()); $content = file_get_contents('test/data/received/C0A65967-32BD-4EE8-96DE-C469743E563A/D38E7ECB-7D7E-408D-94B0-B00D434FDBD2.zip'); $this->assertEquals('absclksd', $content); }
public function testHarvest() { $this->commandTester->execute(array('command' => $this->getCommandName())); $deposits = $this->em->getRepository('AppBundle:Deposit')->findBy(array('state' => 'harvest-error')); $this->assertCount(2, $this->history); $requests = $this->history->getRequests(); $this->assertEquals('HEAD', $requests[0]->getMethod()); $this->assertEquals('GET', $requests[1]->getMethod()); $this->assertCount(1, $deposits); $this->assertContains('Expected file size', implode(' ', $deposits[0]->getErrorLog())); $this->assertFileExists('test/data/received/C0A65967-32BD-4EE8-96DE-C469743E563A/D38E7ECB-7D7E-408D-94B0-B00D434FDBD2.zip'); }
public function testDeleteHeadersByEmptyValue() { $this->module->setHeader('xxx', 'yyyy'); $this->module->setHeader('xxx', ''); $this->module->amOnPage('/'); $this->assertFalse($this->history->getLastRequest()->hasHeader('xxx')); }
public function testMaintainsLimitValue() { $request = new Request('GET', '/'); $response = new Response(200); $t = new Transaction(new Client(), $request); $t->setResponse($response); $ev = new CompleteEvent($t); $h = new History(2); $h->onComplete($ev); $h->onComplete($ev); $h->onComplete($ev); $this->assertEquals(2, count($h)); $this->assertSame($request, $h->getLastRequest()); $this->assertSame($response, $h->getLastResponse()); foreach ($h as $trans) { $this->assertInstanceOf('GuzzleHttp\\Message\\RequestInterface', $trans['request']); $this->assertInstanceOf('GuzzleHttp\\Message\\ResponseInterface', $trans['response']); } return $h; }
public function testCanGetAvailableModules() { // Create a mock subscriber and queue the response. $mock = new Mock([new Response(file_get_contents('./tests/mock/response-availablemodules.txt'))]); $this->client->getEmitter()->attach($mock); // Get available modules $this->wsclient->getAvailableModules(); // Get the last request $lastRequest = $this->history->getLastRequest(); $this->assertEquals('http://www.example.com/webservice.php?operation=listtypes&sessionName=18653fb863106084', $lastRequest->getUrl()); $this->assertEquals('GET', $lastRequest->getMethod()); $this->assertEmpty((string) $lastRequest->getBody()); // Detaching subscriber $this->client->getEmitter()->detach($mock); }
public function testRequestHeaders() { $request = $this->history->getLastRequest(); $this->assertEquals('GET', $request->getMethod()); $this->assertEquals('PkpPlnBot 1.0; http://pkp.sfu.ca', $request->getHeader('User-Agent')); }
public function testHeadersBySetHeader() { $this->module->setHeader('xxx', 'yyyy'); $this->module->amOnPage('/'); $this->assertTrue($this->history->getLastRequest()->hasHeader('xxx')); }
public function testHistory() { $this->assertEquals(1, $this->history->count()); $requests = $this->history->getRequests(); $this->assertEquals('http://example.com/path/to/receipt', $requests[0]->getUrl()); }
public function testDeleteListing() { $client = $this->createClient('delete_listing', $history = new History()); $response = $client->deleteListing(['listing_id' => '129242581']); $this->assertSame('DELETE', $history->getLastRequest()->getMethod()); $this->assertSame('https://api.discogs.com/marketplace/listings/129242581', $history->getLastRequest()->getUrl()); }
public function testGetImage() { $client = $this->createClient('get_inventory', $history = new History()); $response = $client->getImage(['filename' => 'R-5840514-1404162639-4473.jpeg']); $this->assertArrayHasKey('image', $response); $this->assertSame(37814, strlen($response['image'])); $this->assertInstanceOf('GuzzleHttp\\Stream\\Stream', $response['image']); $this->assertSame('GET', $history->getLastRequest()->getMethod()); $this->assertSame('http://api.discogs.com/images/R-5840514-1404162639-4473.jpeg', $history->getLastRequest()->getUrl()); }