/** * @param string $fileExtension * @param string $iconBaseDirectory * @param string $iconExtension * @return null||string */ public function render($fileExtension, $iconBaseDirectory = '', $iconExtension = 'gif') { if ($iconBaseDirectory === '') { $iconBaseDirectory = $this->fileUtility->concatenatePaths(array(TYPO3_mainDir, 'gfx/fileicons/')); } $iconPath = $this->fileUtility->concatenatePaths(array($iconBaseDirectory, $fileExtension . '.' . $iconExtension)); if ($this->validateFileIsImage($iconPath)) { $this->tag->addAttribute('src', $iconPath); return $this->tag->render(); } else { return null; } }
/** * @test */ public function downloadExistingPage() { $this->wgetCommand->setOutputFile(Files::concatenatePaths(array($this->workingDirectory, 'wget.log')))->setDirectoryPrefix($this->workingDirectory)->setNoVerbose(true)->setServerResponse(true)->setUrl('http://localhost/')->execute(); $log = $this->wgetLogParser->parseLog($this->wgetCommand); $this->assertFalse($log->hasErrors()); $this->assertFileExists(Files::concatenatePaths(array($this->workingDirectory, 'index.html'))); }
/** * @test */ public function commitOfUnmodifiedRepositoryDoesNotReturnAnError() { $this->skipTestIfGitCommandForTestingDoesNotExist(); $this->proxy->init()->execute(); file_put_contents(Files::concatenatePaths(array($this->repositoryRootPath, "film01.txt")), "Dr. Strangelove Or How I Stopped Worrying And Love The Bomb"); file_put_contents(Files::concatenatePaths(array($this->repositoryRootPath, "film02.txt")), "2001 - A Space Odyssey"); $this->proxy->add()->setPath(".")->execute(); $this->proxy->commit()->setMessage("[TASK] Initial commit")->execute(); $this->proxy->add()->setPath(".")->execute(); $result = $this->proxy->commit()->setAllowEmpty(true)->setMessage("[TASK] Empty commit")->execute(); $this->assertSame(0, $result->getExitCode()); }
protected function taskExecuteSuccessful() { $executeTestFilePath = \PunktDe\PtExtbase\Utility\Files::concatenatePaths(array($this->testFilePath, "testTaskExecution.txt")); $executeTestFileContent = $this->getFileContent($executeTestFilePath); $this->assertEquals('1428924570', $executeTestFileContent, 'The content of the "executeTestFile" file is not as expected'); }
/** * @return void */ public function createRepositoryRootPath() { Files::createDirectoryRecursively($this->repositoryRootPath); }
/** * @return string */ protected function renderCommand() { $this->commandLine = sprintf('cd %s; %s --git-dir=%s %s', $this->repository->getRepositoryRootPath(), $this->repository->getCommandPath(), Files::concatenatePaths(array($this->repository->getRepositoryRootPath(), '.git')), $this->command->render()); }
/** * @return void */ public function initializeObject() { $this->testPath = Files::concatenatePaths(array(__DIR__, '/WorkingDirectory')); $testInitializeObjectFilePath = Files::concatenatePaths(array($this->testPath, 'testTaskObjectInitialization.txt')); file_put_contents($testInitializeObjectFilePath, '1428924552'); }
/** * @test * @throws \Tx_PtExtbase_Exception_Internal */ public function parseLogWithErrors() { $logOutPutFile = Files::concatenatePaths(array(__DIR__, 'TestData/WgetTest.log')); $wgetCommand = new \PunktDe\PtExtbase\Utility\Wget\WgetCommand(); $wgetCommand->setNoVerbose(true)->setOutputFile($logOutPutFile); $logFileEntries = $this->wgetLogParser->parseLog($wgetCommand); $this->assertCount(4, $logFileEntries); // Case 200 $logFileEntry1 = array('date' => date_create_from_format('Y-m-d H:i:s', '2015-02-26 11:50:40'), 'url' => 'https://test.de/data-ok.html', 'status' => 200, 'length' => 3951); $this->assertEquals($logFileEntry1, $logFileEntries->getItemByIndex(0)->toArray()); // Case 404 $logFileEntry2 = array('date' => date_create_from_format('Y-m-d H:i:s', '2015-02-26 11:50:57'), 'url' => 'https://test.de/typo3conf/jquery.selectBox-arrow.gif', 'status' => 404, 'length' => 275); $this->assertEquals($logFileEntry2, $logFileEntries->getItemByIndex(1)->toArray()); // Case 200 after 404 $logFileEntry3 = array('date' => date_create_from_format('Y-m-d H:i:s', '2015-02-26 11:50:40'), 'url' => 'https://test.de/data-ok2.html', 'status' => 200, 'length' => 1000); $this->assertEquals($logFileEntry3, $logFileEntries->getItemByIndex(2)->toArray()); // Case 404 on last line $logFileEntry4 = array('date' => date_create_from_format('Y-m-d H:i:s', '2015-02-27 12:07:49'), 'url' => 'http://partnerportal.dpppa.dev.punkt.de/typo3conf/ext/pt_dppp_base/Resources/Public/Styles/jquery.selectBox-arrow.gif', 'status' => 404, 'length' => 275); $this->assertEquals($logFileEntry4, $logFileEntries->getItemByIndex(3)->toArray()); }