Skip to content

✅ Ignore Drupal Coder rules tests #14

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions tests/Ignore/IgnoreDocCommentSniffTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?php

declare(strict_types = 1);

namespace PreviousNext\CodingStandard\Tests\Ignore;

/**
* @covers \PHP_CodeSniffer\Standards\Generic\Sniffs\Commenting\DocCommentSniff
*/
final class IgnoreDocCommentSniffTest extends Base {

/**
* Checks for 'Drupal.Commenting.DocComment.MissingShort'.
*/
public function testIgnored(): void {
$report = self::checkFile(__DIR__ . '/fixtures/IgnoreDocCommentSniff.php');
self::assertNoSniffErrorInFile($report);
}

}
20 changes: 20 additions & 0 deletions tests/Ignore/IgnoreDrupalArraysArrayLongLineDeclarationTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?php

declare(strict_types = 1);

namespace PreviousNext\CodingStandard\Tests\Ignore;

/**
* @covers \Drupal\Sniffs\Arrays\ArraySniff
*/
final class IgnoreDrupalArraysArrayLongLineDeclarationTest extends Base {

/**
* Checks for 'Drupal.Arrays.Array.LongLineDeclaration'.
*/
public function testIgnored(): void {
$report = self::checkFile(__DIR__ . '/fixtures/IgnoreDrupalArraysArrayLongLineDeclaration.php');
self::assertNoSniffErrorInFile($report);
}

}
20 changes: 20 additions & 0 deletions tests/Ignore/IgnoreDrupalCommentingClassCommentShortTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?php

declare(strict_types = 1);

namespace PreviousNext\CodingStandard\Tests\Ignore;

/**
* @covers \Drupal\Sniffs\Commenting\ClassCommentSniff
*/
final class IgnoreDrupalCommentingClassCommentShortTest extends Base {

/**
* Checks for 'Drupal.Commenting.ClassComment.Short'.
*/
public function testIgnored(): void {
$report = self::checkFile(__DIR__ . '/fixtures/IgnoreDrupalCommentingClassCommentShort.php');
self::assertNoSniffWarningInFile($report);
}

}
28 changes: 28 additions & 0 deletions tests/Ignore/IgnoreDrupalCommentingFunctionCommentTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?php

declare(strict_types = 1);

namespace PreviousNext\CodingStandard\Tests\Ignore;

/**
* @covers \PHP_CodeSniffer\Standards\Squiz\Sniffs\Commenting\FunctionCommentSniff
*/
final class IgnoreDrupalCommentingFunctionCommentTest extends Base {

/**
* Checks for 'Drupal.Commenting.FunctionComment.IncorrectParamVarName'.
*/
public function testIgnoredIncorrectParamVarName(): void {
$report = self::checkFile(__DIR__ . '/fixtures/IgnoreDrupalCommentingFunctionComment_IncorrectParamVarName.php');
self::assertNoSniffErrorInFile($report);
}

/**
* Checks for 'Drupal.Commenting.FunctionComment.InvalidReturn'.
*/
public function testIgnoredInvalidReturn(): void {
$report = self::checkFile(__DIR__ . '/fixtures/IgnoreDrupalCommentingFunctionComment_InvalidReturn.php');
self::assertNoSniffErrorInFile($report);
}

}
20 changes: 20 additions & 0 deletions tests/Ignore/IgnoreDrupalCommentingTodoCommentTodoFormatTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?php

declare(strict_types = 1);

namespace PreviousNext\CodingStandard\Tests\Ignore;

/**
* @covers \Drupal\Sniffs\Commenting\TodoCommentSniff
*/
final class IgnoreDrupalCommentingTodoCommentTodoFormatTest extends Base {

/**
* Checks for 'Drupal.Commenting.TodoComment.TodoFormat'.
*/
public function testIgnored(): void {
$report = self::checkFile(__DIR__ . '/fixtures/IgnoreDrupalCommentingTodoCommentTodoFormat.php');
self::assertNoSniffWarningInFile($report);
}

}
18 changes: 18 additions & 0 deletions tests/Ignore/IgnoreDrupalCommentingVariableCommentMissingTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?php

declare(strict_types = 1);

namespace PreviousNext\CodingStandard\Tests\Ignore;

/**
* @covers \Drupal\Sniffs\Commenting\VariableCommentSniff
*/
final class IgnoreDrupalCommentingVariableCommentMissingTest extends Base {

public function testIgnored(): void {
$report = self::checkFile(__DIR__ . '/fixtures/IgnoreDrupalCommentingVariableCommentMissing.php');
self::assertNoSniffErrorInFile($report);
self::assertNoSniffError($report, 12);
}

}
19 changes: 19 additions & 0 deletions tests/Ignore/fixtures/IgnoreDocCommentSniff.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?php

declare(strict_types = 1);

namespace PreviousNext\CodingStandard\Tests\Ignore\fixtures;

/**
* Class IgnoreDrupalCommentingClassCommentShort.
*/
final class IgnoreDocCommentSniff {

/**
* @return $this
*/
public function foo() {
return $this;
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?php

declare(strict_types = 1);

$foo = ['Lorem ipsum dolor sit amet, consectetur adipiscing elit', 'sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.'];
12 changes: 12 additions & 0 deletions tests/Ignore/fixtures/IgnoreDrupalCommentingClassCommentShort.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?php

declare(strict_types = 1);

namespace PreviousNext\CodingStandard\Tests\Ignore\fixtures;

/**
* Class IgnoreDrupalCommentingClassCommentShort.
*/
final class IgnoreDrupalCommentingClassCommentShort {

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?php

declare(strict_types = 1);

/**
* @param class-string $a
* Foo.
*/
function foo(string $a): void {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?php

declare(strict_types = 1);

/**
* @return class-string
* Foo.
*/
function foo(): string {
return '';
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?php

declare(strict_types = 1);

// @TODO: fix this or that.
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?php

declare(strict_types = 1);

namespace PreviousNext\CodingStandard\Tests\Ignore\fixtures;

/**
* The class.
*/
final class IgnoreDrupalCommentingVariableCommentMissing {

public $foo = NULL;

}