for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
declare(strict_types = 1);
namespace Zenify\CodingStandard\Tests\Sniffs\WhiteSpace\ExclamationMark;
use PHPUnit\Framework\TestCase;
use Zenify\CodingStandard\Tests\CodeSnifferRunner;
use ZenifyCodingStandard\Sniffs\WhiteSpace\ExclamationMarkSniff;
final class ExclamationMarkSniffTest extends TestCase
{
public function testDetection()
$codeSnifferRunner = new CodeSnifferRunner(ExclamationMarkSniff::NAME);
$this->assertSame(1, $codeSnifferRunner->getErrorCountInFile(__DIR__ . '/wrong.php'));
$this->assertSame(1, $codeSnifferRunner->getErrorCountInFile(__DIR__ . '/wrong2.php'));
$this->assertSame(1, $codeSnifferRunner->getErrorCountInFile(__DIR__ . '/wrong3.php'));
$this->assertSame(0, $codeSnifferRunner->getErrorCountInFile(__DIR__ . '/correct.php'));
$this->assertSame(0, $codeSnifferRunner->getErrorCountInFile(__DIR__ . '/correct2.php'));
}
public function testFixing()
$fixedContent = $codeSnifferRunner->getFixedContent(__DIR__ . '/wrong.php');
$this->assertSame(file_get_contents(__DIR__ . '/wrong-fixed.php'), $fixedContent);
$fixedContent = $codeSnifferRunner->getFixedContent(__DIR__ . '/wrong2.php');
$fixedContent = $codeSnifferRunner->getFixedContent(__DIR__ . '/wrong3.php');