当前位置: 首页>>代码示例>>PHP>>正文


PHP System::tempDir方法代码示例

本文整理汇总了PHP中System::tempDir方法的典型用法代码示例。如果您正苦于以下问题:PHP System::tempDir方法的具体用法?PHP System::tempDir怎么用?PHP System::tempDir使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System的用法示例。


在下文中一共展示了System::tempDir方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: setUp

 /**
  * Sets up test case - initializes directory in %TEMP
  *
  */
 public function setUp()
 {
     $this->temp = $this->normalize(realpath(System::tempDir())) . md5(uniqid()) . '.xp' . DIRECTORY_SEPARATOR;
     if (is_dir($this->temp) && !rmdir($this->temp)) {
         throw new PrerequisitesNotMetError('Fixture directory exists, but cannot remove', NULL, $this->temp);
     }
 }
开发者ID:Gamepay,项目名称:xp-framework,代码行数:11,代码来源:FolderTest.class.php

示例2: setUp

 public function setUp()
 {
     $tempDir = realpath(System::tempDir());
     $this->fixture = new FilesystemPropertySource($tempDir);
     // Create a temporary ini file
     $this->tempFile = new File($tempDir, 'temp.ini');
     FileUtil::setContents($this->tempFile, "[section]\nkey=value\n");
 }
开发者ID:xp-framework,项目名称:core,代码行数:8,代码来源:FilesystemPropertySourceTest.class.php

示例3: verifyTempDir

 public static function verifyTempDir()
 {
     self::$temp = System::tempDir();
     if (!is_writeable(self::$temp)) {
         throw new PrerequisitesNotMetError('$TEMP is not writeable', null, [self::$temp . ' +w']);
     }
     if (($df = disk_free_space(self::$temp)) < 10240) {
         throw new PrerequisitesNotMetError('Not enough space available in $TEMP', null, [sprintf('df %s = %.0fk > 10k', self::$temp, $df / 1024)]);
     }
 }
开发者ID:xp-framework,项目名称:core,代码行数:10,代码来源:FileIntegrationTest.class.php

示例4: runningDirectory

 public function runningDirectory()
 {
     new Process(System::tempDir());
 }
开发者ID:xp-framework,项目名称:core,代码行数:4,代码来源:ProcessTest.class.php

