Unverified Commit 82ea73df authored by Klaus Purer's avatar Klaus Purer Committed by GitHub
Browse files

style(PHPCS): Apply coding standards to test classes (#2734539)

parent c85aae11
Loading
Loading
Loading
Loading
+7 −6
Original line number Diff line number Diff line
@@ -7,6 +7,7 @@ use Drupal\Test\CoderSniffUnitTest;
class ArrayUnitTest extends CoderSniffUnitTest
{


    /**
     * Returns the lines where errors should occur.
     *
@@ -15,15 +16,15 @@ class ArrayUnitTest extends CoderSniffUnitTest
     *
     * @return array(int => int)
     */
    public function getErrorList($testFile = NULL)
    public function getErrorList()
    {
        return array(
        return [
            13 => 1,
            33 => 1,
            83 => 1,
            88 => 1,
            92 => 1,
        );
        ];

    }//end getErrorList()

@@ -36,9 +37,9 @@ class ArrayUnitTest extends CoderSniffUnitTest
     *
     * @return array(int => int)
     */
    public function getWarningList($testFile = NULL)
    public function getWarningList()
    {
        return array(
        return [
            17 => 1,
            22 => 1,
            23 => 1,
@@ -48,7 +49,7 @@ class ArrayUnitTest extends CoderSniffUnitTest
            44 => 1,
            59 => 1,
            76 => 1,
        );
        ];

    }//end getWarningList()

+20 −13
Original line number Diff line number Diff line
@@ -7,22 +7,25 @@ use Drupal\Test\CoderSniffUnitTest;
class DisallowLongArraySyntaxUnitTest extends CoderSniffUnitTest
{


    /**
     * Returns the lines where errors should occur.
     *
     * The key of the array should represent the line number and the value
     * should represent the number of errors that should occur on that line.
     *
     * @param string $testFile The name of the file being tested.
     *
     * @return array(int => int)
     */
    public function getErrorList($testFile = NULL)
    public function getErrorList($testFile=null)
    {
        switch ($testFile) {
        case 'DisallowLongArraySyntaxUnitTest.2.inc':
                return array(12 => 1);
            return [12 => 1];

        default:
                return array();
            return [];
        }

    }//end getErrorList()
@@ -36,9 +39,9 @@ class DisallowLongArraySyntaxUnitTest extends CoderSniffUnitTest
     *
     * @return array(int => int)
     */
    public function getWarningList($testFile = NULL)
    public function getWarningList()
    {
        return array();
        return [];

    }//end getWarningList()

@@ -46,14 +49,18 @@ class DisallowLongArraySyntaxUnitTest extends CoderSniffUnitTest
    /**
     * Returns a list of test files that should be checked.
     *
     * @param string $testFileBase The base path that the unit tests files will have.
     *
     * @return array The list of test files.
     */
    protected function getTestFiles($testFileBase) {
        return array(
    protected function getTestFiles($testFileBase)
    {
        return [
            __DIR__.'/disallow_long_array_d7/DisallowLongArraySyntaxUnitTest.1.inc',
            __DIR__.'/disallow_long_array_d8/DisallowLongArraySyntaxUnitTest.2.inc',
               );
    }
        ];

    }//end getTestFiles()


}//end class
+18 −18
Original line number Diff line number Diff line
@@ -16,9 +16,9 @@ class ClassCreateInstanceUnitTest extends CoderSniffUnitTest
     *
     * @return array(int => int)
     */
    public function getErrorList($testFile = NULL)
    public function getErrorList()
    {
        return array(
        return [
            3  => 1,
            4  => 1,
            5  => 1,
@@ -32,7 +32,7 @@ class ClassCreateInstanceUnitTest extends CoderSniffUnitTest
            14 => 1,
            16 => 1,
            31 => 1,
               );
        ];

    }//end getErrorList()

@@ -45,9 +45,9 @@ class ClassCreateInstanceUnitTest extends CoderSniffUnitTest
     *
     * @return array(int => int)
     */
    public function getWarningList($testFile = NULL)
    public function getWarningList()
    {
        return array();
        return [];

    }//end getWarningList()

+8 −8
Original line number Diff line number Diff line
@@ -16,13 +16,13 @@ class ClassDeclarationUnitTest extends CoderSniffUnitTest
     *
     * @return array(int => int)
     */
    public function getErrorList($testFile = NULL)
    public function getErrorList()
    {
        return array(
        return [
            11 => 1,
            19 => 1,
            28 => 1,
               );
        ];

    }//end getErrorList()

@@ -35,9 +35,9 @@ class ClassDeclarationUnitTest extends CoderSniffUnitTest
     *
     * @return array(int => int)
     */
    public function getWarningList($testFile = NULL)
    public function getWarningList()
    {
        return array();
        return [];

    }//end getWarningList()

+20 −13
Original line number Diff line number Diff line
@@ -2,7 +2,7 @@

namespace Drupal\Sniffs\Classes;

use Drupal\Test\CoderSniffUnitTest;;
use Drupal\Test\CoderSniffUnitTest;

class FullyQualifiedNamespaceUnitTest extends CoderSniffUnitTest
{
@@ -14,17 +14,17 @@ class FullyQualifiedNamespaceUnitTest extends CoderSniffUnitTest
     * The key of the array should represent the line number and the value
     * should represent the number of errors that should occur on that line.
     *
     * @param string $testFile The name of the file being tested.
     *
     * @return array(int => int)
     */
    public function getErrorList($testFile = NULL)
    public function getErrorList($testFile=null)
    {
        switch ($testFile) {
        case 'FullyQualifiedNamespaceUnitTest.inc':
                return array(
                        3 => 1,
                       );
            return [3 => 1];
        case 'FullyQualifiedNamespaceUnitTest.api.php':
                return array();
            return [];
        }

    }//end getErrorList()
@@ -38,9 +38,9 @@ class FullyQualifiedNamespaceUnitTest extends CoderSniffUnitTest
     *
     * @return array(int => int)
     */
    public function getWarningList($testFile = NULL)
    public function getWarningList()
    {
        return array();
        return [];

    }//end getWarningList()

@@ -48,11 +48,18 @@ class FullyQualifiedNamespaceUnitTest extends CoderSniffUnitTest
    /**
     * Returns a list of test files that should be checked.
     *
     * @param string $testFileBase The base path that the unit tests files will have.
     *
     * @return array The list of test files.
     */
    protected function getTestFiles($testFileBase) {
        return [__DIR__.'/FullyQualifiedNamespaceUnitTest.inc', __DIR__.'/FullyQualifiedNamespaceUnitTest.api.php'];
    }
    protected function getTestFiles($testFileBase)
    {
        return [
            __DIR__.'/FullyQualifiedNamespaceUnitTest.inc',
            __DIR__.'/FullyQualifiedNamespaceUnitTest.api.php',
        ];

    }//end getTestFiles()


}//end class
Loading