本文整理汇总了PHP中PhpBrew\Config::getTempFileDir方法的典型用法代码示例。如果您正苦于以下问题:PHP Config::getTempFileDir方法的具体用法?PHP Config::getTempFileDir怎么用?PHP Config::getTempFileDir使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PhpBrew\Config
的用法示例。
在下文中一共展示了Config::getTempFileDir方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testDownloadByCurlCommand
public function testDownloadByCurlCommand()
{
$downloader = new UrlDownloaderForTest($this->logger, new OptionResult());
$downloader->setIsCurlCommandAvailable(true);
$actualFilePath = tempnam(Config::getTempFileDir(), '');
$downloader->download('http://httpbin.org/', $actualFilePath);
$this->assertTrue($downloader->isCurlCommandAvailable());
$this->assertFileExists($actualFilePath);
}
示例2: _test
private function _test($downloader)
{
$instance = DownloadFactory::getInstance($this->logger, new OptionResult(), $downloader);
if ($instance->hasSupport(false)) {
$actualFilePath = tempnam(Config::getTempFileDir(), '');
$instance->download('http://httpbin.org/', $actualFilePath);
$this->assertFileExists($actualFilePath);
} else {
$this->markTestSkipped();
}
}
示例3: extract
/**
* Unpacks the source tarball file.
*
* @param string $targetFilePath absolute file path
*/
public function extract(Build $build, $targetFilePath, $extractDir = NULL)
{
$extractDirTemp = Config::getTempFileDir();
if (!$extractDir) {
$extractDir = dirname($targetFilePath);
}
$extractedDirTemp = $extractDirTemp . DIRECTORY_SEPARATOR . preg_replace('#\\.tar\\.(gz|bz2)$#', '', basename($targetFilePath));
$extractedDir = $extractDir . DIRECTORY_SEPARATOR . $build->getName();
if ($build->getState() >= Build::STATE_EXTRACT && file_exists($extractedDir . DIRECTORY_SEPARATOR . 'configure')) {
$this->info("===> Distribution file was successfully extracted, skipping...");
return $extractedDir;
}
// NOTICE: Always extract to prevent incomplete extraction
$this->info("===> Extracting {$targetFilePath} to {$extractedDirTemp}");
system("tar -C {$extractDirTemp} -xf {$targetFilePath}", $ret);
if ($ret != 0) {
throw new RuntimeException('Extract failed.');
}
clearstatcache(true);
if (!is_dir($extractedDirTemp)) {
// retry with github extracted dir path
$extractedDirTemp = $extractDirTemp . DIRECTORY_SEPARATOR . 'php-src-' . preg_replace('#\\.tar\\.(gz|bz2)$#', '', basename($targetFilePath));
if (!is_dir($extractedDirTemp)) {
throw new RuntimeException("Unable to find {$extractedDirTemp}");
}
}
if (is_dir($extractedDir)) {
$this->info("===> Removing {$extractedDir}");
system("rm -rf {$extractedDir}", $ret);
if ($ret !== 0) {
throw new RuntimeException("Unable to remove {$extractedDir}.");
}
}
$this->info("===> Moving {$extractedDirTemp} to {$extractedDir}");
if (!rename($extractedDirTemp, $extractedDir)) {
throw new RuntimeException("Unable to move {$extractedDirTemp} to {$extractedDir}");
}
$build->setState(Build::STATE_EXTRACT);
return $extractedDir;
/*
* XXX: unless we have a fast way to verify the extraction.
if ($this->options->force || ! file_exists($extractedDir . DIRECTORY_SEPARATOR . 'configure')) {
$this->info("===> Extracting $targetFilePath...");
system("tar -C $dir -xjf $targetFilePath", $ret);
if ($ret != 0) {
die('Extract failed.');
}
} else {
$this->info("Found existing $extractedDir, Skip extracting.");
}
*/
}
示例4: __construct
/**
* $caller must be a subclass of PHPUnit_Framework_TestCase.
* @param Object $caller the object which creates this object.
* @param string $sourcePath the path of a source file.
*/
public function __construct($caller, $sourcePath)
{
$this->caller = $caller;
$this->sourcePath = $sourcePath;
$this->temporaryDirectory = Config::getTempFileDir();
}
示例5: __construct
public function __construct()
{
parent::__construct('5.3.29');
$this->setSourceDirectory(Config::getTempFileDir() . '/' . uniqid());
}