<commit_before><?php

/**
 * This file is part of Zenify
 * Copyright (c) 2012 <NAME> (http://tomasvotruba.cz)
 */

namespace ZenifyTests;

use StdClass;
use Tester;
use Tester\Assert;


class TestCase extends Tester\TestCase
{

	/**
	 * @param string $source
	 * @throws \Exception
	 * @return int
	 */
	protected function runPhpCsForFile($source)
	{
		if ( ! file_exists($source)) {
			throw new \Exception("File $source was not found");
		}

		$cliCommand = PHPCS_BIN . ' ' . $source . ' --standard=' . SRC_DIR . '/ZenifyCodingStandard/ruleset.xml --report=json';
		exec($cliCommand, $output);
		$data = json_decode(implode($output));

		if (empty($data)) {
			throw new \Exception('Cli "' . $cliCommand . '" failed');
		}

		$result = array(
			'errors' => $this->getAllErrors($data)
		);
		return $result;
	}


	/**
	 * @param \StdClass $message
	 * @param string $message
	 * @param string $source
	 */
	protected function validateErrorMessageAndSource(\StdClass $error, $expectedMessage, $expectedSource)
	{
		Assert::same($expectedMessage, $error->message);
		Assert::same($expectedSource, $error->source);
	}


	/**<commit_msg>naming<commit_after><?php

/**
 * This file is part of Zenify
 * Copyright (c) 2012 <NAME> (http://tomasvotruba.cz)
 */

namespace ZenifyTests;

use StdClass;
use Tester;
use Tester\Assert;


class TestCase extends Tester\TestCase
{

	/**
	 * @param string $source
	 * @throws \Exception
	 * @return int
	 */
	protected function runPhpCsForFile($source)
	{
		if ( ! file_exists($source)) {
			throw new \Exception("File $source was not found");
		}

		$cliCommand = PHPCS_BIN . ' ' . $source . ' --standard=' . SRC_DIR . '/ZenifyCodingStandard/ruleset.xml --report=json';
		exec($cliCommand, $output);
		$data = json_decode(implode($output));

		if (empty($data)) {
			throw new \Exception('Cli "' . $cliCommand . '" failed');
		}

		$result = array(
			'errors' => $this->getAllErrors($data)
		);
		return $result;
	}


	/**
	 * @param StdClass $error
	 * @param $expectedMessage
	 * @param $expectedSource
	 */
	protected function validateErrorMessageAndSource(\StdClass $error, $expectedMessage, $expectedSource)
	{
		Assert::same($expectedMessage, $error->message);
		Assert::same($expectedSource, $error->source);
	}


	/**
{'fraction_non_alphanumeric': 0.16298586572438162, 'fraction_numerical': 0.0035335689045936395, 'mean_word_length': 3.8191489361702127, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 2}, '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': '5425577', 'n_tokens_mistral': 826, 'n_tokens_neox': 745, 'n_words': 170}