|
@@ 10-24 (lines=15) @@
|
| 7 |
|
|
| 8 |
|
class LoadPhpcsReportTest extends TestCase |
| 9 |
|
{ |
| 10 |
|
public function testCanMakeClass() |
| 11 |
|
{ |
| 12 |
|
$phpcs = new PhpCsLoader(__DIR__ . '/fixtures/phpcs.json'); |
| 13 |
|
$invalidLines = $phpcs->getLines(); |
| 14 |
|
$expected = [ |
| 15 |
|
'/full/path/to/file/src/XMLReport.php' => [ |
| 16 |
|
11 => ['Opening brace should be on the line after the declaration; found 1 blank line(s)'], |
| 17 |
|
12 => ['Line indented incorrectly; expected at least 8 spaces, found 4'], |
| 18 |
|
], |
| 19 |
|
]; |
| 20 |
|
|
| 21 |
|
$this->assertEquals($expected, $invalidLines); |
| 22 |
|
$this->assertFalse($phpcs->isValidLine('/full/path/to/file/src/XMLReport.php', 11)); |
| 23 |
|
$this->assertTrue($phpcs->isValidLine('/full/path/to/file/src/XMLReport.php', 10)); |
| 24 |
|
} |
| 25 |
|
|
| 26 |
|
/** |
| 27 |
|
* @expectedException \InvalidArgumentException |
|
@@ 41-55 (lines=15) @@
|
| 38 |
|
$this->assertTrue($phpcs->handleNotFoundFile()); |
| 39 |
|
} |
| 40 |
|
|
| 41 |
|
public function testStrictMode() |
| 42 |
|
{ |
| 43 |
|
$phpcs = new PhpCsLoaderStrict(__DIR__ . '/fixtures/phpcsstrict.json'); |
| 44 |
|
$invalidLines = $phpcs->getLines(); |
| 45 |
|
$expected = [ |
| 46 |
|
'/full/path/to/file/src/XMLReport.php' => [ |
| 47 |
|
11 => ['Opening brace should be on the line after the declaration; found 1 blank line(s)'], |
| 48 |
|
12 => ['Line indented incorrectly; expected at least 8 spaces, found 4'], |
| 49 |
|
], |
| 50 |
|
]; |
| 51 |
|
|
| 52 |
|
$this->assertEquals($expected, $invalidLines); |
| 53 |
|
$this->assertFalse($phpcs->isValidLine('/full/path/to/file/src/XMLReport.php', 11)); |
| 54 |
|
$this->assertTrue($phpcs->isValidLine('/full/path/to/file/src/XMLReport.php', 10)); |
| 55 |
|
} |
| 56 |
|
} |
| 57 |
|
|