@@ -10,9 +10,20 @@ class LinterTest extends \PHPUnit\Framework\TestCase
1010 */
1111 protected $ linter ;
1212
13+ /**
14+ * @var string
15+ */
16+ protected $ phpVersion ;
17+
1318 protected function setUp (): void
1419 {
1520 $ this ->linter = new \CssLint \Linter ();
21+ $ php_version = phpversion ();
22+ if (version_compare ($ php_version , '8.0.0 ' , '>= ' )) {
23+ $ this ->phpVersion = '8 ' ;
24+ } else {
25+ $ this ->phpVersion = '7 ' ;
26+ }
1627 }
1728
1829 public function testConstructWithCustomCssLintProperties ()
@@ -113,20 +124,30 @@ public function testLintStringWithWrongSelectorUnexpectedToken()
113124 public function testLintStringWithWrongTypeParam ()
114125 {
115126 $ this ->expectException (\TypeError::class);
116- $ this ->expectExceptionMessage (
117- 'Argument 1 passed to CssLint\Linter::lintString() must be of the type string, array given '
118- );
119-
127+ if ($ this ->phpVersion == '8 ' ) {
128+ $ this ->expectExceptionMessage (
129+ 'CssLint\Linter::lintString(): Argument #1 ($sString) must be of type string, array given '
130+ );
131+ } else {
132+ $ this ->expectExceptionMessage (
133+ 'Argument 1 passed to CssLint\Linter::lintString() must be of the type string, array given '
134+ );
135+ }
120136 $ this ->linter ->lintString (['wrong ' ]);
121- $ this ->assertFalse (false );
122137 }
123138
124139 public function testLintFileWithWrongTypeParam ()
125140 {
126141 $ this ->expectException (\TypeError::class);
127- $ this ->expectExceptionMessage (
128- 'Argument 1 passed to CssLint\Linter::lintFile() must be of the type string, array given '
129- );
142+ if ($ this ->phpVersion == '8 ' ) {
143+ $ this ->expectExceptionMessage (
144+ 'CssLint\Linter::lintFile(): Argument #1 ($sFilePath) must be of type string, array given '
145+ );
146+ } else {
147+ $ this ->expectExceptionMessage (
148+ 'Argument 1 passed to CssLint\Linter::lintFile() must be of the type string, array given '
149+ );
150+ }
130151 $ this ->linter ->lintFile (['wrong ' ]);
131152 }
132153
0 commit comments