示例#1
0
 /**
  * @test
  */
 public function testExecuteFileInBackground()
 {
     $file = new Filesystem();
     $content = '<?php sleep(10);';
     $dir = static::getTempPath(__FUNCTION__);
     mkdir($dir);
     $filename = rand(1, 10) . rand(0, getrandmax());
     $path = $dir . DIRECTORY_SEPARATOR . $filename;
     file_put_contents($path, $content);
     $file->executeFileInBackground('php ' . $path);
     $proc = false;
     foreach ($file->getProcessSnapshot() as $pcs) {
         if (stristr($pcs, __FUNCTION__)) {
             $proc = true;
         }
     }
     $this->assertEquals(true, $proc);
 }