Exemple #1
0
 /**
  * Set a mock response from a mock file on the next client request
  *
  * Overridden to use some magic to determine the location of the
  * mock files. If the test case is defined in:
  *
  *   TESTS_BASE_PATH/Foo/Bar/Baz/QuuxTest.php
  *
  * then a $responseName of "grault" will be found in:
  *
  *   MOCK_BASE_PATH/Foo/Bar/Baz/QuuxTest/grault.txt
  *
  * where TESTS_BASE_PATH and MOCK_BASE_PATH are set up correctly
  * by self::setTestsBasePath() and self::setMockBasePath().
  *
  * @param Guzzle\Service\Client $client        Client object to modify
  * @param string|array          $responseNames Path to files within the Mock
  *                                             folder of the service
  *
  * @return Guzzle\Plugin\Mock\MockPlugin The created mock plugin
  */
 public function setMockResponse(Client $client, $responseNames)
 {
     $paths = array();
     foreach ((array) $responseNames as $responseName) {
         $paths[] = $this->getMockResponseDirectory() . "/{$responseName}.txt";
     }
     return parent::setMockResponse($client, $paths);
 }