diff --git a/tests/Phug/Adapter/FileAdapterTest.php b/tests/Phug/Adapter/FileAdapterTest.php index e4746127..6d3ac032 100644 --- a/tests/Phug/Adapter/FileAdapterTest.php +++ b/tests/Phug/Adapter/FileAdapterTest.php @@ -539,7 +539,7 @@ public function testCacheErrorTrace() 'count' => 0, ]); - self::assertContains('on line 5, offset 6', $lastError); + self::assertStringContainsString('on line 5, offset 6', $lastError); } /** @@ -673,7 +673,7 @@ public function testCacheDirectory() self::assertSame(2, $errErrors); self::assertStringEndsWith('errored', $errErrorDetails[0]['directory']); self::assertStringEndsWith('errored.pug', $errErrorDetails[0]['inputFile']); - self::assertContains( + self::assertStringContainsString( 'Inconsistent indentation. Expecting either 0 or 4 spaces/tabs.', $errErrorDetails[0]['error']->getMessage() ); diff --git a/tests/Phug/CompilerModuleTest.php b/tests/Phug/CompilerModuleTest.php index 8a1d395f..ed574bd0 100644 --- a/tests/Phug/CompilerModuleTest.php +++ b/tests/Phug/CompilerModuleTest.php @@ -49,7 +49,7 @@ public function testCompileEvent() $message = $exception->getMessage(); } - self::assertContains('foo-bar.pug', $message); + self::assertStringContainsString('foo-bar.pug', $message); } /** diff --git a/tests/Phug/OptimizerTest.php b/tests/Phug/OptimizerTest.php index 1dfa4e01..5754027a 100644 --- a/tests/Phug/OptimizerTest.php +++ b/tests/Phug/OptimizerTest.php @@ -220,8 +220,8 @@ public function testCache() $contents .= file_get_contents($file); } - self::assertContains('

A

', $contents); - self::assertContains('

B

', $contents); + self::assertStringContainsString('

A

', $contents); + self::assertStringContainsString('

B

', $contents); $this->removeFile($cache); } diff --git a/tests/Phug/Parser/TokenHandler/ExpansionTokenHandlerTest.php b/tests/Phug/Parser/TokenHandler/ExpansionTokenHandlerTest.php index 942e3124..a7a5fa26 100644 --- a/tests/Phug/Parser/TokenHandler/ExpansionTokenHandlerTest.php +++ b/tests/Phug/Parser/TokenHandler/ExpansionTokenHandlerTest.php @@ -101,7 +101,7 @@ public function testHandleTokenElementException() $message = $exp->getMessage(); } - self::assertContains('Expansion needs an element to work on', $message); - self::assertContains('Path: my-path', $message); + self::assertStringContainsString('Expansion needs an element to work on', $message); + self::assertStringContainsString('Path: my-path', $message); } } diff --git a/tests/Phug/ProfilerModuleTest.php b/tests/Phug/ProfilerModuleTest.php index 315ac94f..1f3473ae 100644 --- a/tests/Phug/ProfilerModuleTest.php +++ b/tests/Phug/ProfilerModuleTest.php @@ -55,15 +55,15 @@ public function testRenderProfiler() $render = $renderer->render('div'); self::assertRegExp('/div lexing\s*
\s*[\.\d]+[µm]?s/', $render); - self::assertContains('title="div lexing:', $render); + self::assertStringContainsString('title="div lexing:', $render); self::assertRegExp('/div parsing\s*
\s*[\.\d]+[µm]?s/', $render); - self::assertContains('title="div parsing:', $render); + self::assertStringContainsString('title="div parsing:', $render); self::assertRegExp('/div compiling\s*
\s*[\.\d]+[µm]?s/', $render); - self::assertContains('title="div compiling:', $render); + self::assertStringContainsString('title="div compiling:', $render); self::assertRegExp('/div formatting\s*
\s*[\.\d]+[µm]?s/', $render); - self::assertContains('title="div formatting:', $render); + self::assertStringContainsString('title="div formatting:', $render); self::assertRegExp('/div rendering\s*
\s*[\.\d]+[µm]?s/', $render); - self::assertContains('title="div rendering:', $render); + self::assertStringContainsString('title="div rendering:', $render); $renderer = new Renderer([ 'enable_profiler' => true, @@ -118,15 +118,15 @@ public function testLogProfiler() $profiler->recordDisplayEvent(1); self::assertCount($count, $profiler->getEvents()); self::assertRegExp('/div lexing\s*
\s*[\.\d]+[µm]?s/', $render); - self::assertContains('title="div lexing:', $render); + self::assertStringContainsString('title="div lexing:', $render); self::assertRegExp('/div parsing\s*
\s*[\.\d]+[µm]?s/', $render); - self::assertContains('title="div parsing:', $render); + self::assertStringContainsString('title="div parsing:', $render); self::assertRegExp('/div compiling\s*
\s*[\.\d]+[µm]?s/', $render); - self::assertContains('title="div compiling:', $render); + self::assertStringContainsString('title="div compiling:', $render); self::assertRegExp('/div formatting\s*
\s*[\.\d]+[µm]?s/', $render); - self::assertContains('title="div formatting:', $render); + self::assertStringContainsString('title="div formatting:', $render); self::assertRegExp('/div rendering\s*
\s*[\.\d]+[µm]?s/', $render); - self::assertContains('title="div rendering:', $render); + self::assertStringContainsString('title="div rendering:', $render); } /** @@ -217,7 +217,7 @@ public function testExecutionMaxTime() $message = $exception->getMessage(); } - self::assertContains('execution_max_time of 3ms exceeded.', $message); + self::assertStringContainsString('execution_max_time of 3ms exceeded.', $message); } /** @@ -267,7 +267,7 @@ public function testMemoryLimit() unset($GLOBALS['LAkjdJHSmlakSJHGdjAJGdjGAHgsjHDAD']); - self::assertContains('memory_limit of '.$limit.'B exceeded.', $message); + self::assertStringContainsString('memory_limit of '.$limit.'B exceeded.', $message); } /** @@ -288,16 +288,16 @@ public function testTokenDump() ]); $render = $renderer->render("a(href='a')\n | Hello\ndiv"); - self::assertContains('↩', $render); - self::assertContains('new line', $render); - self::assertContains('→', $render); - self::assertContains('indent', $render); - self::assertContains('←', $render); - self::assertContains('outdent', $render); - self::assertContains('(', $render); - self::assertContains('attributes start', $render); - self::assertContains(')', $render); - self::assertContains('attributes end', $render); + self::assertStringContainsString('↩', $render); + self::assertStringContainsString('new line', $render); + self::assertStringContainsString('→', $render); + self::assertStringContainsString('indent', $render); + self::assertStringContainsString('←', $render); + self::assertStringContainsString('outdent', $render); + self::assertStringContainsString('(', $render); + self::assertStringContainsString('attributes start', $render); + self::assertStringContainsString(')', $render); + self::assertStringContainsString('attributes end', $render); } /** @@ -342,16 +342,16 @@ public function testDisplayProfiler() ob_end_clean(); self::assertRegExp('/div lexing\s*
\s*[\.\d]+[µm]?s/', $contents); - self::assertContains('title="div lexing:', $contents); + self::assertStringContainsString('title="div lexing:', $contents); self::assertRegExp('/div parsing\s*
\s*[\.\d]+[µm]?s/', $contents); - self::assertContains('title="div parsing:', $contents); + self::assertStringContainsString('title="div parsing:', $contents); self::assertRegExp('/div compiling\s*
\s*[\.\d]+[µm]?s/', $contents); - self::assertContains('title="div compiling:', $contents); + self::assertStringContainsString('title="div compiling:', $contents); self::assertRegExp('/div formatting\s*
\s*[+-]?[\.\d]+[µm]?s/', $contents); - self::assertContains('title="div formatting:', $contents); + self::assertStringContainsString('title="div formatting:', $contents); self::assertRegExp('/div rendering\s*
\s*[\.\d]+[µm]?s/', $contents); - self::assertContains('title="div rendering:', $contents); - self::assertContains('-void-dump-', $contents); + self::assertStringContainsString('title="div rendering:', $contents); + self::assertStringContainsString('-void-dump-', $contents); } /** @@ -401,7 +401,7 @@ public function testCustomDump() $render = $renderer->render('div'); - self::assertContains('Phug\\Compiler\\Event\\NodeEvent', $render); + self::assertStringContainsString('Phug\\Compiler\\Event\\NodeEvent', $render); } /** diff --git a/tests/Phug/RendererTest.php b/tests/Phug/RendererTest.php index c26be0cf..d1743c0c 100644 --- a/tests/Phug/RendererTest.php +++ b/tests/Phug/RendererTest.php @@ -258,8 +258,8 @@ public function testBasedir() ]); $paths = $renderer->getCompiler()->getOption('paths'); self::assertCount(2, $paths); - self::assertContains('a', $paths); - self::assertContains('b', $paths); + self::assertStringContainsString('a', $paths); + self::assertStringContainsString('b', $paths); } /** @@ -478,12 +478,12 @@ public function testHandleErrorInString() $message = $error->getMessage(); } - self::assertContains( + self::assertStringContainsString( 'Division by zero', $message ); - self::assertNotContains( + self::assertStringNotContainsString( 'trigger_error("Division'.'by'.'zero")', str_replace(' ', '', $message) ); @@ -497,12 +497,12 @@ public function testHandleErrorInString() $message = $error->getMessage(); } - self::assertContains( + self::assertStringContainsString( 'Division by zero on line 1', $message ); - self::assertContains( + self::assertStringContainsString( 'trigger_error("Division'.'by'.'zero")', str_replace(' ', '', $message) ); @@ -516,12 +516,12 @@ public function testHandleErrorInString() $message = $error->getMessage(); } - self::assertContains( + self::assertStringContainsString( 'Division by zero on line 1', $message ); - self::assertContains( + self::assertStringContainsString( "\033[43;30m> 1 | div: p\033[43;31m=\033[43;30mtrigger_error(\"Division by zero\")\e[0m\n", $message ); @@ -575,18 +575,18 @@ public function testContextLines() $message = $error->getMessage(); } - self::assertContains('Division by zero', $message); - self::assertContains('div: p=12/0', $message); - self::assertContains('// line -1', $message); - self::assertContains('// line +1', $message); - self::assertContains('// line -2', $message); - self::assertContains('// line +2', $message); - self::assertContains('// line -3', $message); - self::assertContains('// line +3', $message); - self::assertNotContains('// line -4', $message); - self::assertNotContains('// line +4', $message); - self::assertNotContains('// line -5', $message); - self::assertNotContains('// line +5', $message); + self::assertStringContainsString('Division by zero', $message); + self::assertStringContainsString('div: p=12/0', $message); + self::assertStringContainsString('// line -1', $message); + self::assertStringContainsString('// line +1', $message); + self::assertStringContainsString('// line -2', $message); + self::assertStringContainsString('// line +2', $message); + self::assertStringContainsString('// line -3', $message); + self::assertStringContainsString('// line +3', $message); + self::assertStringNotContainsString('// line -4', $message); + self::assertStringNotContainsString('// line +4', $message); + self::assertStringNotContainsString('// line -5', $message); + self::assertStringNotContainsString('// line +5', $message); } /** @@ -624,17 +624,17 @@ public function testHandleErrorInFile() $renderer->renderFile($path); $message = str_replace('implode(): Invalid arguments passed', 'array, string given', $message ?: ''); - self::assertContains( + self::assertStringContainsString( 'array, string given', $message ); - self::assertNotContains( + self::assertStringNotContainsString( 'on line 3', $message ); - self::assertNotContains( + self::assertStringNotContainsString( $path, $message ); @@ -644,17 +644,17 @@ public function testHandleErrorInFile() $renderer->renderFile($path); $message = str_replace('implode(): Invalid arguments passed', 'array, string given', $message ?: ''); - self::assertContains( + self::assertStringContainsString( 'array, string given on line 3, offset 2', $message ); - self::assertContains( + self::assertStringContainsString( $path, $message ); - self::assertContains( + self::assertStringContainsString( "implode('','')", $message ); @@ -814,8 +814,8 @@ public function testHandleHtmlError() /* @var RendererException $lastError */ self::assertInstanceOf(RendererException::class, $lastError); $message = $lastError->getMessage(); - self::assertContains('Division by zero on line 1, offset 7', $message); - self::assertContains(''. + self::assertStringContainsString('Division by zero on line 1, offset 7', $message); + self::assertStringContainsString(''. 'div: p=12/0', $message); } } @@ -884,10 +884,10 @@ public function testHandleParseError() $message = $error->getMessage(); } - self::assertContains('ParseError:', $message); - self::assertContains(' on line 12, offset 12', $message); - self::assertContains('title Foo', $message); - self::assertNotContains('Too far to be visible error context', $message); + self::assertStringContainsString('ParseError:', $message); + self::assertStringContainsString(' on line 12, offset 12', $message); + self::assertStringContainsString('title Foo', $message); + self::assertStringNotContainsString('Too far to be visible error context', $message); } public function testHeadIndent() diff --git a/tests/Phug/Util/SandBoxTest.php b/tests/Phug/Util/SandBoxTest.php index 5e5ab6fe..5cb780f0 100644 --- a/tests/Phug/Util/SandBoxTest.php +++ b/tests/Phug/Util/SandBoxTest.php @@ -62,7 +62,7 @@ public function testError() }); self::assertInstanceOf(Exception::class, $sandBox->getThrowable()); - self::assertContains('Division by zero', $sandBox->getThrowable()->getMessage()); + self::assertStringContainsString('Division by zero', $sandBox->getThrowable()->getMessage()); self::assertNull($sandBox->getResult()); self::assertSame('foo', $sandBox->getBuffer()); @@ -77,7 +77,7 @@ public function testError() }); self::assertInstanceOf(Exception::class, $sandBox->getThrowable()); - self::assertContains('Notice', $sandBox->getThrowable()->getMessage()); + self::assertStringContainsString('Notice', $sandBox->getThrowable()->getMessage()); $level = error_reporting();