예제 #1
0
 /**
  * @covers Guzzle\Http\Plugin\MockPlugin::onRequestCreate
  * @covers Guzzle\Http\Plugin\MockPlugin::dequeue
  * @depends testAddsMockResponseToRequestFromClient
  */
 public function testDetachesTemporaryWhenEmpty()
 {
     $p = new MockPlugin(null, true);
     $p->addResponse(MockPlugin::getMockFile(__DIR__ . '/../../TestData/mock_response'));
     $client = new Client('http://localhost:123/');
     $client->getEventDispatcher()->addSubscriber($p, 9999);
     $request = $client->get();
     $request->send();
     $this->assertFalse($this->hasSubscriber($client, $p));
 }
예제 #2
0
 /**
  * Get a mock response for a client by mock file name
  *
  * @param string $path Relative path to the mock response file
  *
  * @return Response
  */
 public function getMockResponse($path)
 {
     return $path instanceof Response ? $path : MockPlugin::getMockFile(self::$mockBasePath . DIRECTORY_SEPARATOR . $path);
 }