Example #1
0
 /**
  * @test
  */
 public function isRequestUrlProcessedCorrectlyWithDefinedBasePath()
 {
     $this->crawlerLibrary->setExtensionSettings(array('frontendBasePath' => '/cms/', 'phpPath' => 'PHPPATH'));
     $testUrl = 'http://localhost/' . uniqid();
     $testHeader = 'X-Test: ' . uniqid();
     $testHeaderArray = array($testHeader);
     $testCrawlerId = 13;
     $testContent = uniqid('Content');
     $frontendBasePath = '/cms/';
     $expectedCommand = escapeshellcmd('PHPPATH') . ' ' . escapeshellarg(\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath('crawler') . 'cli/bootstrap.php') . ' ' . escapeshellarg($frontendBasePath) . ' ' . escapeshellarg($testUrl) . ' ' . escapeshellarg(base64_encode(serialize($testHeaderArray)));
     $this->crawlerLibrary->expects($this->once())->method('buildRequestHeaderArray')->will($this->returnValue($testHeaderArray));
     $this->crawlerLibrary->expects($this->once())->method('executeShellCommand')->with($expectedCommand)->will($this->returnValue($testContent));
     $result = $this->crawlerLibrary->requestUrl($testUrl, $testCrawlerId);
     $this->assertEquals($testHeader . str_repeat("\r\n", 2), $result['request']);
     $this->assertEquals($testContent, $result['content']);
 }