예제 #1
0
 function testAutoCleanupWithExtension()
 {
     $t = new Tempalicious();
     $t->setExtension('ext');
     $tempFileWithExtension = $t->getTempfilePath();
     $semFile = dirname($tempFileWithExtension) . '/' . basename($tempFileWithExtension);
     $this->assertFileExists($semFile, "/tmp/Tempfile semaphore file doesn't exist");
     $this->assertFileExists($tempFileWithExtension, "/tmp/Tempfile.ext doesn't exist");
     $t->cleanup();
     $this->assertFileNotExists($semFile, "/tmp/Tempfile semaphore wasn't cleaned up.");
     $this->assertFileNotExists($tempFileWithExtension, "/tmp/Tempfile.ext wasn't cleaned up.");
 }
예제 #2
0
 /**
  * Static initializer to create a Tempalicious file.
  *
  * @param string The desired extension, example: "png", default NULL
  * @return string The path to a temp file location.
  */
 public static function create($extension = NULL)
 {
     return Tempalicious::__invokeStatic()->setExtension($extension)->getTempfilePath();
 }