Exemple #1
0
 /**
  * @dataProvider getInteractions
  */
 public function testReadInteractions($file, $expectation)
 {
     $messageHandler = $this->getMock('\\Kagency\\HttpReplay\\MessageHandler');
     $messageHandler->expects($this->any())->method('convertFromRequest')->will($this->returnValue('request'));
     $messageHandler->expects($this->any())->method('convertFromResponse')->will($this->returnValue('response'));
     $reader = new MitmDump($messageHandler);
     $interactions = $reader->readInteractions($file);
     $this->assertEquals($expectation, $interactions);
 }
 /**
  * getRequests
  *
  * @param mixed $fixtureFile
  * @return void
  */
 protected function getRequests($finalFixtureFile)
 {
     $aggregate = array();
     $reader = new Reader\MitmDump(new MessageHandler\Symfony2());
     foreach (glob($this->getBasePath() . '/*.tns') as $fixtureFile) {
         $aggregate = array_merge($aggregate, $reader->readInteractions($fixtureFile));
         if (pathinfo($fixtureFile, PATHINFO_FILENAME) === $finalFixtureFile) {
             return $aggregate;
         }
     }
     throw new \RuntimeException("Unknown fixture file {$finalFixtureFile}");
 }