<commit_before><?php


namespace Sculpin\Tests\Functional;

use Symfony\Component\DomCrawler\Crawler;
use Symfony\Component\Filesystem\Filesystem;

/**
 * This test case allows you to create a test project on the fly,
 * and run the sculpin binary against it. Test project files
 * will automatically be created and removed with every test.
 */
class FunctionalTestCase extends \PHPUnit_Framework_TestCase {

	const PROJECT_DIR = '/__SculpinTestProject__';

	/** @var Filesystem */
	protected static $fs;

	public static function setUpBeforeClass() {
		self::$fs = new Filesystem();
	}

	public function setUp() {
		parent::setUp();

		$this->setUpTestProject();
	}

	protected function setUpTestProject() {
		$projectFiles = [
			'/config/sculpin_kernel.yml',
			'/config/sculpin_site.yml',
			'/source/_layouts/raw.html.twig',
		];

		foreach ($projectFiles as $file) {
			$this->addProjectFile($file);
		}

		$this->writeToProjectFile('/source/_layouts/raw.html.twig', '{% block content %}{% endblock content %}');
	}

	public function tearDown() {
		parent::tearDown();
		$this->tearDownTestProject();
	}

	protected function tearDownTestProject() {
		$projectDir = self::ProjectDir();
		if (self::$fs->exists($projectDir)) {
			self::$fs->remove($projectDir);
		}
	}

	/**
	 * Execute a command against the sculpin binary
	 * @param string $command
	 */
	protected function executeSculpin($command) {
		$binPath = __DIR__ . '/../../../../bin';
		$projectDir = self::ProjectDir();
		exec("$binPath/sculpin $command --project-dir $projectDir --env=test");
	}
<commit_msg>FuncTestCase: tear down TestProject on setUp<commit_after><?php


namespace Sculpin\Tests\Functional;

use Symfony\Component\DomCrawler\Crawler;
use Symfony\Component\Filesystem\Filesystem;

/**
 * This test case allows you to create a test project on the fly,
 * and run the sculpin binary against it. Test project files
 * will automatically be created and removed with every test.
 */
class FunctionalTestCase extends \PHPUnit_Framework_TestCase {

	const PROJECT_DIR = '/__SculpinTestProject__';

	/** @var Filesystem */
	protected static $fs;

	public static function setUpBeforeClass() {
		self::$fs = new Filesystem();
	}

	public function setUp() {
		parent::setUp();

		$this->setUpTestProject();
	}

	protected function setUpTestProject() {
		$this->tearDownTestProject();

		$projectFiles = [
			'/config/sculpin_kernel.yml',
			'/config/sculpin_site.yml',
			'/source/_layouts/raw.html.twig',
		];

		foreach ($projectFiles as $file) {
			$this->addProjectFile($file);
		}

		$this->writeToProjectFile('/source/_layouts/raw.html.twig', '{% block content %}{% endblock content %}');
	}

	protected function tearDownTestProject() {
		$projectDir = self::ProjectDir();
		if (self::$fs->exists($projectDir)) {
			self::$fs->remove($projectDir);
		}
	}

	/**
	 * Execute a command against the sculpin binary
	 * @param string $command
	 */
	protected function executeSculpin($command) {
		$binPath = __DIR__ . '/../../../../bin';
		$projectDir = self::ProjectDir();
		exec("$binPath/sculpin $command --project-dir $projectDir --env=test");
	}

{'fraction_non_alphanumeric': 0.14852752880921896, 'fraction_numerical': 0.0, 'mean_word_length': 4.173841059602649, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 15, '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': '249857', 'n_tokens_mistral': 1070, 'n_tokens_neox': 980, 'n_words': 233}