Skip to content

Commit a82c1c6

Browse files
authored
✅ Ignore Drupal Coder rules tests (#14)
1 parent 308e17e commit a82c1c6

13 files changed

+202
-0
lines changed
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<?php
2+
3+
declare(strict_types = 1);
4+
5+
namespace PreviousNext\CodingStandard\Tests\Ignore;
6+
7+
/**
8+
* @covers \PHP_CodeSniffer\Standards\Generic\Sniffs\Commenting\DocCommentSniff
9+
*/
10+
final class IgnoreDocCommentSniffTest extends Base {
11+
12+
/**
13+
* Checks for 'Drupal.Commenting.DocComment.MissingShort'.
14+
*/
15+
public function testIgnored(): void {
16+
$report = self::checkFile(__DIR__ . '/fixtures/IgnoreDocCommentSniff.php');
17+
self::assertNoSniffErrorInFile($report);
18+
}
19+
20+
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<?php
2+
3+
declare(strict_types = 1);
4+
5+
namespace PreviousNext\CodingStandard\Tests\Ignore;
6+
7+
/**
8+
* @covers \Drupal\Sniffs\Arrays\ArraySniff
9+
*/
10+
final class IgnoreDrupalArraysArrayLongLineDeclarationTest extends Base {
11+
12+
/**
13+
* Checks for 'Drupal.Arrays.Array.LongLineDeclaration'.
14+
*/
15+
public function testIgnored(): void {
16+
$report = self::checkFile(__DIR__ . '/fixtures/IgnoreDrupalArraysArrayLongLineDeclaration.php');
17+
self::assertNoSniffErrorInFile($report);
18+
}
19+
20+
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<?php
2+
3+
declare(strict_types = 1);
4+
5+
namespace PreviousNext\CodingStandard\Tests\Ignore;
6+
7+
/**
8+
* @covers \Drupal\Sniffs\Commenting\ClassCommentSniff
9+
*/
10+
final class IgnoreDrupalCommentingClassCommentShortTest extends Base {
11+
12+
/**
13+
* Checks for 'Drupal.Commenting.ClassComment.Short'.
14+
*/
15+
public function testIgnored(): void {
16+
$report = self::checkFile(__DIR__ . '/fixtures/IgnoreDrupalCommentingClassCommentShort.php');
17+
self::assertNoSniffWarningInFile($report);
18+
}
19+
20+
}
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<?php
2+
3+
declare(strict_types = 1);
4+
5+
namespace PreviousNext\CodingStandard\Tests\Ignore;
6+
7+
/**
8+
* @covers \PHP_CodeSniffer\Standards\Squiz\Sniffs\Commenting\FunctionCommentSniff
9+
*/
10+
final class IgnoreDrupalCommentingFunctionCommentTest extends Base {
11+
12+
/**
13+
* Checks for 'Drupal.Commenting.FunctionComment.IncorrectParamVarName'.
14+
*/
15+
public function testIgnoredIncorrectParamVarName(): void {
16+
$report = self::checkFile(__DIR__ . '/fixtures/IgnoreDrupalCommentingFunctionComment_IncorrectParamVarName.php');
17+
self::assertNoSniffErrorInFile($report);
18+
}
19+
20+
/**
21+
* Checks for 'Drupal.Commenting.FunctionComment.InvalidReturn'.
22+
*/
23+
public function testIgnoredInvalidReturn(): void {
24+
$report = self::checkFile(__DIR__ . '/fixtures/IgnoreDrupalCommentingFunctionComment_InvalidReturn.php');
25+
self::assertNoSniffErrorInFile($report);
26+
}
27+
28+
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<?php
2+
3+
declare(strict_types = 1);
4+
5+
namespace PreviousNext\CodingStandard\Tests\Ignore;
6+
7+
/**
8+
* @covers \Drupal\Sniffs\Commenting\TodoCommentSniff
9+
*/
10+
final class IgnoreDrupalCommentingTodoCommentTodoFormatTest extends Base {
11+
12+
/**
13+
* Checks for 'Drupal.Commenting.TodoComment.TodoFormat'.
14+
*/
15+
public function testIgnored(): void {
16+
$report = self::checkFile(__DIR__ . '/fixtures/IgnoreDrupalCommentingTodoCommentTodoFormat.php');
17+
self::assertNoSniffWarningInFile($report);
18+
}
19+
20+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<?php
2+
3+
declare(strict_types = 1);
4+
5+
namespace PreviousNext\CodingStandard\Tests\Ignore;
6+
7+
/**
8+
* @covers \Drupal\Sniffs\Commenting\VariableCommentSniff
9+
*/
10+
final class IgnoreDrupalCommentingVariableCommentMissingTest extends Base {
11+
12+
public function testIgnored(): void {
13+
$report = self::checkFile(__DIR__ . '/fixtures/IgnoreDrupalCommentingVariableCommentMissing.php');
14+
self::assertNoSniffErrorInFile($report);
15+
self::assertNoSniffError($report, 12);
16+
}
17+
18+
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<?php
2+
3+
declare(strict_types = 1);
4+
5+
namespace PreviousNext\CodingStandard\Tests\Ignore\fixtures;
6+
7+
/**
8+
* Class IgnoreDrupalCommentingClassCommentShort.
9+
*/
10+
final class IgnoreDocCommentSniff {
11+
12+
/**
13+
* @return $this
14+
*/
15+
public function foo() {
16+
return $this;
17+
}
18+
19+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<?php
2+
3+
declare(strict_types = 1);
4+
5+
$foo = ['Lorem ipsum dolor sit amet, consectetur adipiscing elit', 'sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.'];
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<?php
2+
3+
declare(strict_types = 1);
4+
5+
namespace PreviousNext\CodingStandard\Tests\Ignore\fixtures;
6+
7+
/**
8+
* Class IgnoreDrupalCommentingClassCommentShort.
9+
*/
10+
final class IgnoreDrupalCommentingClassCommentShort {
11+
12+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<?php
2+
3+
declare(strict_types = 1);
4+
5+
/**
6+
* @param class-string $a
7+
* Foo.
8+
*/
9+
function foo(string $a): void {
10+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<?php
2+
3+
declare(strict_types = 1);
4+
5+
/**
6+
* @return class-string
7+
* Foo.
8+
*/
9+
function foo(): string {
10+
return '';
11+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<?php
2+
3+
declare(strict_types = 1);
4+
5+
// @TODO: fix this or that.
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<?php
2+
3+
declare(strict_types = 1);
4+
5+
namespace PreviousNext\CodingStandard\Tests\Ignore\fixtures;
6+
7+
/**
8+
* The class.
9+
*/
10+
final class IgnoreDrupalCommentingVariableCommentMissing {
11+
12+
public $foo = NULL;
13+
14+
}

0 commit comments

Comments
 (0)