You are here

public function Twig_Tests_FileCachingTest::setUp in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/twig/twig/test/Twig/Tests/FileCachingTest.php \Twig_Tests_FileCachingTest::setUp()

Sets up the fixture, for example, open a network connection. This method is called before a test is executed.

Overrides PHPUnit_Framework_TestCase::setUp

File

vendor/twig/twig/test/Twig/Tests/FileCachingTest.php, line 18

Class

Twig_Tests_FileCachingTest

Code

public function setUp() {
  $this->tmpDir = sys_get_temp_dir() . '/TwigTests';
  if (!file_exists($this->tmpDir)) {
    @mkdir($this->tmpDir, 0777, true);
  }
  if (!is_writable($this->tmpDir)) {
    $this
      ->markTestSkipped(sprintf('Unable to run the tests as "%s" is not writable.', $this->tmpDir));
  }
  $this->env = new Twig_Environment(new Twig_Loader_Array(array(
    'index' => 'index',
    'index2' => 'index2',
  )), array(
    'cache' => $this->tmpDir,
  ));
}