示例5: main

 /**
  * Main runner method
  *
  * @param   string[] args
  */
 public static function main(array $args)
 {
     if (!$args) {
         self::usage();
     }
     // Parse arguments
     $output = '-';
     for ($i = 0, $s = sizeof($args); $i < $s; $i++) {
         if ('-O' == $args[$i]) {
             $output = $args[++$i];
         } else {
             if ('-?' == $args[$i] || '--help' == $args[$i]) {
                 self::usage();
             } else {
                 $package = $args[$i];
                 break;
             }
         }
     }
     // Load generator class
     try {
         $class = Package::forName('xp.codegen')->getPackage($package)->loadClass('Generator');
     } catch (ElementNotFoundException $e) {
         Console::$err->writeLine('*** No generator named "' . $package . '"');
         exit(2);
     }
     $params = new ParamString(array_slice($args, $i + 1));
     if ($params->exists('help', '?')) {
         Console::$err->writeLine(self::textOf($class->getComment()));
         exit(1);
     }
     // Instantiate generator
     $generator = $class->newInstance($params);
     $generator->storage = new FileSystemStorage(System::tempDir());
     // Output
     if ('-' === $output) {
         $generator->output = new ConsoleOutput(Console::$err);
     } else {
         if (strstr($output, '.xar')) {
             $generator->output = new ArchiveOutput($output);
         } else {
             $generator->output = new FileSystemOutput($output);
         }
     }
     $generator->output->addObserver(newinstance('util.Observer', array(), '{
     public function update($obs, $arg= NULL) { Console::writeLine("     >> ", $arg); }
   }'));
     Console::writeLine('===> Starting ', $generator);
     // Compile target chain
     $empty = new ArrayList();
     $targets = create('new util.collections.HashTable<lang.reflect.Method, util.collections.HashTable<string, lang.Generic>>()');
     foreach ($class->getMethods() as $method) {
         if (!$method->hasAnnotation('target')) {
             continue;
         }
         $target = create('new util.collections.HashTable<string, lang.Generic>()');
         // Fetch dependencies
         if ($method->hasAnnotation('target', 'depends')) {
             $depends = create('new util.collections.Vector<lang.reflect.Method>()');
             foreach ((array) $method->getAnnotation('target', 'depends') as $dependency) {
                 $depends[] = $class->getMethod($dependency);
             }
             $target['depends'] = $depends;
         }
         // Fetch input
         if ($method->hasAnnotation('target', 'input')) {
             $arguments = create('new util.collections.Vector<lang.reflect.Method>()');
             foreach ((array) $method->getAnnotation('target', 'input') as $input) {
                 $arguments[] = $class->getMethod($input);
             }
             $target['arguments'] = $arguments;
         }
         $targets->put($method, $target);
     }
     // Invoke
     try {
         foreach ($targets->keys() as $method) {
             self::invoke($generator, $method, $targets);
         }
     } catch (TargetInvocationException $e) {
         Console::$err->writeLine('*** ', $e->getCause());
         exit(3);
     }
     $generator->output->commit();
     Console::writeLine('===> Done');
 }
开发者ID:Gamepay,项目名称:xp-framework,代码行数:91,代码来源:Runner.class.php

示例6: links_resolved_in_realpath

 public function links_resolved_in_realpath()
 {
     $temp = System::tempDir();
     $link = new Path($temp, 'link-to-temp');
     if (false === symlink($temp, $link)) {
         $this->skip('Cannot create ' . $link . ' -> ' . $temp);
     }
     $resolved = (new Path($link))->asRealpath()->toString();
     unlink($link);
     $this->assertEquals($temp, $resolved);
 }
开发者ID:xp-framework,项目名称:core,代码行数:11,代码来源:PathTest.class.php

示例7: setUp

 /**
  * Sets up test case - initializes temp directory in %TEMP%
  *
  * @return void
  */
 public function setUp()
 {
     $this->folder = new Folder(System::tempDir(), md5(uniqid()) . '.xp');
     $this->folder->exists() && $this->folder->unlink();
     $this->folder->create();
 }
开发者ID:xp-framework,项目名称:core,代码行数:11,代码来源:FolderEntriesTest.class.php

示例8: __construct

 /**
  * Constructor
  *
  * @param   string prefix default "tmp"
  */
 public function __construct($prefix = 'tmp')
 {
     parent::__construct(tempnam(System::tempDir(), $prefix . uniqid((double) microtime())));
 }
开发者ID:melogamepay,项目名称:xp-framework,代码行数:9,代码来源:TempFile.class.php

示例9: prepareTempDir

 public static function prepareTempDir()
 {
     self::$temp = new Folder(System::tempDir(), md5(uniqid()));
     self::$temp->create();
     session_save_path(self::$temp->getURI());
 }
开发者ID:Gamepay,项目名称:xp-framework,代码行数:6,代码来源:ScriptletTestCase.class.php

示例10: callingMain

 public function callingMain()
 {
     $temp = System::tempDir();
     // Create web.ini in system's temp dir
     $ini = new File($temp, 'web.ini');
     $ini->open(FILE_MODE_WRITE);
     $ini->write("[app]\n" . "mappings=\"/:welcome\"\n" . "[app::welcome]\n" . "class=undefined\n" . "[app::welcome@dev]\n" . "class=\"" . self::$welcomeScriptlet->getName() . "\"\n");
     $ini->close();
     // Run
     ob_start();
     xp新criptlet愛unner::main(array($temp, $temp, 'dev', '/'));
     $content = ob_get_contents();
     ob_end_clean();
     $ini->unlink();
     // Assert
     $this->assertEquals('<h1>Welcome, we are open</h1>', $content);
 }
开发者ID:Gamepay,项目名称:xp-framework,代码行数:17,代码来源:RunnerTest.class.php


注:本文中的System::tempDir方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。