From dfc1c566258502410653b0f616ad5cdd34a3de80 Mon Sep 17 00:00:00 2001 From: Koji Tanaka Date: Fri, 30 Dec 2022 17:53:58 +0900 Subject: [PATCH] test: Replace assertContains() with assertStringContainsString() for text assertion. assertContains() can no longer be used for text containment assertion. --- .../Console/Command/CommandListShellTest.php | 6 +- .../Case/Console/Command/SchemaShellTest.php | 2 +- .../Command/Task/ControllerTaskTest.php | 12 +- .../Console/Command/Task/ExtractTaskTest.php | 46 ++-- .../Console/Command/Task/FixtureTaskTest.php | 44 ++-- .../Console/Command/Task/ModelTaskTest.php | 10 +- .../Console/Command/Task/TestTaskTest.php | 84 ++++---- .../Test/Case/Console/HelpFormatterTest.php | 4 +- lib/Cake/Test/Case/Console/ShellTest.php | 2 +- .../Controller/ApplicationControllerTest.php | 2 +- .../Component/EmailComponentTest.php | 4 +- lib/Cake/Test/Case/Core/ConfigureTest.php | 10 +- lib/Cake/Test/Case/Error/ErrorHandlerTest.php | 18 +- .../Test/Case/Error/ExceptionRendererTest.php | 24 +-- lib/Cake/Test/Case/Log/CakeLogTest.php | 18 +- .../Test/Case/Log/Engine/ConsoleLogTest.php | 4 +- .../Model/Datasource/Database/MysqlTest.php | 74 +++---- .../Datasource/Database/PostgresTest.php | 10 +- .../Model/Datasource/Database/SqliteTest.php | 2 +- .../Case/Model/Datasource/DboSourceTest.php | 8 +- .../Test/Case/Model/ModelIntegrationTest.php | 32 +-- .../Test/Case/Network/Email/CakeEmailTest.php | 128 +++++------ .../Case/Network/Email/MailTransportTest.php | 4 +- .../Test/Case/Network/Http/HttpSocketTest.php | 6 +- .../Test/Case/TestSuite/CakeTestCaseTest.php | 2 +- .../Case/TestSuite/ControllerTestCaseTest.php | 12 +- lib/Cake/Test/Case/Utility/DebuggerTest.php | 26 +-- lib/Cake/Test/Case/Utility/FileTest.php | 4 +- lib/Cake/Test/Case/Utility/XmlTest.php | 2 +- .../Test/Case/View/Helper/FlashHelperTest.php | 12 +- .../Test/Case/View/Helper/FormHelperTest.php | 198 +++++++++--------- lib/Cake/Test/Case/View/ScaffoldViewTest.php | 14 +- lib/Cake/Test/Case/View/ThemeViewTest.php | 4 +- lib/Cake/Test/Case/View/ViewTest.php | 8 +- 34 files changed, 418 insertions(+), 418 deletions(-) diff --git a/lib/Cake/Test/Case/Console/Command/CommandListShellTest.php b/lib/Cake/Test/Case/Console/Command/CommandListShellTest.php index aafbab65b..2032af3f6 100644 --- a/lib/Cake/Test/Case/Console/Command/CommandListShellTest.php +++ b/lib/Cake/Test/Case/Console/Command/CommandListShellTest.php @@ -122,12 +122,12 @@ class CommandListShellTest extends CakeTestCase { $output = $this->Shell->stdout->output; $find = ''; - $this->assertContains($find, $output); + $this->assertStringContainsString($find, $output); $find = ''; - $this->assertContains($find, $output); + $this->assertStringContainsString($find, $output); $find = ''; - $this->assertContains($find, $output); + $this->assertStringContainsString($find, $output); } } diff --git a/lib/Cake/Test/Case/Console/Command/SchemaShellTest.php b/lib/Cake/Test/Case/Console/Command/SchemaShellTest.php index 206fec074..c6ced8e2f 100644 --- a/lib/Cake/Test/Case/Console/Command/SchemaShellTest.php +++ b/lib/Cake/Test/Case/Console/Command/SchemaShellTest.php @@ -421,7 +421,7 @@ class SchemaShellTest extends CakeTestCase { $this->assertNotContains('public $acos = array(', $contents); $this->assertNotContains('public $aros = array(', $contents); - $this->assertContains('public $aros_acos = array(', $contents); + $this->assertStringContainsString('public $aros_acos = array(', $contents); } /** diff --git a/lib/Cake/Test/Case/Console/Command/Task/ControllerTaskTest.php b/lib/Cake/Test/Case/Console/Command/Task/ControllerTaskTest.php index 1a5df731a..d18e59d77 100644 --- a/lib/Cake/Test/Case/Console/Command/Task/ControllerTaskTest.php +++ b/lib/Cake/Test/Case/Console/Command/Task/ControllerTaskTest.php @@ -320,7 +320,7 @@ class ControllerTaskTest extends CakeTestCase { $path = APP . 'Plugin' . DS . 'ControllerTest' . DS . 'Controller' . DS . 'ArticlesController.php'; $result = $this->Task->bake('Articles', '--actions--', array(), array(), array()); - $this->assertContains("App::uses('ControllerTestAppController', 'ControllerTest.Controller');", $result); + $this->assertStringContainsString("App::uses('ControllerTestAppController', 'ControllerTest.Controller');", $result); $this->assertEquals('ControllerTest', $this->Task->Template->templateVars['plugin']); $this->assertEquals('ControllerTest.', $this->Task->Template->templateVars['pluginPath']); @@ -338,11 +338,11 @@ class ControllerTaskTest extends CakeTestCase { $this->assertTextEquals($expected, $result); $result = $this->Task->bakeActions('BakeArticles', 'admin_', true); - $this->assertContains('function admin_index() {', $result); - $this->assertContains('function admin_add()', $result); - $this->assertContains('function admin_view($id = null)', $result); - $this->assertContains('function admin_edit($id = null)', $result); - $this->assertContains('function admin_delete($id = null)', $result); + $this->assertStringContainsString('function admin_index() {', $result); + $this->assertStringContainsString('function admin_add()', $result); + $this->assertStringContainsString('function admin_view($id = null)', $result); + $this->assertStringContainsString('function admin_edit($id = null)', $result); + $this->assertStringContainsString('function admin_delete($id = null)', $result); } /** diff --git a/lib/Cake/Test/Case/Console/Command/Task/ExtractTaskTest.php b/lib/Cake/Test/Case/Console/Command/Task/ExtractTaskTest.php index 467bb8d6b..cd6fb64fc 100644 --- a/lib/Cake/Test/Case/Console/Command/Task/ExtractTaskTest.php +++ b/lib/Cake/Test/Case/Console/Command/Task/ExtractTaskTest.php @@ -159,8 +159,8 @@ class ExtractTaskTest extends CakeTestCase { $pattern .= '"\nmsgstr ""/'; $this->assertMatchesRegularExpression($pattern, $result); - $this->assertContains('msgid "double \\"quoted\\""', $result, 'Strings with quotes not handled correctly'); - $this->assertContains("msgid \"single 'quoted'\"", $result, 'Strings with quotes not handled correctly'); + $this->assertStringContainsString('msgid "double \\"quoted\\""', $result, 'Strings with quotes not handled correctly'); + $this->assertStringContainsString("msgid \"single 'quoted'\"", $result, 'Strings with quotes not handled correctly'); $pattern = '/\#: extract\.ctp:36\nmsgid "letter"/'; $this->assertMatchesRegularExpression($pattern, $result, 'Strings with context should not overwrite strings without context'); @@ -349,9 +349,9 @@ class ExtractTaskTest extends CakeTestCase { $this->Task->execute(); $result = file_get_contents($this->path . DS . 'default.pot'); $this->assertDoesNotMatchRegularExpression('#Pages#', $result); - $this->assertContains('translate.ctp:1', $result); - $this->assertContains('This is a translatable string', $result); - $this->assertContains('I can haz plugin model validation message', $result); + $this->assertStringContainsString('translate.ctp:1', $result); + $this->assertStringContainsString('This is a translatable string', $result); + $this->assertStringContainsString('I can haz plugin model validation message', $result); } /** @@ -380,14 +380,14 @@ class ExtractTaskTest extends CakeTestCase { $this->Task->execute(); $result = file_get_contents($this->path . DS . 'default.pot'); - $this->assertContains('Model/PersisterOne.php:validation for field title', $result); - $this->assertContains('Model/PersisterOne.php:validation for field body', $result); - $this->assertContains('msgid "Post title is required"', $result); - $this->assertContains('msgid "You may enter up to %s chars (minimum is %s chars)"', $result); - $this->assertContains('msgid "Post body is required"', $result); - $this->assertContains('msgid "Post body is super required"', $result); - $this->assertContains('msgid "double \\"quoted\\" validation"', $result, 'Strings with quotes not handled correctly'); - $this->assertContains("msgid \"single 'quoted' validation\"", $result, 'Strings with quotes not handled correctly'); + $this->assertStringContainsString('Model/PersisterOne.php:validation for field title', $result); + $this->assertStringContainsString('Model/PersisterOne.php:validation for field body', $result); + $this->assertStringContainsString('msgid "Post title is required"', $result); + $this->assertStringContainsString('msgid "You may enter up to %s chars (minimum is %s chars)"', $result); + $this->assertStringContainsString('msgid "Post body is required"', $result); + $this->assertStringContainsString('msgid "Post body is super required"', $result); + $this->assertStringContainsString('msgid "double \\"quoted\\" validation"', $result, 'Strings with quotes not handled correctly'); + $this->assertStringContainsString("msgid \"single 'quoted' validation\"", $result, 'Strings with quotes not handled correctly'); } /** @@ -416,11 +416,11 @@ class ExtractTaskTest extends CakeTestCase { $this->Task->execute(); $result = file_get_contents($this->path . DS . 'test_plugin.pot'); - $this->assertContains('Plugin/TestPlugin/Model/TestPluginPost.php:validation for field title', $result); - $this->assertContains('Plugin/TestPlugin/Model/TestPluginPost.php:validation for field body', $result); - $this->assertContains('msgid "Post title is required"', $result); - $this->assertContains('msgid "Post body is required"', $result); - $this->assertContains('msgid "Post body is super required"', $result); + $this->assertStringContainsString('Plugin/TestPlugin/Model/TestPluginPost.php:validation for field title', $result); + $this->assertStringContainsString('Plugin/TestPlugin/Model/TestPluginPost.php:validation for field body', $result); + $this->assertStringContainsString('msgid "Post title is required"', $result); + $this->assertStringContainsString('msgid "Post body is required"', $result); + $this->assertStringContainsString('msgid "Post body is super required"', $result); } /** @@ -445,11 +445,11 @@ class ExtractTaskTest extends CakeTestCase { $this->Task->execute(); $result = file_get_contents($this->path . DS . 'test_plugin.pot'); - $this->assertContains('Model/TestPluginPost.php:validation for field title', $result); - $this->assertContains('Model/TestPluginPost.php:validation for field body', $result); - $this->assertContains('msgid "Post title is required"', $result); - $this->assertContains('msgid "Post body is required"', $result); - $this->assertContains('msgid "Post body is super required"', $result); + $this->assertStringContainsString('Model/TestPluginPost.php:validation for field title', $result); + $this->assertStringContainsString('Model/TestPluginPost.php:validation for field body', $result); + $this->assertStringContainsString('msgid "Post title is required"', $result); + $this->assertStringContainsString('msgid "Post body is required"', $result); + $this->assertStringContainsString('msgid "Post body is super required"', $result); $this->assertNotContains('Plugin/TestPlugin/Model/TestPluginPost.php:validation for field title', $result); } diff --git a/lib/Cake/Test/Case/Console/Command/Task/FixtureTaskTest.php b/lib/Cake/Test/Case/Console/Command/Task/FixtureTaskTest.php index 49e4c5cf7..075526113 100644 --- a/lib/Cake/Test/Case/Console/Command/Task/FixtureTaskTest.php +++ b/lib/Cake/Test/Case/Console/Command/Task/FixtureTaskTest.php @@ -215,11 +215,11 @@ class FixtureTaskTest extends CakeTestCase { 'fromTable' => true, 'schema' => 'Article', 'records' => false )); - $this->assertContains('class ArticleFixture extends CakeTestFixture', $result); - $this->assertContains('public $records', $result); - $this->assertContains('public $import', $result); - $this->assertContains("'title' => 'First Article'", $result, 'Missing import data'); - $this->assertContains('Second Article', $result, 'Missing import data'); + $this->assertStringContainsString('class ArticleFixture extends CakeTestFixture', $result); + $this->assertStringContainsString('public $records', $result); + $this->assertStringContainsString('public $import', $result); + $this->assertStringContainsString("'title' => 'First Article'", $result, 'Missing import data'); + $this->assertStringContainsString('Second Article', $result, 'Missing import data'); } /** @@ -230,7 +230,7 @@ class FixtureTaskTest extends CakeTestCase { public function testImportOptionsAlternateConnection() { $this->Task->connection = 'test'; $result = $this->Task->bake('Article', false, array('schema' => 'Article')); - $this->assertContains("'connection' => 'test'", $result); + $this->assertStringContainsString("'connection' => 'test'", $result); } /** @@ -259,7 +259,7 @@ class FixtureTaskTest extends CakeTestCase { 'schema' => 'Article', 'records' => false )); - $this->assertContains("'body' => 'Body \"value\"'", $result, 'Data has bad escaping'); + $this->assertStringContainsString("'body' => 'Body \"value\"'", $result, 'Data has bad escaping'); } /** @@ -445,26 +445,26 @@ class FixtureTaskTest extends CakeTestCase { $this->Task->path = '/my/path/'; $result = $this->Task->bake('Article'); - $this->assertContains('class ArticleFixture extends CakeTestFixture', $result); - $this->assertContains('public $fields', $result); - $this->assertContains('public $records', $result); + $this->assertStringContainsString('class ArticleFixture extends CakeTestFixture', $result); + $this->assertStringContainsString('public $fields', $result); + $this->assertStringContainsString('public $records', $result); $this->assertNotContains('public $import', $result); $result = $this->Task->bake('Article', 'comments'); - $this->assertContains('class ArticleFixture extends CakeTestFixture', $result); - $this->assertContains('public $table = \'comments\';', $result); - $this->assertContains('public $fields = array(', $result); + $this->assertStringContainsString('class ArticleFixture extends CakeTestFixture', $result); + $this->assertStringContainsString('public $table = \'comments\';', $result); + $this->assertStringContainsString('public $fields = array(', $result); $result = $this->Task->bake('Article', 'comments', array('records' => true)); - $this->assertContains("public \$import = array('records' => true, 'connection' => 'test');", $result); + $this->assertStringContainsString("public \$import = array('records' => true, 'connection' => 'test');", $result); $this->assertNotContains('public $records', $result); $result = $this->Task->bake('Article', 'comments', array('schema' => 'Article')); - $this->assertContains("public \$import = array('model' => 'Article', 'connection' => 'test');", $result); + $this->assertStringContainsString("public \$import = array('model' => 'Article', 'connection' => 'test');", $result); $this->assertNotContains('public $fields', $result); $result = $this->Task->bake('Article', 'comments', array('schema' => 'Article', 'records' => true)); - $this->assertContains("public \$import = array('model' => 'Article', 'records' => true, 'connection' => 'test');", $result); + $this->assertStringContainsString("public \$import = array('model' => 'Article', 'records' => true, 'connection' => 'test');", $result); $this->assertNotContains('public $fields', $result); $this->assertNotContains('public $records', $result); } @@ -479,14 +479,14 @@ class FixtureTaskTest extends CakeTestCase { $this->Task->path = '/my/path/'; $result = $this->Task->bake('Article', 'datatypes'); - $this->assertContains("'float_field' => 1", $result); - $this->assertContains("'bool' => 1", $result); - $this->assertContains("'tiny_int' => 1", $result); - $this->assertContains("'small_int' => 1", $result); - $this->assertContains("'huge_int' => 1", $result); + $this->assertStringContainsString("'float_field' => 1", $result); + $this->assertStringContainsString("'bool' => 1", $result); + $this->assertStringContainsString("'tiny_int' => 1", $result); + $this->assertStringContainsString("'small_int' => 1", $result); + $this->assertStringContainsString("'huge_int' => 1", $result); $result = $this->Task->bake('Article', 'binary_tests'); - $this->assertContains("'data' => 'Lorem ipsum dolor sit amet'", $result); + $this->assertStringContainsString("'data' => 'Lorem ipsum dolor sit amet'", $result); } /** diff --git a/lib/Cake/Test/Case/Console/Command/Task/ModelTaskTest.php b/lib/Cake/Test/Case/Console/Command/Task/ModelTaskTest.php index fa5cacb40..8b5e1734d 100644 --- a/lib/Cake/Test/Case/Console/Command/Task/ModelTaskTest.php +++ b/lib/Cake/Test/Case/Console/Command/Task/ModelTaskTest.php @@ -911,10 +911,10 @@ STRINGEND; ) ); $result = $this->Task->bake('BakeArticle', compact('associations')); - $this->assertContains(' * @property BakeUser $BakeUser', $result); - $this->assertContains(' * @property OtherModel $OtherModel', $result); - $this->assertContains(' * @property BakeComment $BakeComment', $result); - $this->assertContains(' * @property BakeTag $BakeTag', $result); + $this->assertStringContainsString(' * @property BakeUser $BakeUser', $result); + $this->assertStringContainsString(' * @property OtherModel $OtherModel', $result); + $this->assertStringContainsString(' * @property BakeComment $BakeComment', $result); + $this->assertStringContainsString(' * @property BakeTag $BakeTag', $result); $this->assertMatchesRegularExpression('/\$hasAndBelongsToMany \= array\(/', $result); $this->assertMatchesRegularExpression('/\$hasMany \= array\(/', $result); $this->assertMatchesRegularExpression('/\$belongsTo \= array\(/', $result); @@ -940,7 +940,7 @@ STRINGEND; ->with($path, $this->stringContains('BakeArticle extends ControllerTestAppModel')); $result = $this->Task->bake('BakeArticle', array(), array()); - $this->assertContains("App::uses('ControllerTestAppModel', 'ControllerTest.Model');", $result); + $this->assertStringContainsString("App::uses('ControllerTestAppModel', 'ControllerTest.Model');", $result); $this->assertEquals(count(ClassRegistry::keys()), 0); $this->assertEquals(count(ClassRegistry::mapKeys()), 0); diff --git a/lib/Cake/Test/Case/Console/Command/Task/TestTaskTest.php b/lib/Cake/Test/Case/Console/Command/Task/TestTaskTest.php index c7c2b7d2c..d40b9948c 100644 --- a/lib/Cake/Test/Case/Console/Command/Task/TestTaskTest.php +++ b/lib/Cake/Test/Case/Console/Command/Task/TestTaskTest.php @@ -402,24 +402,24 @@ class TestTaskTest extends CakeTestCase { $result = $this->Task->bake('Model', 'TestTaskArticle'); - $this->assertContains("App::uses('TestTaskArticle', 'Model')", $result); - $this->assertContains('class TestTaskArticleTest extends CakeTestCase', $result); + $this->assertStringContainsString("App::uses('TestTaskArticle', 'Model')", $result); + $this->assertStringContainsString('class TestTaskArticleTest extends CakeTestCase', $result); - $this->assertContains('function setUp()', $result); - $this->assertContains("\$this->TestTaskArticle = ClassRegistry::init('TestTaskArticle')", $result); + $this->assertStringContainsString('function setUp()', $result); + $this->assertStringContainsString("\$this->TestTaskArticle = ClassRegistry::init('TestTaskArticle')", $result); - $this->assertContains('function tearDown()', $result); - $this->assertContains('unset($this->TestTaskArticle)', $result); + $this->assertStringContainsString('function tearDown()', $result); + $this->assertStringContainsString('unset($this->TestTaskArticle)', $result); - $this->assertContains('function testDoSomething()', $result); - $this->assertContains('function testDoSomethingElse()', $result); - $this->assertContains('$this->markTestIncomplete(\'testDoSomething not implemented.\')', $result); - $this->assertContains('$this->markTestIncomplete(\'testDoSomethingElse not implemented.\')', $result); + $this->assertStringContainsString('function testDoSomething()', $result); + $this->assertStringContainsString('function testDoSomethingElse()', $result); + $this->assertStringContainsString('$this->markTestIncomplete(\'testDoSomething not implemented.\')', $result); + $this->assertStringContainsString('$this->markTestIncomplete(\'testDoSomethingElse not implemented.\')', $result); - $this->assertContains("'app.test_task_article'", $result); - $this->assertContains("'app.test_task_comment'", $result); - $this->assertContains("'app.test_task_tag'", $result); - $this->assertContains("'app.articles_tag'", $result); + $this->assertStringContainsString("'app.test_task_article'", $result); + $this->assertStringContainsString("'app.test_task_comment'", $result); + $this->assertStringContainsString("'app.test_task_tag'", $result); + $this->assertStringContainsString("'app.articles_tag'", $result); } /** @@ -433,8 +433,8 @@ class TestTaskTest extends CakeTestCase { $result = $this->Task->bake('Controller', 'TestTaskComments'); - $this->assertContains("App::uses('TestTaskCommentsController', 'Controller')", $result); - $this->assertContains('class TestTaskCommentsControllerTest extends ControllerTestCase', $result); + $this->assertStringContainsString("App::uses('TestTaskCommentsController', 'Controller')", $result); + $this->assertStringContainsString('class TestTaskCommentsControllerTest extends ControllerTestCase', $result); $this->assertNotContains('function setUp()', $result); $this->assertNotContains("\$this->TestTaskComments = new TestTaskCommentsController()", $result); @@ -443,10 +443,10 @@ class TestTaskTest extends CakeTestCase { $this->assertNotContains('function tearDown()', $result); $this->assertNotContains('unset($this->TestTaskComments)', $result); - $this->assertContains("'app.test_task_article'", $result); - $this->assertContains("'app.test_task_comment'", $result); - $this->assertContains("'app.test_task_tag'", $result); - $this->assertContains("'app.articles_tag'", $result); + $this->assertStringContainsString("'app.test_task_article'", $result); + $this->assertStringContainsString("'app.test_task_comment'", $result); + $this->assertStringContainsString("'app.test_task_tag'", $result); + $this->assertStringContainsString("'app.articles_tag'", $result); } /** @@ -459,17 +459,17 @@ class TestTaskTest extends CakeTestCase { $result = $this->Task->bake('Component', 'Example'); - $this->assertContains("App::uses('Component', 'Controller')", $result); - $this->assertContains("App::uses('ComponentCollection', 'Controller')", $result); - $this->assertContains("App::uses('ExampleComponent', 'Controller/Component')", $result); - $this->assertContains('class ExampleComponentTest extends CakeTestCase', $result); + $this->assertStringContainsString("App::uses('Component', 'Controller')", $result); + $this->assertStringContainsString("App::uses('ComponentCollection', 'Controller')", $result); + $this->assertStringContainsString("App::uses('ExampleComponent', 'Controller/Component')", $result); + $this->assertStringContainsString('class ExampleComponentTest extends CakeTestCase', $result); - $this->assertContains('function setUp()', $result); - $this->assertContains("\$Collection = new ComponentCollection()", $result); - $this->assertContains("\$this->Example = new ExampleComponent(\$Collection)", $result); + $this->assertStringContainsString('function setUp()', $result); + $this->assertStringContainsString("\$Collection = new ComponentCollection()", $result); + $this->assertStringContainsString("\$this->Example = new ExampleComponent(\$Collection)", $result); - $this->assertContains('function tearDown()', $result); - $this->assertContains('unset($this->Example)', $result); + $this->assertStringContainsString('function tearDown()', $result); + $this->assertStringContainsString('unset($this->Example)', $result); } /** @@ -482,14 +482,14 @@ class TestTaskTest extends CakeTestCase { $result = $this->Task->bake('Behavior', 'Example'); - $this->assertContains("App::uses('ExampleBehavior', 'Model/Behavior')", $result); - $this->assertContains('class ExampleBehaviorTest extends CakeTestCase', $result); + $this->assertStringContainsString("App::uses('ExampleBehavior', 'Model/Behavior')", $result); + $this->assertStringContainsString('class ExampleBehaviorTest extends CakeTestCase', $result); - $this->assertContains('function setUp()', $result); - $this->assertContains("\$this->Example = new ExampleBehavior()", $result); + $this->assertStringContainsString('function setUp()', $result); + $this->assertStringContainsString("\$this->Example = new ExampleBehavior()", $result); - $this->assertContains('function tearDown()', $result); - $this->assertContains('unset($this->Example)', $result); + $this->assertStringContainsString('function tearDown()', $result); + $this->assertStringContainsString('unset($this->Example)', $result); } /** @@ -502,15 +502,15 @@ class TestTaskTest extends CakeTestCase { $result = $this->Task->bake('Helper', 'Example'); - $this->assertContains("App::uses('ExampleHelper', 'View/Helper')", $result); - $this->assertContains('class ExampleHelperTest extends CakeTestCase', $result); + $this->assertStringContainsString("App::uses('ExampleHelper', 'View/Helper')", $result); + $this->assertStringContainsString('class ExampleHelperTest extends CakeTestCase', $result); - $this->assertContains('function setUp()', $result); - $this->assertContains("\$View = new View()", $result); - $this->assertContains("\$this->Example = new ExampleHelper(\$View)", $result); + $this->assertStringContainsString('function setUp()', $result); + $this->assertStringContainsString("\$View = new View()", $result); + $this->assertStringContainsString("\$this->Example = new ExampleHelper(\$View)", $result); - $this->assertContains('function tearDown()', $result); - $this->assertContains('unset($this->Example)', $result); + $this->assertStringContainsString('function tearDown()', $result); + $this->assertStringContainsString('unset($this->Example)', $result); } /** diff --git a/lib/Cake/Test/Case/Console/HelpFormatterTest.php b/lib/Cake/Test/Case/Console/HelpFormatterTest.php index 1b63bce9b..ddc2dca24 100644 --- a/lib/Cake/Test/Case/Console/HelpFormatterTest.php +++ b/lib/Cake/Test/Case/Console/HelpFormatterTest.php @@ -252,7 +252,7 @@ TEXT; $formatter = new HelpFormatter($parser); $result = $formatter->text(); $expected = 'cake mycommand [options] []'; - $this->assertContains($expected, $result); + $this->assertStringContainsString($expected, $result); } /** @@ -276,7 +276,7 @@ TEXT; $formatter = new HelpFormatter($parser); $result = $formatter->text(); $expected = 'cake mycommand [-h] [arguments]'; - $this->assertContains($expected, $result); + $this->assertStringContainsString($expected, $result); } /** diff --git a/lib/Cake/Test/Case/Console/ShellTest.php b/lib/Cake/Test/Case/Console/ShellTest.php index 05e58d8f9..3f4da6ed1 100644 --- a/lib/Cake/Test/Case/Console/ShellTest.php +++ b/lib/Cake/Test/Case/Console/ShellTest.php @@ -965,7 +965,7 @@ TEXT; $this->Shell->log_something(); $this->assertTrue(file_exists(LOGS . 'error.log')); $contents = file_get_contents(LOGS . 'error.log'); - $this->assertContains($this->Shell->testMessage, $contents); + $this->assertStringContainsString($this->Shell->testMessage, $contents); CakeLog::enable('stdout'); CakeLog::enable('stderr'); diff --git a/lib/Cake/Test/Case/Controller/ApplicationControllerTest.php b/lib/Cake/Test/Case/Controller/ApplicationControllerTest.php index 52c7e9108..6c658b6d0 100644 --- a/lib/Cake/Test/Case/Controller/ApplicationControllerTest.php +++ b/lib/Cake/Test/Case/Controller/ApplicationControllerTest.php @@ -79,7 +79,7 @@ class ApplicationControllerTest extends ControllerTestCase { public function testRedirect() { $sessionId = 'o7k64tlhil9pakp89j6d8ovlqk'; $this->testAction('/trans_session_id/next?CAKEPHP=' . $sessionId); - $this->assertContains('/trans_session_id/next_step?CAKEPHP=' . $sessionId, $this->headers['Location']); + $this->assertStringContainsString('/trans_session_id/next_step?CAKEPHP=' . $sessionId, $this->headers['Location']); $expectedConfig = array( 'cookie' => 'CAKEPHP', 'timeout' => 240, diff --git a/lib/Cake/Test/Case/Controller/Component/EmailComponentTest.php b/lib/Cake/Test/Case/Controller/Component/EmailComponentTest.php index 8b2c9d03c..107cba090 100644 --- a/lib/Cake/Test/Case/Controller/Component/EmailComponentTest.php +++ b/lib/Cake/Test/Case/Controller/Component/EmailComponentTest.php @@ -900,8 +900,8 @@ HTMLBLOC; $this->assertTrue($this->Controller->EmailTest->send('This is the body of the message')); $result = DebugCompTransport::$lastEmail; - $this->assertContains('From: =?UTF-8?B?VGXDn3Qg?= ', $result); - $this->assertContains('To: =?UTF-8?B?VGXDn3Qg?= ', $result); + $this->assertStringContainsString('From: =?UTF-8?B?VGXDn3Qg?= ', $result); + $this->assertStringContainsString('To: =?UTF-8?B?VGXDn3Qg?= ', $result); } } diff --git a/lib/Cake/Test/Case/Core/ConfigureTest.php b/lib/Cake/Test/Case/Core/ConfigureTest.php index 435cf4a05..ca92df85c 100644 --- a/lib/Cake/Test/Case/Core/ConfigureTest.php +++ b/lib/Cake/Test/Case/Core/ConfigureTest.php @@ -503,8 +503,8 @@ class ConfigureTest extends CakeTestCase { $result = Configure::dump('config_test.php', 'test_reader'); $this->assertTrue($result > 0); $result = file_get_contents(TMP . 'config_test.php'); - $this->assertContains('assertContains('$config = ', $result); + $this->assertStringContainsString('assertStringContainsString('$config = ', $result); if (file_exists(TMP . 'config_test.php')) { unlink(TMP . 'config_test.php'); } @@ -521,9 +521,9 @@ class ConfigureTest extends CakeTestCase { $result = Configure::dump('config_test.php', 'test_reader', array('Error')); $this->assertTrue($result > 0); $result = file_get_contents(TMP . 'config_test.php'); - $this->assertContains('assertContains('$config = ', $result); - $this->assertContains('Error', $result); + $this->assertStringContainsString('assertStringContainsString('$config = ', $result); + $this->assertStringContainsString('Error', $result); $this->assertNotContains('debug', $result); if (file_exists(TMP . 'config_test.php')) { diff --git a/lib/Cake/Test/Case/Error/ErrorHandlerTest.php b/lib/Cake/Test/Case/Error/ErrorHandlerTest.php index c729c7901..f4ad98789 100644 --- a/lib/Cake/Test/Case/Error/ErrorHandlerTest.php +++ b/lib/Cake/Test/Case/Error/ErrorHandlerTest.php @@ -240,8 +240,8 @@ class ErrorHandlerTest extends CakeTestCase { $this->assertMatchesRegularExpression('/Kaboom!/', $result, 'message missing.'); $log = file(LOGS . 'error.log'); - $this->assertContains('[NotFoundException] Kaboom!', $log[0], 'message missing.'); - $this->assertContains('ErrorHandlerTest->testHandleExceptionLog', $log[2], 'Stack trace missing.'); + $this->assertStringContainsString('[NotFoundException] Kaboom!', $log[0], 'message missing.'); + $this->assertStringContainsString('ErrorHandlerTest->testHandleExceptionLog', $log[2], 'Stack trace missing.'); } /** @@ -270,7 +270,7 @@ class ErrorHandlerTest extends CakeTestCase { $log = file(LOGS . 'error.log'); $this->assertNotContains('[NotFoundException] Kaboom!', $log[0], 'message should not be logged.'); - $this->assertContains('[ForbiddenException] Fooled you!', $log[0], 'message missing.'); + $this->assertStringContainsString('[ForbiddenException] Fooled you!', $log[0], 'message missing.'); } /** @@ -309,9 +309,9 @@ class ErrorHandlerTest extends CakeTestCase { Configure::write('debug', 1); ErrorHandler::handleFatalError(E_ERROR, 'Something wrong', __FILE__, $line); $result = ob_get_clean(); - $this->assertContains('Something wrong', $result, 'message missing.'); - $this->assertContains(__FILE__, $result, 'filename missing.'); - $this->assertContains((string)$line, $result, 'line missing.'); + $this->assertStringContainsString('Something wrong', $result, 'message missing.'); + $this->assertStringContainsString(__FILE__, $result, 'filename missing.'); + $this->assertStringContainsString((string)$line, $result, 'line missing.'); ob_start(); ob_start(); @@ -320,7 +320,7 @@ class ErrorHandlerTest extends CakeTestCase { $result = ob_get_clean(); $this->assertNotContains('Something wrong', $result, 'message must not appear.'); $this->assertNotContains(__FILE__, $result, 'filename must not appear.'); - $this->assertContains('An Internal Error Has Occurred', $result); + $this->assertStringContainsString('An Internal Error Has Occurred', $result); } /** @@ -338,8 +338,8 @@ class ErrorHandlerTest extends CakeTestCase { ob_clean(); $log = file(LOGS . 'error.log'); - $this->assertContains(__FILE__, $log[0], 'missing filename'); - $this->assertContains('[FatalErrorException] Something wrong', $log[1], 'message missing.'); + $this->assertStringContainsString(__FILE__, $log[0], 'missing filename'); + $this->assertStringContainsString('[FatalErrorException] Something wrong', $log[1], 'message missing.'); } /** diff --git a/lib/Cake/Test/Case/Error/ExceptionRendererTest.php b/lib/Cake/Test/Case/Error/ExceptionRendererTest.php index 4dbcc8472..4caf69791 100644 --- a/lib/Cake/Test/Case/Error/ExceptionRendererTest.php +++ b/lib/Cake/Test/Case/Error/ExceptionRendererTest.php @@ -298,7 +298,7 @@ class ExceptionRendererTest extends CakeTestCase { ob_start(); $renderer->render(); $result = ob_get_clean(); - $this->assertContains('peeled', $result); + $this->assertStringContainsString('peeled', $result); } /** @@ -318,7 +318,7 @@ class ExceptionRendererTest extends CakeTestCase { $this->assertFalse(method_exists($ExceptionRenderer, 'missingWidgetThing'), 'no method should exist.'); $this->assertEquals('error400', $ExceptionRenderer->method, 'incorrect method coercion.'); - $this->assertContains('coding fail', $result, 'Text should show up.'); + $this->assertStringContainsString('coding fail', $result, 'Text should show up.'); } /** @@ -339,7 +339,7 @@ class ExceptionRendererTest extends CakeTestCase { $result = ob_get_clean(); $this->assertEquals('error500', $ExceptionRenderer->method, 'incorrect method coercion.'); - $this->assertContains('foul ball.', $result, 'Text should show up as its debug mode.'); + $this->assertStringContainsString('foul ball.', $result, 'Text should show up as its debug mode.'); } /** @@ -363,7 +363,7 @@ class ExceptionRendererTest extends CakeTestCase { $this->assertEquals('error500', $ExceptionRenderer->method, 'incorrect method coercion.'); $this->assertNotContains('foul ball.', $result, 'Text should no show up.'); - $this->assertContains('Internal Error', $result, 'Generic message only.'); + $this->assertStringContainsString('Internal Error', $result, 'Generic message only.'); } /** @@ -382,7 +382,7 @@ class ExceptionRendererTest extends CakeTestCase { $result = ob_get_clean(); $this->assertEquals('error500', $ExceptionRenderer->method, 'incorrect method coercion.'); - $this->assertContains('foul ball.', $result, 'Text should show up as its debug mode.'); + $this->assertStringContainsString('foul ball.', $result, 'Text should show up as its debug mode.'); } /** @@ -423,7 +423,7 @@ class ExceptionRendererTest extends CakeTestCase { ob_start(); $ExceptionRenderer->render(); $result = ob_get_clean(); - $this->assertContains('Custom message', $result); + $this->assertStringContainsString('Custom message', $result); $exception = new MissingActionException(array('controller' => 'PostsController', 'action' => 'index')); $ExceptionRenderer = $this->_mockResponse(new ExceptionRenderer($exception)); @@ -431,7 +431,7 @@ class ExceptionRendererTest extends CakeTestCase { ob_start(); $ExceptionRenderer->render(); $result = ob_get_clean(); - $this->assertContains('Not Found', $result); + $this->assertStringContainsString('Not Found', $result); } /** @@ -853,7 +853,7 @@ class ExceptionRendererTest extends CakeTestCase { $ExceptionRenderer->render(); $result = ob_get_clean(); - $this->assertContains('Internal Error', $result); + $this->assertStringContainsString('Internal Error', $result); } /** @@ -873,10 +873,10 @@ class ExceptionRendererTest extends CakeTestCase { $ExceptionRenderer->render(); $result = ob_get_clean(); - $this->assertContains('

Database Error

', $result); - $this->assertContains('There was an error in the SQL query', $result); - $this->assertContains(h('SELECT * from poo_query < 5 and :seven'), $result); - $this->assertContains("'seven' => (int) 7", $result); + $this->assertStringContainsString('

Database Error

', $result); + $this->assertStringContainsString('There was an error in the SQL query', $result); + $this->assertStringContainsString(h('SELECT * from poo_query < 5 and :seven'), $result); + $this->assertStringContainsString("'seven' => (int) 7", $result); } /** diff --git a/lib/Cake/Test/Case/Log/CakeLogTest.php b/lib/Cake/Test/Case/Log/CakeLogTest.php index c4ce2345a..6d30c864b 100644 --- a/lib/Cake/Test/Case/Log/CakeLogTest.php +++ b/lib/Cake/Test/Case/Log/CakeLogTest.php @@ -241,9 +241,9 @@ class CakeLogTest extends CakeTestCase { $this->assertTrue(file_exists(LOGS . 'spam.log')); $contents = file_get_contents(LOGS . 'spam.log'); - $this->assertContains('Debug: ' . $testMessage, $contents); + $this->assertStringContainsString('Debug: ' . $testMessage, $contents); $contents = file_get_contents(LOGS . 'eggs.log'); - $this->assertContains('Debug: ' . $testMessage, $contents); + $this->assertStringContainsString('Debug: ' . $testMessage, $contents); if (file_exists(LOGS . 'spam.log')) { unlink(LOGS . 'spam.log'); @@ -621,21 +621,21 @@ class CakeLogTest extends CakeTestCase { $testMessage = 'critical message'; CakeLog::critical($testMessage); $contents = file_get_contents(LOGS . 'error.log'); - $this->assertContains('Critical: ' . $testMessage, $contents); + $this->assertStringContainsString('Critical: ' . $testMessage, $contents); $this->assertFalse(file_exists(LOGS . 'debug.log')); $this->_deleteLogs(); $testMessage = 'error message'; CakeLog::error($testMessage); $contents = file_get_contents(LOGS . 'error.log'); - $this->assertContains('Error: ' . $testMessage, $contents); + $this->assertStringContainsString('Error: ' . $testMessage, $contents); $this->assertFalse(file_exists(LOGS . 'debug.log')); $this->_deleteLogs(); $testMessage = 'warning message'; CakeLog::warning($testMessage); $contents = file_get_contents(LOGS . 'error.log'); - $this->assertContains('Warning: ' . $testMessage, $contents); + $this->assertStringContainsString('Warning: ' . $testMessage, $contents); $this->assertFalse(file_exists(LOGS . 'debug.log')); $this->_deleteLogs(); @@ -656,7 +656,7 @@ class CakeLogTest extends CakeTestCase { $testMessage = 'debug message'; CakeLog::debug($testMessage); $contents = file_get_contents(LOGS . 'debug.log'); - $this->assertContains('Debug: ' . $testMessage, $contents); + $this->assertStringContainsString('Debug: ' . $testMessage, $contents); $this->assertFalse(file_exists(LOGS . 'error.log')); $this->_deleteLogs(); } @@ -709,7 +709,7 @@ class CakeLogTest extends CakeTestCase { CakeLog::defaultLevels(); $this->assertTrue(file_exists(LOGS . 'error.log')); $contents = file_get_contents(LOGS . 'error.log'); - $this->assertContains('Error: ' . $testMessage, $contents); + $this->assertStringContainsString('Error: ' . $testMessage, $contents); CakeLog::config('spam', array( 'engine' => 'File', @@ -728,7 +728,7 @@ class CakeLogTest extends CakeTestCase { $this->assertTrue(file_exists(LOGS . 'spam.log')); $this->assertTrue(file_exists(LOGS . 'eggs.log')); $contents = file_get_contents(LOGS . 'spam.log'); - $this->assertContains('Spam: ' . $testMessage, $contents); + $this->assertStringContainsString('Spam: ' . $testMessage, $contents); $testMessage = 'egg message'; CakeLog::write('eggs', $testMessage); @@ -736,7 +736,7 @@ class CakeLogTest extends CakeTestCase { $contents = file_get_contents(LOGS . 'spam.log'); $this->assertNotContains('Eggs: ' . $testMessage, $contents); $contents = file_get_contents(LOGS . 'eggs.log'); - $this->assertContains('Eggs: ' . $testMessage, $contents); + $this->assertStringContainsString('Eggs: ' . $testMessage, $contents); CakeLog::drop('spam'); CakeLog::drop('eggs'); diff --git a/lib/Cake/Test/Case/Log/Engine/ConsoleLogTest.php b/lib/Cake/Test/Case/Log/Engine/ConsoleLogTest.php index ab3f14590..1ba94b3a1 100644 --- a/lib/Cake/Test/Case/Log/Engine/ConsoleLogTest.php +++ b/lib/Cake/Test/Case/Log/Engine/ConsoleLogTest.php @@ -113,7 +113,7 @@ class ConsoleLogTest extends CakeTestCase { TestCakeLog::write(LOG_ERR, $message); $this->assertTrue(file_exists(LOGS . 'error.log'), 'error.log missing'); $logOutput = file_get_contents(LOGS . 'error.log'); - $this->assertContains($message, $logOutput); + $this->assertStringContainsString($message, $logOutput); // TestConsoleLog is only interested in `error` type $message = 'Test info message'; @@ -127,7 +127,7 @@ class ConsoleLogTest extends CakeTestCase { $logOutput = file_get_contents(LOGS . 'error.log'); $this->assertNotContains($message, $logOutput); $logOutput = file_get_contents(LOGS . 'debug.log'); - $this->assertContains($message, $logOutput); + $this->assertStringContainsString($message, $logOutput); } /** diff --git a/lib/Cake/Test/Case/Model/Datasource/Database/MysqlTest.php b/lib/Cake/Test/Case/Model/Datasource/Database/MysqlTest.php index 6fbc08df6..10a4d70d6 100644 --- a/lib/Cake/Test/Case/Model/Datasource/Database/MysqlTest.php +++ b/lib/Cake/Test/Case/Model/Datasource/Database/MysqlTest.php @@ -166,7 +166,7 @@ class MysqlTest extends CakeTestCase { $this->assertEquals('1234567.11', $result); $result = $this->db->value(123456.45464748, 'float'); - $this->assertContains('123456.454647', $result); + $this->assertStringContainsString('123456.454647', $result); $result = $this->db->value(0.987654321, 'float'); $this->assertEquals('0.987654321', (string)$result); @@ -552,10 +552,10 @@ class MysqlTest extends CakeTestCase { 'group2' => array('type' => 'integer', 'null' => true) ))); $result = $this->Dbo->createSchema($schemaA); - $this->assertContains('`id` int(11) DEFAULT 0 NOT NULL,', $result); - $this->assertContains('`name` varchar(50) NOT NULL,', $result); - $this->assertContains('`group1` int(11) DEFAULT NULL', $result); - $this->assertContains('`group2` int(11) DEFAULT NULL', $result); + $this->assertStringContainsString('`id` int(11) DEFAULT 0 NOT NULL,', $result); + $this->assertStringContainsString('`name` varchar(50) NOT NULL,', $result); + $this->assertStringContainsString('`group1` int(11) DEFAULT NULL', $result); + $this->assertStringContainsString('`group2` int(11) DEFAULT NULL', $result); //Test that the string is syntactically correct $query = $this->Dbo->getConnection()->prepare($result); @@ -577,11 +577,11 @@ class MysqlTest extends CakeTestCase { ))); $result = $this->Dbo->alterSchema($schemaB->compare($schemaA)); - $this->assertContains("ALTER TABLE $table", $result); - $this->assertContains('ADD KEY `name_idx` (`name`),', $result); - $this->assertContains('ADD KEY `group_idx` (`group1`),', $result); - $this->assertContains('ADD KEY `compound_idx` (`group1`, `group2`),', $result); - $this->assertContains('ADD PRIMARY KEY (`id`);', $result); + $this->assertStringContainsString("ALTER TABLE $table", $result); + $this->assertStringContainsString('ADD KEY `name_idx` (`name`),', $result); + $this->assertStringContainsString('ADD KEY `group_idx` (`group1`),', $result); + $this->assertStringContainsString('ADD KEY `compound_idx` (`group1`, `group2`),', $result); + $this->assertStringContainsString('ADD PRIMARY KEY (`id`);', $result); //Test that the string is syntactically correct $query = $this->Dbo->getConnection()->prepare($result); @@ -604,15 +604,15 @@ class MysqlTest extends CakeTestCase { ))); $result = $this->Dbo->alterSchema($schemaC->compare($schemaB)); - $this->assertContains("ALTER TABLE $table", $result); - $this->assertContains('DROP PRIMARY KEY,', $result); - $this->assertContains('DROP KEY `name_idx`,', $result); - $this->assertContains('DROP KEY `group_idx`,', $result); - $this->assertContains('DROP KEY `compound_idx`,', $result); - $this->assertContains('ADD KEY `id_name_idx` (`id`, `name`),', $result); - $this->assertContains('ADD UNIQUE KEY `name_idx` (`name`),', $result); - $this->assertContains('ADD KEY `group_idx` (`group2`),', $result); - $this->assertContains('ADD KEY `compound_idx` (`group2`, `group1`);', $result); + $this->assertStringContainsString("ALTER TABLE $table", $result); + $this->assertStringContainsString('DROP PRIMARY KEY,', $result); + $this->assertStringContainsString('DROP KEY `name_idx`,', $result); + $this->assertStringContainsString('DROP KEY `group_idx`,', $result); + $this->assertStringContainsString('DROP KEY `compound_idx`,', $result); + $this->assertStringContainsString('ADD KEY `id_name_idx` (`id`, `name`),', $result); + $this->assertStringContainsString('ADD UNIQUE KEY `name_idx` (`name`),', $result); + $this->assertStringContainsString('ADD KEY `group_idx` (`group2`),', $result); + $this->assertStringContainsString('ADD KEY `compound_idx` (`group2`, `group1`);', $result); $query = $this->Dbo->getConnection()->prepare($result); $this->assertEquals($query->queryString, $result); @@ -623,11 +623,11 @@ class MysqlTest extends CakeTestCase { // Drop the indexes $result = $this->Dbo->alterSchema($schemaA->compare($schemaC)); - $this->assertContains("ALTER TABLE $table", $result); - $this->assertContains('DROP KEY `name_idx`,', $result); - $this->assertContains('DROP KEY `group_idx`,', $result); - $this->assertContains('DROP KEY `compound_idx`,', $result); - $this->assertContains('DROP KEY `id_name_idx`;', $result); + $this->assertStringContainsString("ALTER TABLE $table", $result); + $this->assertStringContainsString('DROP KEY `name_idx`,', $result); + $this->assertStringContainsString('DROP KEY `group_idx`,', $result); + $this->assertStringContainsString('DROP KEY `compound_idx`,', $result); + $this->assertStringContainsString('DROP KEY `id_name_idx`;', $result); $query = $this->Dbo->getConnection()->prepare($result); $this->assertEquals($query->queryString, $result); @@ -687,10 +687,10 @@ class MysqlTest extends CakeTestCase { ) )); $result = $this->Dbo->alterSchema($schemaB->compare($schemaA)); - $this->assertContains('DEFAULT CHARSET=utf8', $result); - $this->assertContains('ENGINE=InnoDB', $result); - $this->assertContains('COLLATE=utf8_general_ci', $result); - $this->assertContains('COMMENT=\'Newly table added comment.\'', $result); + $this->assertStringContainsString('DEFAULT CHARSET=utf8', $result); + $this->assertStringContainsString('ENGINE=InnoDB', $result); + $this->assertStringContainsString('COLLATE=utf8_general_ci', $result); + $this->assertStringContainsString('COMMENT=\'Newly table added comment.\'', $result); $this->Dbo->rawQuery($result); $result = $this->Dbo->listDetailedSources($this->Dbo->fullTableName('altertest', false, false)); @@ -896,7 +896,7 @@ SQL; 'testdescribes' => $result )); $result = $this->Dbo->createSchema($schema); - $this->assertContains('`limit_date` timestamp NOT NULL,', $result); + $this->assertStringContainsString('`limit_date` timestamp NOT NULL,', $result); } /** @@ -934,7 +934,7 @@ SQL; 'testdescribes' => $result )); $result = $this->Dbo->createSchema($schema); - $this->assertContains('`limit_date` datetime NOT NULL,', $result); + $this->assertStringContainsString('`limit_date` datetime NOT NULL,', $result); } /** @@ -1007,8 +1007,8 @@ SQL; )); $result = $this->Dbo->createSchema($schema); - $this->assertContains('`role_id` int(11) NOT NULL,', $result); - $this->assertContains('`user_id` int(11) NOT NULL,', $result); + $this->assertStringContainsString('`role_id` int(11) NOT NULL,', $result); + $this->assertStringContainsString('`user_id` int(11) NOT NULL,', $result); } /** @@ -1026,7 +1026,7 @@ SQL; ) ); $result = $this->Dbo->createSchema($schema, 'no_indexes'); - $this->assertContains('PRIMARY KEY (`id`)', $result); + $this->assertStringContainsString('PRIMARY KEY (`id`)', $result); $this->assertNotContains('UNIQUE KEY', $result); $schema->tables = array( @@ -1040,8 +1040,8 @@ SQL; ) ); $result = $this->Dbo->createSchema($schema, 'primary_index'); - $this->assertContains('PRIMARY KEY (`id`)', $result); - $this->assertContains('UNIQUE KEY `some_index` (`data`)', $result); + $this->assertStringContainsString('PRIMARY KEY (`id`)', $result); + $this->assertStringContainsString('UNIQUE KEY `some_index` (`data`)', $result); $schema->tables = array( 'primary_flag_has_index' => array( @@ -1053,8 +1053,8 @@ SQL; ) ); $result = $this->Dbo->createSchema($schema, 'primary_flag_has_index'); - $this->assertContains('PRIMARY KEY (`id`)', $result); - $this->assertContains('UNIQUE KEY `some_index` (`data`)', $result); + $this->assertStringContainsString('PRIMARY KEY (`id`)', $result); + $this->assertStringContainsString('UNIQUE KEY `some_index` (`data`)', $result); } /** diff --git a/lib/Cake/Test/Case/Model/Datasource/Database/PostgresTest.php b/lib/Cake/Test/Case/Model/Datasource/Database/PostgresTest.php index 6796fc086..d68f5275d 100644 --- a/lib/Cake/Test/Case/Model/Datasource/Database/PostgresTest.php +++ b/lib/Cake/Test/Case/Model/Datasource/Database/PostgresTest.php @@ -568,8 +568,8 @@ class PostgresTest extends CakeTestCase { $this->assertDoesNotMatchRegularExpression('/timestamp DEFAULT/', $result); $this->assertMatchesRegularExpression('/\"full_length\"\s*text\s.*,/', $result); - $this->assertContains('timestamp ,', $result); - $this->assertContains('"huge_int" bigint NOT NULL,', $result); + $this->assertStringContainsString('timestamp ,', $result); + $this->assertStringContainsString('"huge_int" bigint NOT NULL,', $result); $db1->query('DROP TABLE ' . $db1->fullTableName('datatype_tests')); @@ -612,7 +612,7 @@ class PostgresTest extends CakeTestCase { ); $result = $db1->createSchema($schema, 'bigserial_tests'); - $this->assertContains('"id" bigserial NOT NULL,', $result); + $this->assertStringContainsString('"id" bigserial NOT NULL,', $result); $db1->query('DROP TABLE ' . $db1->fullTableName('bigserial_tests')); } @@ -864,8 +864,8 @@ class PostgresTest extends CakeTestCase { ) ) )); - $this->assertContains('RENAME "title" TO "subject";', $query); - $this->assertContains('ALTER COLUMN "subject" TYPE', $query); + $this->assertStringContainsString('RENAME "title" TO "subject";', $query); + $this->assertStringContainsString('ALTER COLUMN "subject" TYPE', $query); $this->assertNotContains(";\n\tALTER COLUMN \"subject\" TYPE", $query); $this->assertNotContains('ALTER COLUMN "title" TYPE "subject"', $query); } diff --git a/lib/Cake/Test/Case/Model/Datasource/Database/SqliteTest.php b/lib/Cake/Test/Case/Model/Datasource/Database/SqliteTest.php index ad2054343..86317eeb0 100644 --- a/lib/Cake/Test/Case/Model/Datasource/Database/SqliteTest.php +++ b/lib/Cake/Test/Case/Model/Datasource/Database/SqliteTest.php @@ -499,7 +499,7 @@ SQL; 'testdescribes' => $result )); $result = $this->Dbo->createSchema($schema); - $this->assertContains('"limit_date" timestamp NOT NULL', $result); + $this->assertStringContainsString('"limit_date" timestamp NOT NULL', $result); } /** diff --git a/lib/Cake/Test/Case/Model/Datasource/DboSourceTest.php b/lib/Cake/Test/Case/Model/Datasource/DboSourceTest.php index 4826304fb..2a31f0184 100644 --- a/lib/Cake/Test/Case/Model/Datasource/DboSourceTest.php +++ b/lib/Cake/Test/Case/Model/Datasource/DboSourceTest.php @@ -1248,10 +1248,10 @@ class DboSourceTest extends CakeTestCase { ); $result = $this->db->generateAssociationQuery($Article, null, null, null, null, $queryData, false); - $this->assertContains('SELECT', $result); - $this->assertContains('FROM', $result); - $this->assertContains('WHERE', $result); - $this->assertContains('ORDER', $result); + $this->assertStringContainsString('SELECT', $result); + $this->assertStringContainsString('FROM', $result); + $this->assertStringContainsString('WHERE', $result); + $this->assertStringContainsString('ORDER', $result); } /** diff --git a/lib/Cake/Test/Case/Model/ModelIntegrationTest.php b/lib/Cake/Test/Case/Model/ModelIntegrationTest.php index 12a4c4c14..30eeb92f3 100644 --- a/lib/Cake/Test/Case/Model/ModelIntegrationTest.php +++ b/lib/Cake/Test/Case/Model/ModelIntegrationTest.php @@ -1229,39 +1229,39 @@ class ModelIntegrationTest extends BaseModelTest { $TestModel = new Apple(); $TestModel->setDataSource('database1'); - $this->assertContains('aaa_apples', $this->db->fullTableName($TestModel)); - $this->assertContains('aaa_apples', $db1->fullTableName($TestModel)); - $this->assertContains('aaa_apples', $db2->fullTableName($TestModel)); + $this->assertStringContainsString('aaa_apples', $this->db->fullTableName($TestModel)); + $this->assertStringContainsString('aaa_apples', $db1->fullTableName($TestModel)); + $this->assertStringContainsString('aaa_apples', $db2->fullTableName($TestModel)); $TestModel->setDataSource('database2'); - $this->assertContains('bbb_apples', $this->db->fullTableName($TestModel)); - $this->assertContains('bbb_apples', $db1->fullTableName($TestModel)); - $this->assertContains('bbb_apples', $db2->fullTableName($TestModel)); + $this->assertStringContainsString('bbb_apples', $this->db->fullTableName($TestModel)); + $this->assertStringContainsString('bbb_apples', $db1->fullTableName($TestModel)); + $this->assertStringContainsString('bbb_apples', $db2->fullTableName($TestModel)); $TestModel = new Apple(); $TestModel->tablePrefix = 'custom_'; - $this->assertContains('custom_apples', $this->db->fullTableName($TestModel)); + $this->assertStringContainsString('custom_apples', $this->db->fullTableName($TestModel)); $TestModel->setDataSource('database1'); - $this->assertContains('custom_apples', $this->db->fullTableName($TestModel)); - $this->assertContains('custom_apples', $db1->fullTableName($TestModel)); + $this->assertStringContainsString('custom_apples', $this->db->fullTableName($TestModel)); + $this->assertStringContainsString('custom_apples', $db1->fullTableName($TestModel)); $TestModel = new Apple(); $TestModel->setDataSource('database1'); - $this->assertContains('aaa_apples', $this->db->fullTableName($TestModel)); + $this->assertStringContainsString('aaa_apples', $this->db->fullTableName($TestModel)); $TestModel->tablePrefix = ''; $TestModel->setDataSource('database2'); - $this->assertContains('apples', $db2->fullTableName($TestModel)); - $this->assertContains('apples', $db1->fullTableName($TestModel)); + $this->assertStringContainsString('apples', $db2->fullTableName($TestModel)); + $this->assertStringContainsString('apples', $db1->fullTableName($TestModel)); $TestModel->tablePrefix = null; $TestModel->setDataSource('database1'); - $this->assertContains('aaa_apples', $db2->fullTableName($TestModel)); - $this->assertContains('aaa_apples', $db1->fullTableName($TestModel)); + $this->assertStringContainsString('aaa_apples', $db2->fullTableName($TestModel)); + $this->assertStringContainsString('aaa_apples', $db1->fullTableName($TestModel)); $TestModel->tablePrefix = false; $TestModel->setDataSource('database2'); - $this->assertContains('apples', $db2->fullTableName($TestModel)); - $this->assertContains('apples', $db1->fullTableName($TestModel)); + $this->assertStringContainsString('apples', $db2->fullTableName($TestModel)); + $this->assertStringContainsString('apples', $db1->fullTableName($TestModel)); } /** diff --git a/lib/Cake/Test/Case/Network/Email/CakeEmailTest.php b/lib/Cake/Test/Case/Network/Email/CakeEmailTest.php index d4f939fe3..2d12c2e5a 100644 --- a/lib/Cake/Test/Case/Network/Email/CakeEmailTest.php +++ b/lib/Cake/Test/Case/Network/Email/CakeEmailTest.php @@ -232,7 +232,7 @@ class CakeEmailTest extends CakeTestCase { ->transport('Debug'); $result = $this->CakeEmail->send(); - $this->assertContains('From: "70:20:00 \" Forum" ', $result['headers']); + $this->assertStringContainsString('From: "70:20:00 \" Forum" ', $result['headers']); } /** @@ -1016,7 +1016,7 @@ class CakeEmailTest extends CakeTestCase { )); $result = $this->CakeEmail->send(); - $this->assertContains('A message to you', $result['message']); + $this->assertStringContainsString('A message to you', $result['message']); } /** @@ -1102,7 +1102,7 @@ class CakeEmailTest extends CakeTestCase { $result = $this->CakeEmail->send('Hello'); $boundary = $this->CakeEmail->getBoundary(); - $this->assertContains('Content-Type: multipart/mixed; boundary="' . $boundary . '"', $result['headers']); + $this->assertStringContainsString('Content-Type: multipart/mixed; boundary="' . $boundary . '"', $result['headers']); $expected = "--$boundary\r\n" . "Content-Type: text/plain; charset=UTF-8\r\n" . "Content-Transfer-Encoding: 8bit\r\n" . @@ -1115,7 +1115,7 @@ class CakeEmailTest extends CakeTestCase { "Content-Type: text/x-php\r\n" . "Content-Transfer-Encoding: base64\r\n" . "Content-Disposition: attachment; filename=\"basics.php\"\r\n\r\n"; - $this->assertContains($expected, $result['message']); + $this->assertStringContainsString($expected, $result['message']); } /** @@ -1138,7 +1138,7 @@ class CakeEmailTest extends CakeTestCase { $result = $this->CakeEmail->send('Hello'); $boundary = $this->CakeEmail->getBoundary(); - $this->assertContains('Content-Type: multipart/mixed; boundary="' . $boundary . '"', $result['headers']); + $this->assertStringContainsString('Content-Type: multipart/mixed; boundary="' . $boundary . '"', $result['headers']); $expected = "--$boundary\r\n" . "Content-Type: text/plain; charset=UTF-8\r\n" . "Content-Transfer-Encoding: 8bit\r\n" . @@ -1152,7 +1152,7 @@ class CakeEmailTest extends CakeTestCase { "Content-Transfer-Encoding: base64\r\n" . "Content-Disposition: attachment; filename=\"cake.icon.png\"\r\n\r\n"; $expected .= chunk_split(base64_encode($data), 76, "\r\n"); - $this->assertContains($expected, $result['message']); + $this->assertStringContainsString($expected, $result['message']); } /** @@ -1173,7 +1173,7 @@ class CakeEmailTest extends CakeTestCase { $result = $this->CakeEmail->send('Hello'); $boundary = $this->CakeEmail->getBoundary(); - $this->assertContains('Content-Type: multipart/mixed; boundary="' . $boundary . '"', $result['headers']); + $this->assertStringContainsString('Content-Type: multipart/mixed; boundary="' . $boundary . '"', $result['headers']); $expected = "--$boundary\r\n" . "Content-Type: text/plain; charset=UTF-8\r\n" . "Content-Transfer-Encoding: 8bit\r\n" . @@ -1187,7 +1187,7 @@ class CakeEmailTest extends CakeTestCase { "Content-Transfer-Encoding: base64\r\n" . "Content-Disposition: attachment; filename=\"cake.icon.png\"\r\n\r\n"; $expected .= chunk_split(base64_encode($data), 76, "\r\n"); - $this->assertContains($expected, $result['message']); + $this->assertStringContainsString($expected, $result['message']); } /** @@ -1205,7 +1205,7 @@ class CakeEmailTest extends CakeTestCase { $result = $this->CakeEmail->send('Hello'); $boundary = $this->CakeEmail->getBoundary(); - $this->assertContains('Content-Type: multipart/mixed; boundary="' . $boundary . '"', $result['headers']); + $this->assertStringContainsString('Content-Type: multipart/mixed; boundary="' . $boundary . '"', $result['headers']); $expected = "--$boundary\r\n" . "Content-Type: multipart/alternative; boundary=\"alt-$boundary\"\r\n" . "\r\n" . @@ -1231,7 +1231,7 @@ class CakeEmailTest extends CakeTestCase { "Content-Type: text/plain\r\n" . "Content-Transfer-Encoding: base64\r\n" . "Content-Disposition: attachment; filename=\"VERSION.txt\"\r\n\r\n"; - $this->assertContains($expected, $result['message']); + $this->assertStringContainsString($expected, $result['message']); } /** @@ -1254,7 +1254,7 @@ class CakeEmailTest extends CakeTestCase { $result = $this->CakeEmail->send('Hello'); $boundary = $this->CakeEmail->getBoundary(); - $this->assertContains('Content-Type: multipart/mixed; boundary="' . $boundary . '"', $result['headers']); + $this->assertStringContainsString('Content-Type: multipart/mixed; boundary="' . $boundary . '"', $result['headers']); $expected = "--$boundary\r\n" . "Content-Type: multipart/related; boundary=\"rel-$boundary\"\r\n" . "\r\n" . @@ -1284,9 +1284,9 @@ class CakeEmailTest extends CakeTestCase { "Content-Transfer-Encoding: base64\r\n" . "Content-ID: \r\n" . "Content-Disposition: inline; filename=\"cake.png\"\r\n\r\n"; - $this->assertContains($expected, $result['message']); - $this->assertContains('--rel-' . $boundary . '--', $result['message']); - $this->assertContains('--' . $boundary . '--', $result['message']); + $this->assertStringContainsString($expected, $result['message']); + $this->assertStringContainsString('--rel-' . $boundary . '--', $result['message']); + $this->assertStringContainsString('--' . $boundary . '--', $result['message']); } /** @@ -1309,7 +1309,7 @@ class CakeEmailTest extends CakeTestCase { $result = $this->CakeEmail->send('Hello'); $boundary = $this->CakeEmail->getBoundary(); - $this->assertContains('Content-Type: multipart/mixed; boundary="' . $boundary . '"', $result['headers']); + $this->assertStringContainsString('Content-Type: multipart/mixed; boundary="' . $boundary . '"', $result['headers']); $expected = "--$boundary\r\n" . "Content-Type: multipart/related; boundary=\"rel-$boundary\"\r\n" . "\r\n" . @@ -1326,9 +1326,9 @@ class CakeEmailTest extends CakeTestCase { "Content-Transfer-Encoding: base64\r\n" . "Content-ID: \r\n" . "Content-Disposition: inline; filename=\"cake.png\"\r\n\r\n"; - $this->assertContains($expected, $result['message']); - $this->assertContains('--rel-' . $boundary . '--', $result['message']); - $this->assertContains('--' . $boundary . '--', $result['message']); + $this->assertStringContainsString($expected, $result['message']); + $this->assertStringContainsString('--rel-' . $boundary . '--', $result['message']); + $this->assertStringContainsString('--' . $boundary . '--', $result['message']); } /** @@ -1351,7 +1351,7 @@ class CakeEmailTest extends CakeTestCase { $result = $this->CakeEmail->send('Hello'); $boundary = $this->CakeEmail->getBoundary(); - $this->assertContains('Content-Type: multipart/mixed; boundary="' . $boundary . '"', $result['headers']); + $this->assertStringContainsString('Content-Type: multipart/mixed; boundary="' . $boundary . '"', $result['headers']); $expected = "--$boundary\r\n" . "Content-Type: text/plain; charset=UTF-8\r\n" . "Content-Transfer-Encoding: 8bit\r\n" . @@ -1365,8 +1365,8 @@ class CakeEmailTest extends CakeTestCase { "Content-Transfer-Encoding: base64\r\n" . "\r\n"; - $this->assertContains($expected, $result['message']); - $this->assertContains('--' . $boundary . '--', $result['message']); + $this->assertStringContainsString($expected, $result['message']); + $this->assertStringContainsString('--' . $boundary . '--', $result['message']); } /** * testSendWithLog method @@ -1440,9 +1440,9 @@ class CakeEmailTest extends CakeTestCase { $this->CakeEmail->template('default', 'default'); $result = $this->CakeEmail->send(); - $this->assertContains('This email was sent using the CakePHP Framework', $result['message']); - $this->assertContains('Message-ID: ', $result['headers']); - $this->assertContains('To: ', $result['headers']); + $this->assertStringContainsString('This email was sent using the CakePHP Framework', $result['message']); + $this->assertStringContainsString('Message-ID: ', $result['headers']); + $this->assertStringContainsString('To: ', $result['headers']); } /** @@ -1461,7 +1461,7 @@ class CakeEmailTest extends CakeTestCase { $this->CakeEmail->template('default', null); $result = $this->CakeEmail->send('message body.'); - $this->assertContains('message body.', $result['message']); + $this->assertStringContainsString('message body.', $result['message']); $this->assertNotContains('This email was sent using the CakePHP Framework', $result['message']); } @@ -1482,11 +1482,11 @@ class CakeEmailTest extends CakeTestCase { $this->CakeEmail->emailFormat('both'); $result = $this->CakeEmail->send(); - $this->assertContains('Message-ID: ', $result['headers']); - $this->assertContains('To: ', $result['headers']); + $this->assertStringContainsString('Message-ID: ', $result['headers']); + $this->assertStringContainsString('To: ', $result['headers']); $boundary = $this->CakeEmail->getBoundary(); - $this->assertContains('Content-Type: multipart/alternative; boundary="' . $boundary . '"', $result['headers']); + $this->assertStringContainsString('Content-Type: multipart/alternative; boundary="' . $boundary . '"', $result['headers']); $expected = "--$boundary\r\n" . "Content-Type: text/plain; charset=UTF-8\r\n" . @@ -1531,9 +1531,9 @@ class CakeEmailTest extends CakeTestCase { $result = $this->CakeEmail->send(); $expected = mb_convert_encoding('CakePHP Framework を使って送信したメールです。 https://cakephp.org.', 'ISO-2022-JP'); - $this->assertContains($expected, $result['message']); - $this->assertContains('Message-ID: ', $result['headers']); - $this->assertContains('To: ', $result['headers']); + $this->assertStringContainsString($expected, $result['message']); + $this->assertStringContainsString('Message-ID: ', $result['headers']); + $this->assertStringContainsString('To: ', $result['headers']); } /** @@ -1553,10 +1553,10 @@ class CakeEmailTest extends CakeTestCase { $this->CakeEmail->template('themed', 'default'); $result = $this->CakeEmail->send(); - $this->assertContains('In TestTheme', $result['message']); - $this->assertContains('Message-ID: ', $result['headers']); - $this->assertContains('To: ', $result['headers']); - $this->assertContains('/theme/TestTheme/img/test.jpg', $result['message']); + $this->assertStringContainsString('In TestTheme', $result['message']); + $this->assertStringContainsString('Message-ID: ', $result['headers']); + $this->assertStringContainsString('To: ', $result['headers']); + $this->assertStringContainsString('/theme/TestTheme/img/test.jpg', $result['message']); } /** @@ -1597,7 +1597,7 @@ class CakeEmailTest extends CakeTestCase { $this->CakeEmail->viewVars(array('value' => 12345)); $result = $this->CakeEmail->send(); - $this->assertContains('Here is your value: 12345', $result['message']); + $this->assertStringContainsString('Here is your value: 12345', $result['message']); } /** @@ -1673,7 +1673,7 @@ class CakeEmailTest extends CakeTestCase { $expected = 'cool image'; $result = $this->CakeEmail->send(); - $this->assertContains($expected, $result['message']); + $this->assertStringContainsString($expected, $result['message']); } /** @@ -1695,35 +1695,35 @@ class CakeEmailTest extends CakeTestCase { $this->CakeEmail->config(array('empty')); $result = $this->CakeEmail->template('TestPlugin.test_plugin_tpl', 'default')->send(); - $this->assertContains('Into TestPlugin.', $result['message']); - $this->assertContains('This email was sent using the CakePHP Framework', $result['message']); + $this->assertStringContainsString('Into TestPlugin.', $result['message']); + $this->assertStringContainsString('This email was sent using the CakePHP Framework', $result['message']); $result = $this->CakeEmail->template('TestPlugin.test_plugin_tpl', 'TestPlugin.plug_default')->send(); - $this->assertContains('Into TestPlugin.', $result['message']); - $this->assertContains('This email was sent using the TestPlugin.', $result['message']); + $this->assertStringContainsString('Into TestPlugin.', $result['message']); + $this->assertStringContainsString('This email was sent using the TestPlugin.', $result['message']); $result = $this->CakeEmail->template('TestPlugin.test_plugin_tpl', 'plug_default')->send(); - $this->assertContains('Into TestPlugin.', $result['message']); - $this->assertContains('This email was sent using the TestPlugin.', $result['message']); + $this->assertStringContainsString('Into TestPlugin.', $result['message']); + $this->assertStringContainsString('This email was sent using the TestPlugin.', $result['message']); $this->CakeEmail->template( 'TestPlugin.test_plugin_tpl', 'TestPluginTwo.default' ); $result = $this->CakeEmail->send(); - $this->assertContains('Into TestPlugin.', $result['message']); - $this->assertContains('This email was sent using TestPluginTwo.', $result['message']); + $this->assertStringContainsString('Into TestPlugin.', $result['message']); + $this->assertStringContainsString('This email was sent using TestPluginTwo.', $result['message']); // test plugin template overridden by theme $this->CakeEmail->theme('TestTheme'); $result = $this->CakeEmail->send(); - $this->assertContains('Into TestPlugin. (themed)', $result['message']); + $this->assertStringContainsString('Into TestPlugin. (themed)', $result['message']); $this->CakeEmail->viewVars(array('value' => 12345)); $result = $this->CakeEmail->template('custom', 'TestPlugin.plug_default')->send(); - $this->assertContains('Here is your value: 12345', $result['message']); - $this->assertContains('This email was sent using the TestPlugin.', $result['message']); + $this->assertStringContainsString('Here is your value: 12345', $result['message']); + $this->assertStringContainsString('This email was sent using the TestPlugin.', $result['message']); $this->setExpectedException('MissingViewException'); $this->CakeEmail->template('test_plugin_tpl', 'plug_default')->send(); @@ -1779,19 +1779,19 @@ class CakeEmailTest extends CakeTestCase { $this->CakeEmail->config(array()); $this->CakeEmail->attachments(array(CAKE . 'basics.php')); $result = $this->CakeEmail->send('body'); - $this->assertContains("Content-Type: text/x-php\r\nContent-Transfer-Encoding: base64\r\nContent-Disposition: attachment; filename=\"basics.php\"", $result['message']); + $this->assertStringContainsString("Content-Type: text/x-php\r\nContent-Transfer-Encoding: base64\r\nContent-Disposition: attachment; filename=\"basics.php\"", $result['message']); $this->CakeEmail->attachments(array('my.file.txt' => CAKE . 'basics.php')); $result = $this->CakeEmail->send('body'); - $this->assertContains("Content-Type: text/x-php\r\nContent-Transfer-Encoding: base64\r\nContent-Disposition: attachment; filename=\"my.file.txt\"", $result['message']); + $this->assertStringContainsString("Content-Type: text/x-php\r\nContent-Transfer-Encoding: base64\r\nContent-Disposition: attachment; filename=\"my.file.txt\"", $result['message']); $this->CakeEmail->attachments(array('file.txt' => array('file' => CAKE . 'basics.php', 'mimetype' => 'text/plain'))); $result = $this->CakeEmail->send('body'); - $this->assertContains("Content-Type: text/plain\r\nContent-Transfer-Encoding: base64\r\nContent-Disposition: attachment; filename=\"file.txt\"", $result['message']); + $this->assertStringContainsString("Content-Type: text/plain\r\nContent-Transfer-Encoding: base64\r\nContent-Disposition: attachment; filename=\"file.txt\"", $result['message']); $this->CakeEmail->attachments(array('file2.txt' => array('file' => CAKE . 'basics.php', 'mimetype' => 'text/plain', 'contentId' => 'a1b1c1'))); $result = $this->CakeEmail->send('body'); - $this->assertContains("Content-Type: text/plain\r\nContent-Transfer-Encoding: base64\r\nContent-ID: \r\nContent-Disposition: inline; filename=\"file2.txt\"", $result['message']); + $this->assertStringContainsString("Content-Type: text/plain\r\nContent-Transfer-Encoding: base64\r\nContent-ID: \r\nContent-Disposition: inline; filename=\"file2.txt\"", $result['message']); } /** @@ -1846,10 +1846,10 @@ class CakeEmailTest extends CakeTestCase { $this->CakeEmail->send(); $expected = '

This email was sent using the CakePHP Framework

'; - $this->assertContains($expected, $this->CakeEmail->message(CakeEmail::MESSAGE_HTML)); + $this->assertStringContainsString($expected, $this->CakeEmail->message(CakeEmail::MESSAGE_HTML)); $expected = 'This email was sent using the CakePHP Framework, https://cakephp.org.'; - $this->assertContains($expected, $this->CakeEmail->message(CakeEmail::MESSAGE_TEXT)); + $this->assertStringContainsString($expected, $this->CakeEmail->message(CakeEmail::MESSAGE_TEXT)); $message = $this->CakeEmail->message(); $this->assertContains('Content-Type: text/plain; charset=UTF-8', $message); @@ -2134,11 +2134,11 @@ class CakeEmailTest extends CakeTestCase { $email->subject('あれ?もしかしての前と'); $headers = $email->getHeaders(array('subject')); $expected = "?ISO-2022-JP?B?GyRCJCIkbCEpJGIkNyQrJDckRiROQTAkSBsoQg==?="; - $this->assertContains($expected, $headers['Subject']); + $this->assertStringContainsString($expected, $headers['Subject']); $email->to('someone@example.com')->from('someone@example.com'); $result = $email->send('ってテーブルを作ってやってたらう'); - $this->assertContains('ってテーブルを作ってやってたらう', $result['message']); + $this->assertStringContainsString('ってテーブルを作ってやってたらう', $result['message']); } /** @@ -2156,12 +2156,12 @@ class CakeEmailTest extends CakeTestCase { $email->subject('あれ?もしかしての前と'); $headers = $email->getHeaders(array('subject')); $expected = "?ISO-2022-JP?B?GyRCJCIkbCEpJGIkNyQrJDckRiROQTAkSBsoQg==?="; - $this->assertContains($expected, $headers['Subject']); + $this->assertStringContainsString($expected, $headers['Subject']); $email->to('someone@example.com')->from('someone@example.com'); $result = $email->send('ってテーブルを作ってやってたらう'); - $this->assertContains('Content-Type: text/plain; charset=ISO-2022-JP', $result['headers']); - $this->assertContains(mb_convert_encoding('ってテーブルを作ってやってたらう', 'ISO-2022-JP'), $result['message']); + $this->assertStringContainsString('Content-Type: text/plain; charset=ISO-2022-JP', $result['headers']); + $this->assertStringContainsString(mb_convert_encoding('ってテーブルを作ってやってたらう', 'ISO-2022-JP'), $result['message']); } /** @@ -2179,7 +2179,7 @@ class CakeEmailTest extends CakeTestCase { $email->subject('あれ?もしかしての前と'); $headers = $email->getHeaders(array('subject')); $expected = "?ISO-2022-JP?B?GyRCJCIkbCEpJGIkNyQrJDckRiROQTAkSBsoQg==?="; - $this->assertContains($expected, $headers['Subject']); + $this->assertStringContainsString($expected, $headers['Subject']); $email->to('someone@example.com')->from('someone@example.com'); $result = $email->send('①㈱'); @@ -2203,13 +2203,13 @@ class CakeEmailTest extends CakeTestCase { $email->subject('あれ?もしかしての前と'); $headers = $email->getHeaders(array('subject')); $expected = "?ISO-2022-JP?B?GyRCJCIkbCEpJGIkNyQrJDckRiROQTAkSBsoQg==?="; - $this->assertContains($expected, $headers['Subject']); + $this->assertStringContainsString($expected, $headers['Subject']); $email->to('someone@example.com')->from('someone@example.com'); $result = $email->send('①㈱'); $this->assertTextContains("Content-Type: text/plain; charset=ISO-2022-JP", $result['headers']); $this->assertTextNotContains("Content-Type: text/plain; charset=iso-2022-jp-ms", $result['headers']); // not charset=iso-2022-jp-ms - $this->assertContains(mb_convert_encoding('①㈱', 'ISO-2022-JP-MS'), $result['message']); + $this->assertStringContainsString(mb_convert_encoding('①㈱', 'ISO-2022-JP-MS'), $result['message']); } protected function _checkContentTransferEncoding($message, $charset) { @@ -2550,8 +2550,8 @@ HTML; $this->CakeEmail->emailFormat('html'); $this->CakeEmail->template('long_line', null); $result = $this->CakeEmail->send(); - $this->assertContains('', $result['message'], 'First bits are included'); - $this->assertContains('x', $result['message'], 'Last byte are included'); + $this->assertStringContainsString('', $result['message'], 'First bits are included'); + $this->assertStringContainsString('x', $result['message'], 'Last byte are included'); } /** diff --git a/lib/Cake/Test/Case/Network/Email/MailTransportTest.php b/lib/Cake/Test/Case/Network/Email/MailTransportTest.php index 6019b960c..f9e0c4ba3 100644 --- a/lib/Cake/Test/Case/Network/Email/MailTransportTest.php +++ b/lib/Cake/Test/Case/Network/Email/MailTransportTest.php @@ -86,8 +86,8 @@ class MailTransportTest extends CakeTestCase { $result = $this->MailTransport->send($email); - $this->assertContains('Subject: ', $result['headers']); - $this->assertContains('To: ', $result['headers']); + $this->assertStringContainsString('Subject: ', $result['headers']); + $this->assertStringContainsString('To: ', $result['headers']); } } diff --git a/lib/Cake/Test/Case/Network/Http/HttpSocketTest.php b/lib/Cake/Test/Case/Network/Http/HttpSocketTest.php index 054a6db6e..27c692444 100644 --- a/lib/Cake/Test/Case/Network/Http/HttpSocketTest.php +++ b/lib/Cake/Test/Case/Network/Http/HttpSocketTest.php @@ -594,7 +594,7 @@ class HttpSocketTest extends CakeTestCase { 'method' => 'GET' ); $this->Socket->request($request); - $this->assertContains('Host: cakephp.org:8080', $this->Socket->request['header']); + $this->assertStringContainsString('Host: cakephp.org:8080', $this->Socket->request['header']); } /** @@ -618,7 +618,7 @@ class HttpSocketTest extends CakeTestCase { 'method' => 'GET' ); $this->Socket->request($request); - $this->assertContains("GET /index.php?somestring HTTP/1.1", $this->Socket->request['line']); + $this->assertStringContainsString("GET /index.php?somestring HTTP/1.1", $this->Socket->request['line']); } /** @@ -1845,7 +1845,7 @@ class HttpSocketTest extends CakeTestCase { } catch (SocketException $e) { $message = $e->getMessage(); $this->skipIf(strpos($message, 'Invalid HTTP') !== false, 'Invalid HTTP Response received, skipping.'); - $this->assertContains('Failed to enable crypto', $message); + $this->assertStringContainsString('Failed to enable crypto', $message); } } diff --git a/lib/Cake/Test/Case/TestSuite/CakeTestCaseTest.php b/lib/Cake/Test/Case/TestSuite/CakeTestCaseTest.php index de58df0cf..f7adc7208 100644 --- a/lib/Cake/Test/Case/TestSuite/CakeTestCaseTest.php +++ b/lib/Cake/Test/Case/TestSuite/CakeTestCaseTest.php @@ -380,7 +380,7 @@ class CakeTestCaseTest extends CakeTestCase { */ public function testAssertTextContains() { $stringDirty = "some\nstring\r\nwith\rdifferent\nline endings!"; - $this->assertContains("different", $stringDirty); + $this->assertStringContainsString("different", $stringDirty); $this->assertNotContains("different\rline", $stringDirty); $this->assertTextContains("different\rline", $stringDirty); } diff --git a/lib/Cake/Test/Case/TestSuite/ControllerTestCaseTest.php b/lib/Cake/Test/Case/TestSuite/ControllerTestCaseTest.php index 3c837a2d8..77671f6e1 100644 --- a/lib/Cake/Test/Case/TestSuite/ControllerTestCaseTest.php +++ b/lib/Cake/Test/Case/TestSuite/ControllerTestCaseTest.php @@ -602,24 +602,24 @@ class ControllerTestCaseTest extends CakeTestCase { 'method' => 'get', 'return' => 'contents', )); - $this->assertContains('assertContains('This is the TestsAppsController index view', $result); - $this->assertContains('first call', $result); - $this->assertContains('', $result); + $this->assertStringContainsString('assertStringContainsString('This is the TestsAppsController index view', $result); + $this->assertStringContainsString('first call', $result); + $this->assertStringContainsString('', $result); $result = $this->Case->testAction('/tests_apps/index', array( 'data' => array('var' => 'second call'), 'method' => 'get', 'return' => 'contents' )); - $this->assertContains('second call', $result); + $this->assertStringContainsString('second call', $result); $result = $this->Case->testAction('/tests_apps/index', array( 'data' => array('var' => 'third call'), 'method' => 'get', 'return' => 'contents' )); - $this->assertContains('third call', $result); + $this->assertStringContainsString('third call', $result); } /** diff --git a/lib/Cake/Test/Case/Utility/DebuggerTest.php b/lib/Cake/Test/Case/Utility/DebuggerTest.php index fd96c0e62..7d7a96457 100644 --- a/lib/Cake/Test/Case/Utility/DebuggerTest.php +++ b/lib/Cake/Test/Case/Utility/DebuggerTest.php @@ -152,7 +152,7 @@ class DebuggerTest extends CakeTestCase { $this->assertMatchesRegularExpression('/Undefined variable:\s+buzz/', $result[1]); $this->assertMatchesRegularExpression('/]+>Code/', $result[1]); $this->assertMatchesRegularExpression('/]+>Context/', $result[2]); - $this->assertContains('$wrong = ''', $result[3], 'Context should be HTML escaped.'); + $this->assertStringContainsString('$wrong = ''', $result[3], 'Context should be HTML escaped.'); } /** @@ -170,7 +170,7 @@ class DebuggerTest extends CakeTestCase { $result = ob_get_clean(); $this->assertNotContains('