<commit_before><?php

namespace li3_quality\tests\cases\test\rules;

class HasCorrectClassNameTest extends \li3_quality\test\Unit {

	public $rule = 'li3_quality\test\rules\HasCorrectClassName';

	public function testWithClosingTag() {
		$code = <<<EOD
namespace bar/baz;
class FooBar {}
EOD;
		$this->assertRulePass(array(
			'source' => $code,
			'path' => '/bar/baz/FooBar.php',
		), $this->rule);
	}

	public function testWithoutClosingTag() {
		$code = <<<EOD
namespace bar/baz;
class foobar {}
EOD;
		$this->assertRuleFail(array(
			'source' => $code,
			'path' => '/bar/baz/foobar.php',
		), $this->rule);
	}

	public function testWithoutMatchingFileName() {
		$code = <<<EOD
namespace bar/baz;
class FooBar {}
EOD;
		$this->assertRuleFail(array(
			'source' => $code,
			'path' => '/bar/baz/foo.php',
		), $this->rule);
	}

}

?><commit_msg>Add tests for correct class name which ignores non-php files.<commit_after><?php

namespace li3_quality\tests\cases\test\rules;

class HasCorrectClassNameTest extends \li3_quality\test\Unit {

	public $rule = 'li3_quality\test\rules\HasCorrectClassName';

	public function testWithClosingTag() {
		$code = <<<EOD
namespace bar/baz;
class FooBar {}
EOD;
		$this->assertRulePass(array(
			'source' => $code,
			'path' => '/bar/baz/FooBar.php',
		), $this->rule);
	}

	public function testWithoutClosingTag() {
		$code = <<<EOD
namespace bar/baz;
class foobar {}
EOD;
		$this->assertRuleFail(array(
			'source' => $code,
			'path' => '/bar/baz/foobar.php',
		), $this->rule);
	}

	public function testWithoutMatchingFileName() {
		$code = <<<EOD
namespace bar/baz;
class FooBar {}
EOD;
		$this->assertRuleFail(array(
			'source' => $code,
			'path' => '/bar/baz/foo.php',
		), $this->rule);
	}

	public function testNonPHPFile() {
		$code = <<<EOD
namespace bar/baz;
class FooBar {}
EOD;
		$this->assertRulePass(array(
			'source' => $code,
			'path' => '/bar/baz/foo.txt',
		), $this->rule);
	}

}

?>
{'fraction_non_alphanumeric': 0.18121149897330596, 'fraction_numerical': 0.003080082135523614, 'mean_word_length': 4.062337662337662, 'pattern_counts': {'":': 0, '<': 26, '<?xml version=': 0, '>': 33, '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': '2268921', 'n_tokens_mistral': 808, 'n_tokens_neox': 721, 'n_words': 141}