Skip to content

Commit

Permalink
Conditions/GetConditionTest: allow for PHP 8.0 identifier name tokeni…
Browse files Browse the repository at this point in the history
…zation

Add a toggle to retrieve the right token based on the expected tokenization for a test.
  • Loading branch information
jrfnl committed Sep 13, 2020
1 parent de30d98 commit 12d512c
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion Tests/Utils/Conditions/GetConditionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,12 @@ public function testGetConditionMultipleTypes()
*/
public function testNonConditionalTokenGetFirstLast()
{
$stackPtr = $this->getTargetToken('/* testStartPoint */', \T_STRING);
$targetType = \T_STRING;
if (parent::usesPhp8NameTokens() === true) {
$targetType = \T_NAME_QUALIFIED;
}

$stackPtr = $this->getTargetToken('/* testStartPoint */', $targetType);

$result = Conditions::getFirstCondition(self::$phpcsFile, $stackPtr);
$this->assertFalse($result, 'Failed asserting that getFirstCondition() on non conditional token returns false');
Expand Down

0 comments on commit 12d512c

Please sign in to comment.