예제 #1
0
 public function testSetCache()
 {
     //Default target
     $terminus = new Terminus();
     $root = Terminus::getCache()->getRoot();
     $this->assertTrue(strpos($root, getenv('HOME')) !== false);
     //Giving no env var for explicitly set cache dir
     putenv('TERMINUS_CACHE_DIR=');
     $terminus->setCache();
     $root = Terminus::getCache()->getRoot();
     $this->assertTrue(strpos($root, getenv('HOME')) !== false);
     //Targeting a dir the Windows way
     exec('mkdir /tmp/out');
     $home = getenv('HOME');
     putenv('HOME=0');
     putenv('HOMEDRIVE=/tmp');
     putenv('HOMEPATH=out');
     $terminus->setCache();
     $root = Terminus::getCache()->getRoot();
     $this->assertTrue(strpos($root, '/tmp/out') !== false);
     //Clean-up
     putenv("HOME={$home}");
     exec("rm -r /tmp/out");
 }