-
-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add
AbstractLineContentRuleTestCase
(#1540)
- Loading branch information
1 parent
5dc4aff
commit 76f5a7e
Showing
4 changed files
with
53 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -32,5 +32,4 @@ public function __construct( | |
|
||
$this->lines = Lines::fromArray($content); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
/** | ||
* This file is part of DOCtor-RST. | ||
* | ||
* (c) Oskar Stark <oskarstark@googlemail.com> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace App\Tests\Rule; | ||
|
||
use App\Rule\LineContentRule; | ||
use App\Tests\RstSample; | ||
use App\Tests\UnitTestCase; | ||
use App\Value\ViolationInterface; | ||
|
||
abstract class AbstractLineContentRuleTestCase extends UnitTestCase | ||
{ | ||
abstract public function createRule(): LineContentRule; | ||
|
||
/** | ||
* @return \Generator<array{0: ViolationInterface, 1: RstSample}> | ||
*/ | ||
abstract public static function checkProvider(): iterable; | ||
|
||
/** | ||
* @test | ||
* | ||
* @dataProvider checkProvider | ||
*/ | ||
public function check(ViolationInterface $expected, RstSample $sample): void | ||
{ | ||
self::assertEquals( | ||
$expected, | ||
static::createRule()->check($sample->lines, $sample->lineNumber, 'filename'), | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters