<commit_before><?php

namespace WordPress;

use WordPress\TwigReaper;

class TwigHelperTest extends \PHPUnit_Framework_TestCase {

  function setUp() {
    $this->helper = new TwigHelper();
  }

  function test_it_stores_base_dir() {
    $this->helper->setBaseDir('foo');
    $this->assertEquals('foo', $this->helper->getBaseDir());
  }

  function test_it_stores_twig_options() {
    $opts = array( 'debug' => true );
    $this->helper->setOptions($opts);
    $this->assertEquals($opts, $this->helper->getOptions());
  }

  function test_it_has_default_cache_dir() {
    $this->helper->setBaseDir('foo');
    $this->assertEquals('foo/dist/templates', $this->helper->getCacheDir());
  }

  function test_it_can_change_cache_dir() {
    $this->helper->setBaseDir('foo');
    $this->helper->setCacheDir('bar');
    $this->assertEquals('bar', $this->helper->getCacheDir());
  }

  function test_it_knows_if_cache_dir_exists() {
    $this->helper->setBaseDir(getcwd());
    $actual = $this->helper->hasCacheDir();
    $this->assertTrue($actual);
  }

  function test_it_knows_if_cache_dir_does_not_exist() {
    $this->helper->setBaseDir(getcwd());
    $this->helper->setCacheDir('foo/bar');
    $actual = $this->helper->hasCacheDir();
    $this->assertFalse($actual);
  }

  function test_it_adds_cache_dir_to_twig_options() {
    $this->helper->setCacheDir('dist/templates');
    $opts = $this->helper->getTwigOptions();
    $this->assertEquals('dist/templates', $opts['cache']);
  }

  function test_it_disables_caching_if_cache_dir_is_absent() {
    $this->helper->setCacheDir('foo/bar');
    $opts = $this->helper->getTwigOptions();
    $this->assertFalse($opts['cache']);
  }

  function test_it_has_default_templates_dir() {
    $this->helper->setBaseDir('foo');
    $actual = $this->helper->getSourceDirs();

    $this->assertEquals(array('foo/templates'), $actual);
  }<commit_msg>Fixed failing test.<commit_after><?php

namespace WordPress;

use WordPress\TwigReaper;

class TwigHelperTest extends \PHPUnit_Framework_TestCase {

  function setUp() {
    $this->helper = new TwigHelper();
  }

  function test_it_stores_base_dir() {
    $this->helper->setBaseDir('foo');
    $this->assertEquals('foo', $this->helper->getBaseDir());
  }

  function test_it_stores_twig_options() {
    $opts = array( 'debug' => true );
    $this->helper->setOptions($opts);
    $this->assertEquals($opts, $this->helper->getOptions());
  }

  function test_it_has_default_cache_dir() {
    $this->helper->setBaseDir('foo');
    $this->assertEquals('foo/dist/templates', $this->helper->getCacheDir());
  }

  function test_it_can_change_cache_dir() {
    $this->helper->setBaseDir('foo');
    $this->helper->setCacheDir('bar');
    $this->assertEquals('bar', $this->helper->getCacheDir());
  }

  function test_it_knows_if_cache_dir_exists() {
    $this->helper->setBaseDir(getcwd());
    $this->helper->setCacheDir('test');
    $actual = $this->helper->hasCacheDir();
    $this->assertTrue($actual);
  }

  function test_it_knows_if_cache_dir_does_not_exist() {
    $this->helper->setBaseDir(getcwd());
    $this->helper->setCacheDir('foo/bar');
    $actual = $this->helper->hasCacheDir();
    $this->assertFalse($actual);
  }

  function test_it_adds_cache_dir_to_twig_options() {
    $this->helper->setCacheDir('test');
    $opts = $this->helper->getTwigOptions();
    $this->assertEquals('test', $opts['cache']);
  }

  function test_it_disables_caching_if_cache_dir_is_absent() {
    $this->helper->setCacheDir('foo/bar');
    $opts = $this->helper->getTwigOptions();
    $this->assertFalse($opts['cache']);
  }

  function test_it_has_default_templates_dir() {
    $this->helper->setBaseDir('foo');
    $actual = $this->helper->getSourceDirs();

    $this->assertEquals(array('foo/templates'), $actual);
  }
{'fraction_non_alphanumeric': 0.18457082675092154, 'fraction_numerical': 0.0, 'mean_word_length': 4.817764165390505, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 107, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4131747', 'n_tokens_mistral': 1300, 'n_tokens_neox': 1280, 'n_words': 147}