-
-
Notifications
You must be signed in to change notification settings - Fork 60
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Tests/GetMethodParametersTest: add extra tests
This adds some extra tests which were already in use in PHPCSUtils.
- Loading branch information
Showing
6 changed files
with
1,617 additions
and
114 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
<?php | ||
|
||
/* testParseError */ | ||
function missingOpenParens // Intentional parse error. |
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,38 @@ | ||
<?php | ||
/** | ||
* Tests for the \PHP_CodeSniffer\Files\File::getMethodParameters method. | ||
* | ||
* @author Juliette Reinders Folmer <[email protected]> | ||
* @copyright 2019-2024 PHPCSStandards Contributors | ||
* @license https://github.com/PHPCSStandards/PHP_CodeSniffer/blob/master/licence.txt BSD Licence | ||
*/ | ||
|
||
namespace PHP_CodeSniffer\Tests\Core\File; | ||
|
||
use PHP_CodeSniffer\Tests\Core\AbstractMethodUnitTest; | ||
|
||
/** | ||
* Tests for the \PHP_CodeSniffer\Files\File::getMethodParameters method. | ||
* | ||
* @covers \PHP_CodeSniffer\Files\File::getMethodParameters | ||
*/ | ||
class GetMethodParametersParseError1Test extends AbstractMethodUnitTest | ||
{ | ||
|
||
|
||
/** | ||
* Test receiving an empty array when encountering a specific parse error. | ||
* | ||
* @return void | ||
*/ | ||
public function testParseError() | ||
{ | ||
$target = $this->getTargetToken('/* testParseError */', [T_FUNCTION, T_CLOSURE, T_FN]); | ||
$result = self::$phpcsFile->getMethodParameters($target); | ||
|
||
$this->assertSame([], $result); | ||
|
||
}//end testParseError() | ||
|
||
|
||
}//end class |
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,4 @@ | ||
<?php | ||
|
||
/* testParseError */ | ||
function missingCloseParens( // Intentional parse error. |
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,38 @@ | ||
<?php | ||
/** | ||
* Tests for the \PHP_CodeSniffer\Files\File::getMethodParameters method. | ||
* | ||
* @author Juliette Reinders Folmer <[email protected]> | ||
* @copyright 2019-2024 PHPCSStandards Contributors | ||
* @license https://github.com/PHPCSStandards/PHP_CodeSniffer/blob/master/licence.txt BSD Licence | ||
*/ | ||
|
||
namespace PHP_CodeSniffer\Tests\Core\File; | ||
|
||
use PHP_CodeSniffer\Tests\Core\AbstractMethodUnitTest; | ||
|
||
/** | ||
* Tests for the \PHP_CodeSniffer\Files\File::getMethodParameters method. | ||
* | ||
* @covers \PHP_CodeSniffer\Files\File::getMethodParameters | ||
*/ | ||
class GetMethodParametersParseError2Test extends AbstractMethodUnitTest | ||
{ | ||
|
||
|
||
/** | ||
* Test receiving an empty array when encountering a specific parse error. | ||
* | ||
* @return void | ||
*/ | ||
public function testParseError() | ||
{ | ||
$target = $this->getTargetToken('/* testParseError */', [T_FUNCTION, T_CLOSURE, T_FN]); | ||
$result = self::$phpcsFile->getMethodParameters($target); | ||
|
||
$this->assertSame([], $result); | ||
|
||
}//end testParseError() | ||
|
||
|
||
}//end class |
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
Oops, something went wrong.