示例#1
0
 /**
  * @When /^I transcode the page$/
  */
 public function iTranscodeThePage()
 {
     $transcoder = new \Optimus\Transcoder($this->dispatcher);
     switch ($this->adapterType) {
         case 'html':
             $this->adapter = new \Optimus\Adapter\HTMLAdapter($this->adapterHtml);
             break;
         case 'phantom':
             $url = sprintf('localhost:%d/%s', self::$webServerPort, $this->adapterUrl);
             $this->adapter = new \Optimus\Adapter\PhantomAdapter('localhost', self::$phantomServerPort, $url);
             break;
         case 'guzzle':
             $client = new \Guzzle\Http\Client('', array('curl.options' => array(CURLOPT_PORT => self::$webServerPort)));
             $client->setEventDispatcher($this->dispatcher);
             $this->adapter = new \Optimus\Adapter\GuzzleAdapter($client, sprintf('http://localhost/%s', $this->adapterUrl));
             break;
     }
     $this->result = $transcoder->setAdapter($this->adapter)->transcode();
 }