From 64c18d5039e74aef710b8741c4e4fa32061fc5d1 Mon Sep 17 00:00:00 2001 From: jrfnl Date: Sat, 14 Dec 2024 12:31:33 +0100 Subject: [PATCH] PopulateTokenListenersTest: fix a few typos ... and add one extra assertion to increase the stability of the tests. --- tests/Core/Ruleset/PopulateTokenListenersTest.php | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/tests/Core/Ruleset/PopulateTokenListenersTest.php b/tests/Core/Ruleset/PopulateTokenListenersTest.php index 78e14a7b35..c0abfffd54 100644 --- a/tests/Core/Ruleset/PopulateTokenListenersTest.php +++ b/tests/Core/Ruleset/PopulateTokenListenersTest.php @@ -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( @@ -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 @@ -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