Skip to content

Commit

Permalink
PopulateTokenListenersTest: fix a few typos
Browse files Browse the repository at this point in the history
... and add one extra assertion to increase the stability of the tests.
  • Loading branch information
jrfnl committed Dec 14, 2024
1 parent cbc3b53 commit 64c18d5
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions tests/Core/Ruleset/PopulateTokenListenersTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ public function testSetsClassAndSourceIndexes()
$this->assertSame(
$className,
$details['class'],
sprintf('Unexepcted value for "class" key for sniff class %s for token %s', $className, Tokens::tokenName($token))
sprintf('Unexpected value for "class" key for sniff class %s for token %s', $className, Tokens::tokenName($token))
);

$this->assertArrayHasKey(
Expand All @@ -283,12 +283,17 @@ public function testSetsClassAndSourceIndexes()
sprintf('"source" key missing for sniff class %s for token %s', $className, Tokens::tokenName($token))
);

$this->assertTrue(
is_string($details['source']),
sprintf('Value for "source" key is not a string for token %s', Tokens::tokenName($token))
);

$expected = '.'.substr($className, (strrpos($className, '\\') + 1), -5);

$this->assertStringEndsWith(
$expected,
$details['source'],
sprintf('Unexepcted value for "source" key for sniff class %s for token %s', $className, Tokens::tokenName($token))
sprintf('Unexpected value for "source" key for sniff class %s for token %s', $className, Tokens::tokenName($token))
);
}//end foreach
}//end foreach
Expand Down Expand Up @@ -324,7 +329,7 @@ public function testSetsSupportedTokenizersToPHPByDefault()
$this->assertSame(
$expected,
$details['tokenizers'],
sprintf('Unexepcted value for "tokenizers" key for sniff class %s for token %s', $className, Tokens::tokenName($token))
sprintf('Unexpected value for "tokenizers" key for sniff class %s for token %s', $className, Tokens::tokenName($token))
);
}
}//end foreach
Expand Down

0 comments on commit 64c18d5

Please sign in to comment.