diff --git a/lib/Cake/Test/Case/BasicsTest.php b/lib/Cake/Test/Case/BasicsTest.php index 64fa86e9c..bc306cfda 100644 --- a/lib/Cake/Test/Case/BasicsTest.php +++ b/lib/Cake/Test/Case/BasicsTest.php @@ -806,9 +806,9 @@ class BasicsTest extends CakeTestCase { } $result = file_get_contents(LOGS . 'error.log'); - $this->assertRegExp('/Error: Testing LogError\(\) basic function/', $result); + $this->assertMatchesRegularExpression('/Error: Testing LogError\(\) basic function/', $result); $this->assertNotRegExp("/Error: Testing with\nmulti-line\nstring/", $result); - $this->assertRegExp('/Error: Testing with multi-line string/', $result); + $this->assertMatchesRegularExpression('/Error: Testing with multi-line string/', $result); } /** diff --git a/lib/Cake/Test/Case/Console/Command/CommandListShellTest.php b/lib/Cake/Test/Case/Console/Command/CommandListShellTest.php index 401716275..aafbab65b 100644 --- a/lib/Cake/Test/Case/Console/Command/CommandListShellTest.php +++ b/lib/Cake/Test/Case/Console/Command/CommandListShellTest.php @@ -98,16 +98,16 @@ class CommandListShellTest extends CakeTestCase { $output = $this->Shell->stdout->output; $expected = "/\[.*TestPlugin.*\] example/"; - $this->assertRegExp($expected, $output); + $this->assertMatchesRegularExpression($expected, $output); $expected = "/\[.*TestPluginTwo.*\] example, welcome/"; - $this->assertRegExp($expected, $output); + $this->assertMatchesRegularExpression($expected, $output); $expected = "/\[.*CORE.*\] acl, api, bake, command_list, completion, console, i18n, schema, server, test, testsuite, upgrade/"; - $this->assertRegExp($expected, $output); + $this->assertMatchesRegularExpression($expected, $output); $expected = "/\[.*app.*\] sample/"; - $this->assertRegExp($expected, $output); + $this->assertMatchesRegularExpression($expected, $output); } /** diff --git a/lib/Cake/Test/Case/Console/Command/CompletionShellTest.php b/lib/Cake/Test/Case/Console/Command/CompletionShellTest.php index 51a358e68..427066a7a 100644 --- a/lib/Cake/Test/Case/Console/Command/CompletionShellTest.php +++ b/lib/Cake/Test/Case/Console/Command/CompletionShellTest.php @@ -113,7 +113,7 @@ class CompletionShellTest extends CakeTestCase { $output = $this->Shell->stdout->output; $expected = "/This command is not intended to be called manually/"; - $this->assertRegExp($expected, $output); + $this->assertMatchesRegularExpression($expected, $output); } /** diff --git a/lib/Cake/Test/Case/Console/Command/SchemaShellTest.php b/lib/Cake/Test/Case/Console/Command/SchemaShellTest.php index 009b61686..6aa2c9042 100644 --- a/lib/Cake/Test/Case/Console/Command/SchemaShellTest.php +++ b/lib/Cake/Test/Case/Console/Command/SchemaShellTest.php @@ -218,14 +218,14 @@ class SchemaShellTest extends CakeTestCase { $this->file = new File(TMP . 'tests' . DS . 'i18n.sql'); $contents = $this->file->read(); - $this->assertRegExp('/DROP TABLE/', $contents); - $this->assertRegExp('/CREATE TABLE.*?i18n/', $contents); - $this->assertRegExp('/id/', $contents); - $this->assertRegExp('/model/', $contents); - $this->assertRegExp('/field/', $contents); - $this->assertRegExp('/locale/', $contents); - $this->assertRegExp('/foreign_key/', $contents); - $this->assertRegExp('/content/', $contents); + $this->assertMatchesRegularExpression('/DROP TABLE/', $contents); + $this->assertMatchesRegularExpression('/CREATE TABLE.*?i18n/', $contents); + $this->assertMatchesRegularExpression('/id/', $contents); + $this->assertMatchesRegularExpression('/model/', $contents); + $this->assertMatchesRegularExpression('/field/', $contents); + $this->assertMatchesRegularExpression('/locale/', $contents); + $this->assertMatchesRegularExpression('/foreign_key/', $contents); + $this->assertMatchesRegularExpression('/content/', $contents); } /** @@ -250,9 +250,9 @@ class SchemaShellTest extends CakeTestCase { $this->file = new File(TMP . 'tests' . DS . 'dump_test.sql'); $contents = $this->file->read(); - $this->assertRegExp('/CREATE TABLE.*?test_plugin_acos/', $contents); - $this->assertRegExp('/id/', $contents); - $this->assertRegExp('/model/', $contents); + $this->assertMatchesRegularExpression('/CREATE TABLE.*?test_plugin_acos/', $contents); + $this->assertMatchesRegularExpression('/id/', $contents); + $this->assertMatchesRegularExpression('/model/', $contents); $this->file->delete(); App::build(); @@ -353,11 +353,11 @@ class SchemaShellTest extends CakeTestCase { $this->file = new File(TMP . 'tests' . DS . 'schema.php'); $contents = $this->file->read(); - $this->assertRegExp('/class TestPluginSchema/', $contents); - $this->assertRegExp('/public \$posts/', $contents); - $this->assertRegExp('/public \$auth_users/', $contents); - $this->assertRegExp('/public \$authors/', $contents); - $this->assertRegExp('/public \$test_plugin_comments/', $contents); + $this->assertMatchesRegularExpression('/class TestPluginSchema/', $contents); + $this->assertMatchesRegularExpression('/public \$posts/', $contents); + $this->assertMatchesRegularExpression('/public \$auth_users/', $contents); + $this->assertMatchesRegularExpression('/public \$authors/', $contents); + $this->assertMatchesRegularExpression('/public \$test_plugin_comments/', $contents); $this->assertNotRegExp('/public \$users/', $contents); $this->assertNotRegExp('/public \$articles/', $contents); CakePlugin::unload(); @@ -389,8 +389,8 @@ class SchemaShellTest extends CakeTestCase { $this->file = new File(TMP . 'tests' . DS . 'schema.php'); $contents = $this->file->read(); - $this->assertRegExp('/class TestPluginSchema/', $contents); - $this->assertRegExp('/public \$test_plugin_comments/', $contents); + $this->assertMatchesRegularExpression('/class TestPluginSchema/', $contents); + $this->assertMatchesRegularExpression('/public \$test_plugin_comments/', $contents); $this->assertNotRegExp('/public \$authors/', $contents); $this->assertNotRegExp('/public \$auth_users/', $contents); $this->assertNotRegExp('/public \$posts/', $contents); @@ -628,7 +628,7 @@ class SchemaShellTest extends CakeTestCase { $this->Shell->generate(); $contents = file_get_contents($this->Shell->Schema->path . DS . 'custom_names.php'); - $this->assertRegExp('/class CustomNamesSchema/', $contents); + $this->assertMatchesRegularExpression('/class CustomNamesSchema/', $contents); unlink($this->Shell->Schema->path . DS . 'custom_names.php'); CakePlugin::unload(); } @@ -661,7 +661,7 @@ class SchemaShellTest extends CakeTestCase { $this->assertFileExists($file); $contents = file_get_contents($file); - $this->assertRegExp('/class CustomNameSchema/', $contents); + $this->assertMatchesRegularExpression('/class CustomNameSchema/', $contents); if (file_exists($file)) { unlink($file); diff --git a/lib/Cake/Test/Case/Console/Command/Task/ControllerTaskTest.php b/lib/Cake/Test/Case/Console/Command/Task/ControllerTaskTest.php index b34ae2b14..1a5df731a 100644 --- a/lib/Cake/Test/Case/Console/Command/Task/ControllerTaskTest.php +++ b/lib/Cake/Test/Case/Console/Command/Task/ControllerTaskTest.php @@ -448,7 +448,7 @@ class ControllerTaskTest extends CakeTestCase { )->will($this->returnValue(true)); $result = $this->Task->execute(); - $this->assertRegExp('/admin_index/', $result); + $this->assertMatchesRegularExpression('/admin_index/', $result); } /** diff --git a/lib/Cake/Test/Case/Console/Command/Task/ExtractTaskTest.php b/lib/Cake/Test/Case/Console/Command/Task/ExtractTaskTest.php index b82c8ede9..eea57f634 100644 --- a/lib/Cake/Test/Case/Console/Command/Task/ExtractTaskTest.php +++ b/lib/Cake/Test/Case/Console/Command/Task/ExtractTaskTest.php @@ -88,68 +88,68 @@ class ExtractTaskTest extends CakeTestCase { $this->assertFalse(file_exists($this->path . DS . 'cake.pot')); $pattern = '/"Content-Type\: text\/plain; charset\=utf-8/'; - $this->assertRegExp($pattern, $result); + $this->assertMatchesRegularExpression($pattern, $result); $pattern = '/"Content-Transfer-Encoding\: 8bit/'; - $this->assertRegExp($pattern, $result); + $this->assertMatchesRegularExpression($pattern, $result); $pattern = '/"Plural-Forms\: nplurals\=INTEGER; plural\=EXPRESSION;/'; - $this->assertRegExp($pattern, $result); + $this->assertMatchesRegularExpression($pattern, $result); // home.ctp $pattern = '/msgid "Your tmp directory is writable."\nmsgstr ""\n/'; - $this->assertRegExp($pattern, $result); + $this->assertMatchesRegularExpression($pattern, $result); $pattern = '/msgid "Your tmp directory is NOT writable."\nmsgstr ""\n/'; - $this->assertRegExp($pattern, $result); + $this->assertMatchesRegularExpression($pattern, $result); $pattern = '/msgid "The %s is being used for caching. To change the config edit '; $pattern .= '%s\/core.php "\nmsgstr ""\n/'; - $this->assertRegExp($pattern, $result); + $this->assertMatchesRegularExpression($pattern, $result); $pattern = '/msgid "Your cache is NOT working. Please check '; $pattern .= 'the settings in %s\/core.php"\nmsgstr ""\n/'; - $this->assertRegExp($pattern, $result); + $this->assertMatchesRegularExpression($pattern, $result); $pattern = '/msgid "Your database configuration file is present."\nmsgstr ""\n/'; - $this->assertRegExp($pattern, $result); + $this->assertMatchesRegularExpression($pattern, $result); $pattern = '/msgid "Your database configuration file is NOT present."\nmsgstr ""\n/'; - $this->assertRegExp($pattern, $result); + $this->assertMatchesRegularExpression($pattern, $result); $pattern = '/msgid "Rename config\/database.php.default to '; $pattern .= 'config\/database.php"\nmsgstr ""\n/'; - $this->assertRegExp($pattern, $result); + $this->assertMatchesRegularExpression($pattern, $result); $pattern = '/msgid "Cake is able to connect to the database."\nmsgstr ""\n/'; - $this->assertRegExp($pattern, $result); + $this->assertMatchesRegularExpression($pattern, $result); $pattern = '/msgid "Cake is NOT able to connect to the database."\nmsgstr ""\n/'; - $this->assertRegExp($pattern, $result); + $this->assertMatchesRegularExpression($pattern, $result); $pattern = '/msgid "Editing this Page"\nmsgstr ""\n/'; - $this->assertRegExp($pattern, $result); + $this->assertMatchesRegularExpression($pattern, $result); $pattern = '/msgid "To change the content of this page, create: APP\/views\/pages\/home\.ctp/'; - $this->assertRegExp($pattern, $result); + $this->assertMatchesRegularExpression($pattern, $result); $pattern = '/To change its layout, create: APP\/views\/layouts\/default\.ctp\./s'; - $this->assertRegExp($pattern, $result); + $this->assertMatchesRegularExpression($pattern, $result); // extract.ctp $pattern = '/\#: extract\.ctp:15;6\n'; $pattern .= 'msgid "You have %d new message."\nmsgid_plural "You have %d new messages."/'; - $this->assertRegExp($pattern, $result); + $this->assertMatchesRegularExpression($pattern, $result); $pattern = '/msgid "You have %d new message."\nmsgstr ""/'; $this->assertNotRegExp($pattern, $result, 'No duplicate msgid'); $pattern = '/\#: extract\.ctp:7\n'; $pattern .= 'msgid "You deleted %d message."\nmsgid_plural "You deleted %d messages."/'; - $this->assertRegExp($pattern, $result); + $this->assertMatchesRegularExpression($pattern, $result); $pattern = '/\#: extract\.ctp:14\n'; $pattern .= '\#: home\.ctp:68\n'; $pattern .= 'msgid "Editing this Page"\nmsgstr ""/'; - $this->assertRegExp($pattern, $result); + $this->assertMatchesRegularExpression($pattern, $result); $pattern = '/\#: extract\.ctp:22\nmsgid "'; $pattern .= 'Hot features!'; @@ -157,25 +157,25 @@ class ExtractTaskTest extends CakeTestCase { $pattern .= '\\\n - Extremely Simple: Just look at the name...It\'s Cake'; $pattern .= '\\\n - Active, Friendly Community: Join us #cakephp on IRC. We\'d love to help you get started'; $pattern .= '"\nmsgstr ""/'; - $this->assertRegExp($pattern, $result); + $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'); $pattern = '/\#: extract\.ctp:36\nmsgid "letter"/'; - $this->assertRegExp($pattern, $result, 'Strings with context should not overwrite strings without context'); + $this->assertMatchesRegularExpression($pattern, $result, 'Strings with context should not overwrite strings without context'); $pattern = '/\#: extract\.ctp:37;39\nmsgctxt "A"\nmsgid "letter"/'; - $this->assertRegExp($pattern, $result, 'Should contain string with context "A"'); + $this->assertMatchesRegularExpression($pattern, $result, 'Should contain string with context "A"'); $pattern = '/\#: extract\.ctp:38\nmsgctxt "B"\nmsgid "letter"/'; - $this->assertRegExp($pattern, $result, 'Should contain string with context "B"'); + $this->assertMatchesRegularExpression($pattern, $result, 'Should contain string with context "B"'); $pattern = '/\#: extract\.ctp:40\nmsgid "%d letter"\nmsgid_plural "%d letters"/'; - $this->assertRegExp($pattern, $result, 'Plural strings with context should not overwrite strings without context'); + $this->assertMatchesRegularExpression($pattern, $result, 'Plural strings with context should not overwrite strings without context'); $pattern = '/\#: extract\.ctp:41\nmsgctxt "A"\nmsgid "%d letter"\nmsgid_plural "%d letters"/'; - $this->assertRegExp($pattern, $result, 'Should contain plural string with context "A"'); + $this->assertMatchesRegularExpression($pattern, $result, 'Should contain plural string with context "A"'); // extract.ctp - reading the domain.pot $result = file_get_contents($this->path . DS . 'domain.pot'); @@ -186,9 +186,9 @@ class ExtractTaskTest extends CakeTestCase { $this->assertNotRegExp($pattern, $result); $pattern = '/msgid "You have %d new message \(domain\)."\nmsgid_plural "You have %d new messages \(domain\)."/'; - $this->assertRegExp($pattern, $result); + $this->assertMatchesRegularExpression($pattern, $result); $pattern = '/msgid "You deleted %d message \(domain\)."\nmsgid_plural "You deleted %d messages \(domain\)."/'; - $this->assertRegExp($pattern, $result); + $this->assertMatchesRegularExpression($pattern, $result); } /** @@ -297,7 +297,7 @@ class ExtractTaskTest extends CakeTestCase { $result = file_get_contents($this->path . DS . 'default.pot'); $pattern = '/msgid "Add User"/'; - $this->assertRegExp($pattern, $result); + $this->assertMatchesRegularExpression($pattern, $result); } /** @@ -492,7 +492,7 @@ class ExtractTaskTest extends CakeTestCase { $result = file_get_contents($this->path . DS . 'cake.pot'); $pattern = '/msgid "Yesterday, %s"\nmsgstr ""\n/'; - $this->assertRegExp($pattern, $result); + $this->assertMatchesRegularExpression($pattern, $result); $this->assertTrue(file_exists($this->path . DS . 'cake_dev.pot')); $result = file_get_contents($this->path . DS . 'cake_dev.pot'); diff --git a/lib/Cake/Test/Case/Console/Command/Task/ModelTaskTest.php b/lib/Cake/Test/Case/Console/Command/Task/ModelTaskTest.php index 923aa6dca..fa5cacb40 100644 --- a/lib/Cake/Test/Case/Console/Command/Task/ModelTaskTest.php +++ b/lib/Cake/Test/Case/Console/Command/Task/ModelTaskTest.php @@ -851,8 +851,8 @@ class ModelTaskTest extends CakeTestCase { ) ); $result = $this->Task->bake('BakeArticle', compact('validate')); - $this->assertRegExp('/class BakeArticle extends AppModel \{/', $result); - $this->assertRegExp('/\$validate \= array\(/', $result); + $this->assertMatchesRegularExpression('/class BakeArticle extends AppModel \{/', $result); + $this->assertMatchesRegularExpression('/\$validate \= array\(/', $result); $expected = <<< STRINGEND array( 'notBlank' => array( @@ -864,7 +864,7 @@ array( //'on' => 'create', // Limit validation to 'create' or 'update' operations ), STRINGEND; - $this->assertRegExp('/' . preg_quote(str_replace("\r\n", "\n", $expected), '/') . '/', $result); + $this->assertMatchesRegularExpression('/' . preg_quote(str_replace("\r\n", "\n", $expected), '/') . '/', $result); } /** @@ -915,14 +915,14 @@ STRINGEND; $this->assertContains(' * @property OtherModel $OtherModel', $result); $this->assertContains(' * @property BakeComment $BakeComment', $result); $this->assertContains(' * @property BakeTag $BakeTag', $result); - $this->assertRegExp('/\$hasAndBelongsToMany \= array\(/', $result); - $this->assertRegExp('/\$hasMany \= array\(/', $result); - $this->assertRegExp('/\$belongsTo \= array\(/', $result); - $this->assertRegExp('/\$hasOne \= array\(/', $result); - $this->assertRegExp('/BakeTag/', $result); - $this->assertRegExp('/OtherModel/', $result); - $this->assertRegExp('/SomethingElse/', $result); - $this->assertRegExp('/BakeComment/', $result); + $this->assertMatchesRegularExpression('/\$hasAndBelongsToMany \= array\(/', $result); + $this->assertMatchesRegularExpression('/\$hasMany \= array\(/', $result); + $this->assertMatchesRegularExpression('/\$belongsTo \= array\(/', $result); + $this->assertMatchesRegularExpression('/\$hasOne \= array\(/', $result); + $this->assertMatchesRegularExpression('/BakeTag/', $result); + $this->assertMatchesRegularExpression('/OtherModel/', $result); + $this->assertMatchesRegularExpression('/SomethingElse/', $result); + $this->assertMatchesRegularExpression('/BakeComment/', $result); } /** diff --git a/lib/Cake/Test/Case/Console/Command/Task/ProjectTaskTest.php b/lib/Cake/Test/Case/Console/Command/Task/ProjectTaskTest.php index bc80c25b4..33d5eb143 100644 --- a/lib/Cake/Test/Case/Console/Command/Task/ProjectTaskTest.php +++ b/lib/Cake/Test/Case/Console/Command/Task/ProjectTaskTest.php @@ -142,10 +142,10 @@ class ProjectTaskTest extends CakeTestCase { $this->assertTrue(is_dir($this->Task->args[0]), 'No project dir'); $File = new File($path . DS . 'webroot' . DS . 'index.php'); $contents = $File->read(); - $this->assertRegExp('/define\(\'CAKE_CORE_INCLUDE_PATH\', .*?DS/', $contents); + $this->assertMatchesRegularExpression('/define\(\'CAKE_CORE_INCLUDE_PATH\', .*?DS/', $contents); $File = new File($path . DS . 'webroot' . DS . 'test.php'); $contents = $File->read(); - $this->assertRegExp('/define\(\'CAKE_CORE_INCLUDE_PATH\', .*?DS/', $contents); + $this->assertMatchesRegularExpression('/define\(\'CAKE_CORE_INCLUDE_PATH\', .*?DS/', $contents); } /** @@ -167,10 +167,10 @@ class ProjectTaskTest extends CakeTestCase { $this->assertTrue(is_dir($this->Task->args[0]), 'No project dir'); $contents = file_get_contents($path . DS . 'webroot' . DS . 'index.php'); - $this->assertRegExp('#//define\(\'CAKE_CORE_INCLUDE_PATH#', $contents); + $this->assertMatchesRegularExpression('#//define\(\'CAKE_CORE_INCLUDE_PATH#', $contents); $contents = file_get_contents($path . DS . 'webroot' . DS . 'test.php'); - $this->assertRegExp('#//define\(\'CAKE_CORE_INCLUDE_PATH#', $contents); + $this->assertMatchesRegularExpression('#//define\(\'CAKE_CORE_INCLUDE_PATH#', $contents); ini_set('include_path', $restore); } @@ -261,7 +261,7 @@ class ProjectTaskTest extends CakeTestCase { $File = new File($path . 'Config' . DS . 'core.php'); $contents = $File->read(); - $this->assertRegExp('/\$prefix = \'.+\';/', $contents, '$prefix is not defined'); + $this->assertMatchesRegularExpression('/\$prefix = \'.+\';/', $contents, '$prefix is not defined'); $this->assertNotRegExp('/\$prefix = \'myapp_\';/', $contents, 'Default cache prefix left behind. %s'); } diff --git a/lib/Cake/Test/Case/Console/Command/Task/TemplateTaskTest.php b/lib/Cake/Test/Case/Console/Command/Task/TemplateTaskTest.php index 86332f82e..e90968f06 100644 --- a/lib/Cake/Test/Case/Console/Command/Task/TemplateTaskTest.php +++ b/lib/Cake/Test/Case/Console/Command/Task/TemplateTaskTest.php @@ -159,6 +159,6 @@ class TemplateTaskTest extends CakeTestCase { 'schema' => '' )); $result = $this->Task->generate('classes', 'fixture'); - $this->assertRegExp('/ArticleFixture extends CakeTestFixture/', $result); + $this->assertMatchesRegularExpression('/ArticleFixture extends CakeTestFixture/', $result); } } diff --git a/lib/Cake/Test/Case/Console/Command/Task/ViewTaskTest.php b/lib/Cake/Test/Case/Console/Command/Task/ViewTaskTest.php index b686c95a8..c7dac2a7f 100644 --- a/lib/Cake/Test/Case/Console/Command/Task/ViewTaskTest.php +++ b/lib/Cake/Test/Case/Console/Command/Task/ViewTaskTest.php @@ -233,14 +233,14 @@ class ViewTaskTest extends CakeTestCase { ); $result = $this->Task->getContent('view', $vars); - $this->assertRegExp('/Delete Test View Model/', $result); - $this->assertRegExp('/Edit Test View Model/', $result); - $this->assertRegExp('/List Test View Models/', $result); - $this->assertRegExp('/New Test View Model/', $result); + $this->assertMatchesRegularExpression('/Delete Test View Model/', $result); + $this->assertMatchesRegularExpression('/Edit Test View Model/', $result); + $this->assertMatchesRegularExpression('/List Test View Models/', $result); + $this->assertMatchesRegularExpression('/New Test View Model/', $result); - $this->assertRegExp('/testViewModel\[\'TestViewModel\'\]\[\'id\'\]/', $result); - $this->assertRegExp('/testViewModel\[\'TestViewModel\'\]\[\'name\'\]/', $result); - $this->assertRegExp('/testViewModel\[\'TestViewModel\'\]\[\'body\'\]/', $result); + $this->assertMatchesRegularExpression('/testViewModel\[\'TestViewModel\'\]\[\'id\'\]/', $result); + $this->assertMatchesRegularExpression('/testViewModel\[\'TestViewModel\'\]\[\'name\'\]/', $result); + $this->assertMatchesRegularExpression('/testViewModel\[\'TestViewModel\'\]\[\'body\'\]/', $result); } /** @@ -265,19 +265,19 @@ class ViewTaskTest extends CakeTestCase { ); $result = $this->Task->getContent('admin_view', $vars); - $this->assertRegExp('/Delete Test View Model/', $result); - $this->assertRegExp('/Edit Test View Model/', $result); - $this->assertRegExp('/List Test View Models/', $result); - $this->assertRegExp('/New Test View Model/', $result); + $this->assertMatchesRegularExpression('/Delete Test View Model/', $result); + $this->assertMatchesRegularExpression('/Edit Test View Model/', $result); + $this->assertMatchesRegularExpression('/List Test View Models/', $result); + $this->assertMatchesRegularExpression('/New Test View Model/', $result); - $this->assertRegExp('/testViewModel\[\'TestViewModel\'\]\[\'id\'\]/', $result); - $this->assertRegExp('/testViewModel\[\'TestViewModel\'\]\[\'name\'\]/', $result); - $this->assertRegExp('/testViewModel\[\'TestViewModel\'\]\[\'body\'\]/', $result); + $this->assertMatchesRegularExpression('/testViewModel\[\'TestViewModel\'\]\[\'id\'\]/', $result); + $this->assertMatchesRegularExpression('/testViewModel\[\'TestViewModel\'\]\[\'name\'\]/', $result); + $this->assertMatchesRegularExpression('/testViewModel\[\'TestViewModel\'\]\[\'body\'\]/', $result); $result = $this->Task->getContent('admin_add', $vars); - $this->assertRegExp("/input\('name'\)/", $result); - $this->assertRegExp("/input\('body'\)/", $result); - $this->assertRegExp('/List Test View Models/', $result); + $this->assertMatchesRegularExpression("/input\('name'\)/", $result); + $this->assertMatchesRegularExpression("/input\('body'\)/", $result); + $this->assertMatchesRegularExpression('/List Test View Models/', $result); Configure::write('Routing', $_back); } diff --git a/lib/Cake/Test/Case/Controller/Component/EmailComponentTest.php b/lib/Cake/Test/Case/Controller/Component/EmailComponentTest.php index 63a328b4a..19693e589 100644 --- a/lib/Cake/Test/Case/Controller/Component/EmailComponentTest.php +++ b/lib/Cake/Test/Case/Controller/Component/EmailComponentTest.php @@ -335,8 +335,8 @@ HTMLBLOC; $this->Controller->EmailTest->send(); $result = DebugCompTransport::$lastEmail; - $this->assertRegExp('/Test/', $result); - $this->assertRegExp('/http\:\/\/example\.com/', $result); + $this->assertMatchesRegularExpression('/Test/', $result); + $this->assertMatchesRegularExpression('/http\:\/\/example\.com/', $result); } /** @@ -356,13 +356,13 @@ HTMLBLOC; $this->assertTrue($this->Controller->EmailTest->send(null)); $result = DebugCompTransport::$lastEmail; - $this->assertRegExp('/To: test@example.com\n/', $result); - $this->assertRegExp('/Subject: \n/', $result); - $this->assertRegExp('/From: test@example.com\n/', $result); - $this->assertRegExp('/Date: ' . preg_quote(static::$sentDate) . '\n/', $result); - $this->assertRegExp('/X-Mailer: CakePHP Email Component\n/', $result); - $this->assertRegExp('/Content-Type: text\/plain; charset=UTF-8\n/', $result); - $this->assertRegExp('/Content-Transfer-Encoding: 8bitMessage:\n/', $result); + $this->assertMatchesRegularExpression('/To: test@example.com\n/', $result); + $this->assertMatchesRegularExpression('/Subject: \n/', $result); + $this->assertMatchesRegularExpression('/From: test@example.com\n/', $result); + $this->assertMatchesRegularExpression('/Date: ' . preg_quote(static::$sentDate) . '\n/', $result); + $this->assertMatchesRegularExpression('/X-Mailer: CakePHP Email Component\n/', $result); + $this->assertMatchesRegularExpression('/Content-Type: text\/plain; charset=UTF-8\n/', $result); + $this->assertMatchesRegularExpression('/Content-Transfer-Encoding: 8bitMessage:\n/', $result); } /** @@ -383,17 +383,17 @@ HTMLBLOC; $this->assertTrue($this->Controller->EmailTest->send('This is the body of the message')); $result = DebugCompTransport::$lastEmail; - $this->assertRegExp('/To: postmaster@example.com\n/', $result); - $this->assertRegExp('/Subject: Cake Debug Test\n/', $result); - $this->assertRegExp('/Reply-To: noreply@example.com\n/', $result); - $this->assertRegExp('/From: noreply@example.com\n/', $result); - $this->assertRegExp('/Cc: cc@example.com\n/', $result); - $this->assertRegExp('/Bcc: bcc@example.com\n/', $result); - $this->assertRegExp('/Date: ' . preg_quote(static::$sentDate) . '\n/', $result); - $this->assertRegExp('/X-Mailer: CakePHP Email Component\n/', $result); - $this->assertRegExp('/Content-Type: text\/plain; charset=UTF-8\n/', $result); - $this->assertRegExp('/Content-Transfer-Encoding: 8bitMessage:\n/', $result); - $this->assertRegExp('/This is the body of the message/', $result); + $this->assertMatchesRegularExpression('/To: postmaster@example.com\n/', $result); + $this->assertMatchesRegularExpression('/Subject: Cake Debug Test\n/', $result); + $this->assertMatchesRegularExpression('/Reply-To: noreply@example.com\n/', $result); + $this->assertMatchesRegularExpression('/From: noreply@example.com\n/', $result); + $this->assertMatchesRegularExpression('/Cc: cc@example.com\n/', $result); + $this->assertMatchesRegularExpression('/Bcc: bcc@example.com\n/', $result); + $this->assertMatchesRegularExpression('/Date: ' . preg_quote(static::$sentDate) . '\n/', $result); + $this->assertMatchesRegularExpression('/X-Mailer: CakePHP Email Component\n/', $result); + $this->assertMatchesRegularExpression('/Content-Type: text\/plain; charset=UTF-8\n/', $result); + $this->assertMatchesRegularExpression('/Content-Transfer-Encoding: 8bitMessage:\n/', $result); + $this->assertMatchesRegularExpression('/This is the body of the message/', $result); } /** @@ -414,15 +414,15 @@ HTMLBLOC; $this->Controller->EmailTest->send('This is the body of the message'); $result = DebugCompTransport::$lastEmail; - $this->assertRegExp('/To: postmaster@example.com\n/', $result); - $this->assertRegExp('/Subject: Cake Debug Test\n/', $result); - $this->assertRegExp('/Reply-To: noreply@example.com\n/', $result); - $this->assertRegExp('/From: noreply@example.com\n/', $result); - $this->assertRegExp('/Date: ' . preg_quote(static::$sentDate) . '\n/', $result); - $this->assertRegExp('/X-Mailer: CakePHP Email Component\n/', $result); - $this->assertRegExp('/Content-Type: text\/plain; charset=UTF-8\n/', $result); - $this->assertRegExp('/Content-Transfer-Encoding: 8bitMessage:\n/', $result); - $this->assertRegExp('/This is the body of the message/', $result); + $this->assertMatchesRegularExpression('/To: postmaster@example.com\n/', $result); + $this->assertMatchesRegularExpression('/Subject: Cake Debug Test\n/', $result); + $this->assertMatchesRegularExpression('/Reply-To: noreply@example.com\n/', $result); + $this->assertMatchesRegularExpression('/From: noreply@example.com\n/', $result); + $this->assertMatchesRegularExpression('/Date: ' . preg_quote(static::$sentDate) . '\n/', $result); + $this->assertMatchesRegularExpression('/X-Mailer: CakePHP Email Component\n/', $result); + $this->assertMatchesRegularExpression('/Content-Type: text\/plain; charset=UTF-8\n/', $result); + $this->assertMatchesRegularExpression('/Content-Transfer-Encoding: 8bitMessage:\n/', $result); + $this->assertMatchesRegularExpression('/This is the body of the message/', $result); $this->Controller->Session = $session; } @@ -568,16 +568,16 @@ HTMLBLOC; $this->assertTrue($this->Controller->EmailTest->send($content)); $result = DebugCompTransport::$lastEmail; - $this->assertRegExp('/To: postmaster@example.com\n/', $result); - $this->assertRegExp('/Subject: Cake Debug Test\n/', $result); - $this->assertRegExp('/Reply-To: noreply@example.com\n/', $result); - $this->assertRegExp('/From: noreply@example.com\n/', $result); - $this->assertRegExp('/X-Mailer: CakePHP Email Component\n/', $result); - $this->assertRegExp('/Content-Type: text\/plain; charset=UTF-8\n/', $result); - $this->assertRegExp('/Content-Transfer-Encoding: 8bitMessage:\n/', $result); - $this->assertRegExp('/First line\n/', $result); - $this->assertRegExp('/Second line\n/', $result); - $this->assertRegExp('/Third line\n/', $result); + $this->assertMatchesRegularExpression('/To: postmaster@example.com\n/', $result); + $this->assertMatchesRegularExpression('/Subject: Cake Debug Test\n/', $result); + $this->assertMatchesRegularExpression('/Reply-To: noreply@example.com\n/', $result); + $this->assertMatchesRegularExpression('/From: noreply@example.com\n/', $result); + $this->assertMatchesRegularExpression('/X-Mailer: CakePHP Email Component\n/', $result); + $this->assertMatchesRegularExpression('/Content-Type: text\/plain; charset=UTF-8\n/', $result); + $this->assertMatchesRegularExpression('/Content-Transfer-Encoding: 8bitMessage:\n/', $result); + $this->assertMatchesRegularExpression('/First line\n/', $result); + $this->assertMatchesRegularExpression('/Second line\n/', $result); + $this->assertMatchesRegularExpression('/Third line\n/', $result); } /** @@ -595,7 +595,7 @@ HTMLBLOC; $this->assertTrue($this->Controller->EmailTest->send('test message')); $result = DebugCompTransport::$lastEmail; - $this->assertRegExp('/Date: Today!\n/', $result); + $this->assertMatchesRegularExpression('/Date: Today!\n/', $result); } /** @@ -709,8 +709,8 @@ HTMLBLOC; $this->Controller->EmailTest->sendAs = 'text'; $this->assertTrue($this->Controller->EmailTest->send($body)); $msg = DebugCompTransport::$lastEmail; - $this->assertRegExp('/' . preg_quote('Content-Disposition: attachment; filename="EmailComponentTest.php"') . '/', $msg); - $this->assertRegExp('/' . preg_quote('Content-Disposition: attachment; filename="some-name.php"') . '/', $msg); + $this->assertMatchesRegularExpression('/' . preg_quote('Content-Disposition: attachment; filename="EmailComponentTest.php"') . '/', $msg); + $this->assertMatchesRegularExpression('/' . preg_quote('Content-Disposition: attachment; filename="some-name.php"') . '/', $msg); } /** @@ -732,21 +732,21 @@ HTMLBLOC; $this->assertTrue($this->Controller->EmailTest->send($body)); $msg = DebugCompTransport::$lastEmail; $this->assertNotRegExp('/text\/plain/', $msg); - $this->assertRegExp('/text\/html/', $msg); + $this->assertMatchesRegularExpression('/text\/html/', $msg); $this->Controller->EmailTest->sendAs = 'text'; $this->assertTrue($this->Controller->EmailTest->send($body)); $msg = DebugCompTransport::$lastEmail; - $this->assertRegExp('/text\/plain/', $msg); + $this->assertMatchesRegularExpression('/text\/plain/', $msg); $this->assertNotRegExp('/text\/html/', $msg); $this->Controller->EmailTest->sendAs = 'both'; $this->assertTrue($this->Controller->EmailTest->send($body)); $msg = DebugCompTransport::$lastEmail; - $this->assertRegExp('/text\/plain/', $msg); - $this->assertRegExp('/text\/html/', $msg); - $this->assertRegExp('/multipart\/alternative/', $msg); + $this->assertMatchesRegularExpression('/text\/plain/', $msg); + $this->assertMatchesRegularExpression('/text\/html/', $msg); + $this->assertMatchesRegularExpression('/multipart\/alternative/', $msg); } /** @@ -768,7 +768,7 @@ HTMLBLOC; $msg = DebugCompTransport::$lastEmail; $this->assertNotRegExp('/\n\nContent-Transfer-Encoding/', $msg); - $this->assertRegExp('/\nContent-Transfer-Encoding/', $msg); + $this->assertMatchesRegularExpression('/\nContent-Transfer-Encoding/', $msg); } /** @@ -838,7 +838,7 @@ HTMLBLOC; $this->assertTrue($this->Controller->EmailTest->send($body)); $result = DebugCompTransport::$lastEmail; - $this->assertRegExp('/Body of message/', $result); + $this->assertMatchesRegularExpression('/Body of message/', $result); } /** @@ -867,14 +867,14 @@ HTMLBLOC; $result = DebugCompTransport::$lastEmail; $host = env('HTTP_HOST') ? env('HTTP_HOST') : php_uname('n'); - $this->assertRegExp('/Message-ID: \<[a-f0-9]{8}[a-f0-9]{4}[a-f0-9]{4}[a-f0-9]{4}[a-f0-9]{12}@' . $host . '\>\n/', $result); + $this->assertMatchesRegularExpression('/Message-ID: \<[a-f0-9]{8}[a-f0-9]{4}[a-f0-9]{4}[a-f0-9]{4}[a-f0-9]{12}@' . $host . '\>\n/', $result); $this->Controller->EmailTest->messageId = '<22091985.998877@example.com>'; $this->assertTrue($this->Controller->EmailTest->send('This is the body of the message')); $result = DebugCompTransport::$lastEmail; - $this->assertRegExp('/Message-ID: <22091985.998877@example.com>\n/', $result); + $this->assertMatchesRegularExpression('/Message-ID: <22091985.998877@example.com>\n/', $result); $this->Controller->EmailTest->messageId = false; diff --git a/lib/Cake/Test/Case/Controller/Component/RequestHandlerComponentTest.php b/lib/Cake/Test/Case/Controller/Component/RequestHandlerComponentTest.php index 8747aaed3..dce0730a1 100644 --- a/lib/Cake/Test/Case/Controller/Component/RequestHandlerComponentTest.php +++ b/lib/Cake/Test/Case/Controller/Component/RequestHandlerComponentTest.php @@ -847,7 +847,7 @@ class RequestHandlerComponentTest extends CakeTestCase { $this->Controller, array('controller' => 'request_handler_test', 'action' => 'destination') ); $result = ob_get_clean(); - $this->assertRegExp('/posts index/', $result, 'RequestAction redirect failed.'); + $this->assertMatchesRegularExpression('/posts index/', $result, 'RequestAction redirect failed.'); App::build(); } @@ -876,8 +876,8 @@ class RequestHandlerComponentTest extends CakeTestCase { $this->Controller, array('controller' => 'request_handler_test', 'action' => 'ajax2_layout') ); $result = ob_get_clean(); - $this->assertRegExp('/posts index/', $result, 'RequestAction redirect failed.'); - $this->assertRegExp('/Ajax!/', $result, 'Layout was not rendered.'); + $this->assertMatchesRegularExpression('/posts index/', $result, 'RequestAction redirect failed.'); + $this->assertMatchesRegularExpression('/Ajax!/', $result, 'Layout was not rendered.'); App::build(); } diff --git a/lib/Cake/Test/Case/Controller/ControllerTest.php b/lib/Cake/Test/Case/Controller/ControllerTest.php index e474e340d..e66b44728 100644 --- a/lib/Cake/Test/Case/Controller/ControllerTest.php +++ b/lib/Cake/Test/Case/Controller/ControllerTest.php @@ -573,7 +573,7 @@ class ControllerTest extends CakeTestCase { $Controller->response = $this->getMock('CakeResponse', array('_sendHeader')); $Controller->flash('this should work', '/flash', 1, 'ajax2'); $result = $Controller->response->body(); - $this->assertRegExp('/Ajax!/', $result); + $this->assertMatchesRegularExpression('/Ajax!/', $result); App::build(); } @@ -635,14 +635,14 @@ class ControllerTest extends CakeTestCase { $Controller->viewPath = 'Posts'; $result = $Controller->render('index'); - $this->assertRegExp('/posts index/', (string)$result); + $this->assertMatchesRegularExpression('/posts index/', (string)$result); $Controller->view = 'index'; $result = $Controller->render(); - $this->assertRegExp('/posts index/', (string)$result); + $this->assertMatchesRegularExpression('/posts index/', (string)$result); $result = $Controller->render('/Elements/test_element'); - $this->assertRegExp('/this is the test element/', (string)$result); + $this->assertMatchesRegularExpression('/this is the test element/', (string)$result); $Controller->view = null; $Controller = new TestController($request, new CakeResponse()); @@ -688,7 +688,7 @@ class ControllerTest extends CakeTestCase { $Controller->viewPath = 'Posts'; $Controller->theme = 'TestTheme'; $result = $Controller->render('index'); - $this->assertRegExp('/default test_theme layout/', (string)$result); + $this->assertMatchesRegularExpression('/default test_theme layout/', (string)$result); App::build(); } diff --git a/lib/Cake/Test/Case/Controller/PagesControllerTest.php b/lib/Cake/Test/Case/Controller/PagesControllerTest.php index 12a3c682d..d623d397f 100644 --- a/lib/Cake/Test/Case/Controller/PagesControllerTest.php +++ b/lib/Cake/Test/Case/Controller/PagesControllerTest.php @@ -41,12 +41,12 @@ class PagesControllerTest extends CakeTestCase { $Pages->viewPath = 'Posts'; $Pages->display('index'); - $this->assertRegExp('/posts index/', $Pages->response->body()); + $this->assertMatchesRegularExpression('/posts index/', $Pages->response->body()); $this->assertEquals('index', $Pages->viewVars['page']); $Pages->viewPath = 'Themed'; $Pages->display('TestTheme', 'Posts', 'index'); - $this->assertRegExp('/posts index themed view/', $Pages->response->body()); + $this->assertMatchesRegularExpression('/posts index themed view/', $Pages->response->body()); $this->assertEquals('TestTheme', $Pages->viewVars['page']); $this->assertEquals('Posts', $Pages->viewVars['subpage']); } diff --git a/lib/Cake/Test/Case/Controller/ScaffoldTest.php b/lib/Cake/Test/Case/Controller/ScaffoldTest.php index 753cbbb80..5f745ad77 100644 --- a/lib/Cake/Test/Case/Controller/ScaffoldTest.php +++ b/lib/Cake/Test/Case/Controller/ScaffoldTest.php @@ -303,7 +303,7 @@ class ScaffoldTest extends CakeTestCase { new Scaffold($this->Controller, $this->Controller->request); $this->Controller->response->send(); $result = ob_get_clean(); - $this->assertRegExp('/Scaffold Mock has been updated/', $result); + $this->assertMatchesRegularExpression('/Scaffold Mock has been updated/', $result); } /** @@ -336,7 +336,7 @@ class ScaffoldTest extends CakeTestCase { $Scaffold = new Scaffold($this->Controller, $this->Controller->request); $this->Controller->response->send(); $result = ob_get_clean(); - $this->assertRegExp('/name="data\[ScaffoldTag\]\[ScaffoldTag\]"/', $result); + $this->assertMatchesRegularExpression('/name="data\[ScaffoldTag\]\[ScaffoldTag\]"/', $result); $result = $Scaffold->controller->viewVars; $this->assertEquals(array('id', 'user_id', 'title', 'body', 'published', 'created', 'updated', 'ScaffoldTag'), $result['scaffoldFields']); @@ -413,6 +413,6 @@ class ScaffoldTest extends CakeTestCase { $this->Controller->response->send(); $result = ob_get_clean(); - $this->assertRegExp('/Scaffold Error/', $result); + $this->assertMatchesRegularExpression('/Scaffold Error/', $result); } } diff --git a/lib/Cake/Test/Case/Core/CakeObjectTest.php b/lib/Cake/Test/Case/Core/CakeObjectTest.php index d74d61d0d..5d829da07 100644 --- a/lib/Cake/Test/Case/Core/CakeObjectTest.php +++ b/lib/Cake/Test/Case/Core/CakeObjectTest.php @@ -321,21 +321,21 @@ class ObjectTest extends CakeTestCase { $this->assertTrue($this->object->log('Test warning 1')); $this->assertTrue($this->object->log(array('Test' => 'warning 2'))); $result = file(LOGS . 'error.log'); - $this->assertRegExp('/^2[0-9]{3}-[0-9]+-[0-9]+ [0-9]+:[0-9]+:[0-9]+ Error: Test warning 1$/', $result[0]); - $this->assertRegExp('/^2[0-9]{3}-[0-9]+-[0-9]+ [0-9]+:[0-9]+:[0-9]+ Error: Array$/', $result[1]); - $this->assertRegExp('/^\($/', $result[2]); - $this->assertRegExp('/\[Test\] => warning 2$/', $result[3]); - $this->assertRegExp('/^\)$/', $result[4]); + $this->assertMatchesRegularExpression('/^2[0-9]{3}-[0-9]+-[0-9]+ [0-9]+:[0-9]+:[0-9]+ Error: Test warning 1$/', $result[0]); + $this->assertMatchesRegularExpression('/^2[0-9]{3}-[0-9]+-[0-9]+ [0-9]+:[0-9]+:[0-9]+ Error: Array$/', $result[1]); + $this->assertMatchesRegularExpression('/^\($/', $result[2]); + $this->assertMatchesRegularExpression('/\[Test\] => warning 2$/', $result[3]); + $this->assertMatchesRegularExpression('/^\)$/', $result[4]); unlink(LOGS . 'error.log'); $this->assertTrue($this->object->log('Test warning 1', LOG_WARNING)); $this->assertTrue($this->object->log(array('Test' => 'warning 2'), LOG_WARNING)); $result = file(LOGS . 'error.log'); - $this->assertRegExp('/^2[0-9]{3}-[0-9]+-[0-9]+ [0-9]+:[0-9]+:[0-9]+ Warning: Test warning 1$/', $result[0]); - $this->assertRegExp('/^2[0-9]{3}-[0-9]+-[0-9]+ [0-9]+:[0-9]+:[0-9]+ Warning: Array$/', $result[1]); - $this->assertRegExp('/^\($/', $result[2]); - $this->assertRegExp('/\[Test\] => warning 2$/', $result[3]); - $this->assertRegExp('/^\)$/', $result[4]); + $this->assertMatchesRegularExpression('/^2[0-9]{3}-[0-9]+-[0-9]+ [0-9]+:[0-9]+:[0-9]+ Warning: Test warning 1$/', $result[0]); + $this->assertMatchesRegularExpression('/^2[0-9]{3}-[0-9]+-[0-9]+ [0-9]+:[0-9]+:[0-9]+ Warning: Array$/', $result[1]); + $this->assertMatchesRegularExpression('/^\($/', $result[2]); + $this->assertMatchesRegularExpression('/\[Test\] => warning 2$/', $result[3]); + $this->assertMatchesRegularExpression('/^\)$/', $result[4]); unlink(LOGS . 'error.log'); } diff --git a/lib/Cake/Test/Case/Error/ErrorHandlerTest.php b/lib/Cake/Test/Case/Error/ErrorHandlerTest.php index a0dad22a6..c729c7901 100644 --- a/lib/Cake/Test/Case/Error/ErrorHandlerTest.php +++ b/lib/Cake/Test/Case/Error/ErrorHandlerTest.php @@ -99,9 +99,9 @@ class ErrorHandlerTest extends CakeTestCase { $wrong .= ''; $result = ob_get_clean(); - $this->assertRegExp('/
/', $result); - $this->assertRegExp('/Notice<\/b>/', $result); - $this->assertRegExp('/variable:\s+wrong/', $result); + $this->assertMatchesRegularExpression('//', $result); + $this->assertMatchesRegularExpression('/Notice<\/b>/', $result); + $this->assertMatchesRegularExpression('/variable:\s+wrong/', $result); } /** @@ -132,7 +132,7 @@ class ErrorHandlerTest extends CakeTestCase { trigger_error('Test error', $error); $result = ob_get_clean(); - $this->assertRegExp('/' . $expected . '<\/b>/', $result); + $this->assertMatchesRegularExpression('/' . $expected . '<\/b>/', $result); } /** @@ -171,7 +171,7 @@ class ErrorHandlerTest extends CakeTestCase { $result = file(LOGS . 'debug.log'); $this->assertEquals(1, count($result)); - $this->assertRegExp( + $this->assertMatchesRegularExpression( '/^\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2} (Notice|Debug): Notice \(8\): Undefined variable:\s+out in \[.+ line \d+\]$/', $result[0] ); @@ -198,12 +198,12 @@ class ErrorHandlerTest extends CakeTestCase { $out .= ''; $result = file(LOGS . 'debug.log'); - $this->assertRegExp( + $this->assertMatchesRegularExpression( '/^\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2} (Notice|Debug): Notice \(8\): Undefined variable:\s+out in \[.+ line \d+\]$/', $result[0] ); - $this->assertRegExp('/^Trace:/', $result[1]); - $this->assertRegExp('/^ErrorHandlerTest\:\:testHandleErrorLoggingTrace\(\)/', $result[3]); + $this->assertMatchesRegularExpression('/^Trace:/', $result[1]); + $this->assertMatchesRegularExpression('/^ErrorHandlerTest\:\:testHandleErrorLoggingTrace\(\)/', $result[3]); if (file_exists(LOGS . 'debug.log')) { unlink(LOGS . 'debug.log'); } @@ -219,7 +219,7 @@ class ErrorHandlerTest extends CakeTestCase { ob_start(); ErrorHandler::handleException($error); $result = ob_get_clean(); - $this->assertRegExp('/Kaboom!/', $result, 'message missing.'); + $this->assertMatchesRegularExpression('/Kaboom!/', $result, 'message missing.'); } /** @@ -237,7 +237,7 @@ class ErrorHandlerTest extends CakeTestCase { ob_start(); ErrorHandler::handleException($error); $result = ob_get_clean(); - $this->assertRegExp('/Kaboom!/', $result, 'message missing.'); + $this->assertMatchesRegularExpression('/Kaboom!/', $result, 'message missing.'); $log = file(LOGS . 'error.log'); $this->assertContains('[NotFoundException] Kaboom!', $log[0], 'message missing.'); @@ -261,12 +261,12 @@ class ErrorHandlerTest extends CakeTestCase { ob_start(); ErrorHandler::handleException($notFound); $result = ob_get_clean(); - $this->assertRegExp('/Kaboom!/', $result, 'message missing.'); + $this->assertMatchesRegularExpression('/Kaboom!/', $result, 'message missing.'); ob_start(); ErrorHandler::handleException($forbidden); $result = ob_get_clean(); - $this->assertRegExp('/Fooled you!/', $result, 'message missing.'); + $this->assertMatchesRegularExpression('/Fooled you!/', $result, 'message missing.'); $log = file(LOGS . 'error.log'); $this->assertNotContains('[NotFoundException] Kaboom!', $log[0], 'message should not be logged.'); diff --git a/lib/Cake/Test/Case/Error/ExceptionRendererTest.php b/lib/Cake/Test/Case/Error/ExceptionRendererTest.php index c61c54256..5f21ff9c3 100644 --- a/lib/Cake/Test/Case/Error/ExceptionRendererTest.php +++ b/lib/Cake/Test/Case/Error/ExceptionRendererTest.php @@ -237,7 +237,7 @@ class ExceptionRendererTest extends CakeTestCase { $ExceptionRenderer->render(); $result = ob_get_clean(); - $this->assertRegExp('/Not Found/', $result, 'Method declared in error handler not converted to error400. %s'); + $this->assertMatchesRegularExpression('/Not Found/', $result, 'Method declared in error handler not converted to error400. %s'); } /** @@ -405,8 +405,8 @@ class ExceptionRendererTest extends CakeTestCase { $ExceptionRenderer->render(); $result = ob_get_clean(); - $this->assertRegExp('/Custom message<\/h2>/', $result); - $this->assertRegExp("/'.*?\/posts\/view\/1000'<\/strong>/", $result); + $this->assertMatchesRegularExpression('/
Custom message<\/h2>/', $result); + $this->assertMatchesRegularExpression("/'.*?\/posts\/view\/1000'<\/strong>/", $result); } /** @@ -471,7 +471,7 @@ class ExceptionRendererTest extends CakeTestCase { $ExceptionRenderer->render(); $result = ob_get_clean(); - $this->assertRegExp('/
An Internal Error Has Occurred<\/h2>/', $result); + $this->assertMatchesRegularExpression('/
An Internal Error Has Occurred<\/h2>/', $result); } /** @@ -508,8 +508,8 @@ class ExceptionRendererTest extends CakeTestCase { $ExceptionRenderer->render(); $result = ob_get_clean(); - $this->assertRegExp('/
Missing Controller<\/h2>/', $result); - $this->assertRegExp('/PostsController<\/em>/', $result); + $this->assertMatchesRegularExpression('/
Missing Controller<\/h2>/', $result); + $this->assertMatchesRegularExpression('/PostsController<\/em>/', $result); } /** @@ -672,7 +672,7 @@ class ExceptionRendererTest extends CakeTestCase { $result = ob_get_clean(); foreach ($patterns as $pattern) { - $this->assertRegExp($pattern, $result); + $this->assertMatchesRegularExpression($pattern, $result); } } diff --git a/lib/Cake/Test/Case/Log/CakeLogTest.php b/lib/Cake/Test/Case/Log/CakeLogTest.php index 0e5bb2d15..c4ce2345a 100644 --- a/lib/Cake/Test/Case/Log/CakeLogTest.php +++ b/lib/Cake/Test/Case/Log/CakeLogTest.php @@ -160,7 +160,7 @@ class CakeLogTest extends CakeTestCase { $this->assertTrue(file_exists(LOGS . 'error.log')); $result = file_get_contents(LOGS . 'error.log'); - $this->assertRegExp('/^2[0-9]{3}-[0-9]+-[0-9]+ [0-9]+:[0-9]+:[0-9]+ Warning: Test warning/', $result); + $this->assertMatchesRegularExpression('/^2[0-9]{3}-[0-9]+-[0-9]+ [0-9]+:[0-9]+:[0-9]+ Warning: Test warning/', $result); unlink(LOGS . 'error.log'); } @@ -203,8 +203,8 @@ class CakeLogTest extends CakeTestCase { CakeLog::write(LOG_WARNING, 'Test warning 1'); CakeLog::write(LOG_WARNING, 'Test warning 2'); $result = file_get_contents(LOGS . 'error.log'); - $this->assertRegExp('/^2[0-9]{3}-[0-9]+-[0-9]+ [0-9]+:[0-9]+:[0-9]+ Warning: Test warning 1/', $result); - $this->assertRegExp('/2[0-9]{3}-[0-9]+-[0-9]+ [0-9]+:[0-9]+:[0-9]+ Warning: Test warning 2$/', $result); + $this->assertMatchesRegularExpression('/^2[0-9]{3}-[0-9]+-[0-9]+ [0-9]+:[0-9]+:[0-9]+ Warning: Test warning 1/', $result); + $this->assertMatchesRegularExpression('/2[0-9]{3}-[0-9]+-[0-9]+ [0-9]+:[0-9]+:[0-9]+ Warning: Test warning 2$/', $result); unlink(LOGS . 'error.log'); } @@ -607,14 +607,14 @@ class CakeLogTest extends CakeTestCase { $testMessage = 'emergency message'; CakeLog::emergency($testMessage); $contents = file_get_contents(LOGS . 'error.log'); - $this->assertRegExp('/(Emergency|Critical): ' . $testMessage . '/', $contents); + $this->assertMatchesRegularExpression('/(Emergency|Critical): ' . $testMessage . '/', $contents); $this->assertFalse(file_exists(LOGS . 'debug.log')); $this->_deleteLogs(); $testMessage = 'alert message'; CakeLog::alert($testMessage); $contents = file_get_contents(LOGS . 'error.log'); - $this->assertRegExp('/(Alert|Critical): ' . $testMessage . '/', $contents); + $this->assertMatchesRegularExpression('/(Alert|Critical): ' . $testMessage . '/', $contents); $this->assertFalse(file_exists(LOGS . 'debug.log')); $this->_deleteLogs(); @@ -642,14 +642,14 @@ class CakeLogTest extends CakeTestCase { $testMessage = 'notice message'; CakeLog::notice($testMessage); $contents = file_get_contents(LOGS . 'debug.log'); - $this->assertRegExp('/(Notice|Debug): ' . $testMessage . '/', $contents); + $this->assertMatchesRegularExpression('/(Notice|Debug): ' . $testMessage . '/', $contents); $this->assertFalse(file_exists(LOGS . 'error.log')); $this->_deleteLogs(); $testMessage = 'info message'; CakeLog::info($testMessage); $contents = file_get_contents(LOGS . 'debug.log'); - $this->assertRegExp('/(Info|Debug): ' . $testMessage . '/', $contents); + $this->assertMatchesRegularExpression('/(Info|Debug): ' . $testMessage . '/', $contents); $this->assertFalse(file_exists(LOGS . 'error.log')); $this->_deleteLogs(); diff --git a/lib/Cake/Test/Case/Log/Engine/FileLogTest.php b/lib/Cake/Test/Case/Log/Engine/FileLogTest.php index 56df657d6..30a434999 100644 --- a/lib/Cake/Test/Case/Log/Engine/FileLogTest.php +++ b/lib/Cake/Test/Case/Log/Engine/FileLogTest.php @@ -38,19 +38,19 @@ class FileLogTest extends CakeTestCase { $this->assertTrue(file_exists(LOGS . 'error.log')); $result = file_get_contents(LOGS . 'error.log'); - $this->assertRegExp('/^2[0-9]{3}-[0-9]+-[0-9]+ [0-9]+:[0-9]+:[0-9]+ Warning: Test warning/', $result); + $this->assertMatchesRegularExpression('/^2[0-9]{3}-[0-9]+-[0-9]+ [0-9]+:[0-9]+:[0-9]+ Warning: Test warning/', $result); $log->write('debug', 'Test warning'); $this->assertTrue(file_exists(LOGS . 'debug.log')); $result = file_get_contents(LOGS . 'debug.log'); - $this->assertRegExp('/^2[0-9]{3}-[0-9]+-[0-9]+ [0-9]+:[0-9]+:[0-9]+ Debug: Test warning/', $result); + $this->assertMatchesRegularExpression('/^2[0-9]{3}-[0-9]+-[0-9]+ [0-9]+:[0-9]+:[0-9]+ Debug: Test warning/', $result); $log->write('random', 'Test warning'); $this->assertTrue(file_exists(LOGS . 'random.log')); $result = file_get_contents(LOGS . 'random.log'); - $this->assertRegExp('/^2[0-9]{3}-[0-9]+-[0-9]+ [0-9]+:[0-9]+:[0-9]+ Random: Test warning/', $result); + $this->assertMatchesRegularExpression('/^2[0-9]{3}-[0-9]+-[0-9]+ [0-9]+:[0-9]+:[0-9]+ Random: Test warning/', $result); } /** @@ -86,7 +86,7 @@ class FileLogTest extends CakeTestCase { $this->assertTrue(file_exists($path . 'error.log')); $result = file_get_contents($path . 'error.log'); - $this->assertRegExp('/Warning: Test warning one/', $result); + $this->assertMatchesRegularExpression('/Warning: Test warning one/', $result); $this->assertEquals(0, count(glob($path . 'error.log.*'))); clearstatcache(); @@ -96,24 +96,24 @@ class FileLogTest extends CakeTestCase { $this->assertEquals(1, count($files)); $result = file_get_contents($files[0]); - $this->assertRegExp('/this text is under 35 bytes/', $result); - $this->assertRegExp('/Warning: Test warning one/', $result); + $this->assertMatchesRegularExpression('/this text is under 35 bytes/', $result); + $this->assertMatchesRegularExpression('/Warning: Test warning one/', $result); sleep(1); clearstatcache(); $log->write('warning', 'Test warning third'); $result = file_get_contents($path . 'error.log'); - $this->assertRegExp('/Warning: Test warning third/', $result); + $this->assertMatchesRegularExpression('/Warning: Test warning third/', $result); $files = glob($path . 'error.log.*'); $this->assertEquals(2, count($files)); $result = file_get_contents($files[0]); - $this->assertRegExp('/this text is under 35 bytes/', $result); + $this->assertMatchesRegularExpression('/this text is under 35 bytes/', $result); $result = file_get_contents($files[1]); - $this->assertRegExp('/Warning: Test warning second/', $result); + $this->assertMatchesRegularExpression('/Warning: Test warning second/', $result); file_put_contents($path . 'error.log.0000000000', "The oldest log file with over 35 bytes.\n"); @@ -126,13 +126,13 @@ class FileLogTest extends CakeTestCase { $this->assertEquals(2, count($files)); $result = file_get_contents($path . 'error.log'); - $this->assertRegExp('/Warning: Test warning fourth/', $result); + $this->assertMatchesRegularExpression('/Warning: Test warning fourth/', $result); $result = file_get_contents(array_pop($files)); - $this->assertRegExp('/Warning: Test warning third/', $result); + $this->assertMatchesRegularExpression('/Warning: Test warning third/', $result); $result = file_get_contents(array_pop($files)); - $this->assertRegExp('/Warning: Test warning second/', $result); + $this->assertMatchesRegularExpression('/Warning: Test warning second/', $result); file_put_contents($path . 'debug.log', "this text is just greater than 35 bytes\n"); $log = new FileLog(array( @@ -145,7 +145,7 @@ class FileLogTest extends CakeTestCase { $this->assertTrue(file_exists($path . 'debug.log')); $result = file_get_contents($path . 'debug.log'); - $this->assertRegExp('/^2[0-9]{3}-[0-9]+-[0-9]+ [0-9]+:[0-9]+:[0-9]+ Debug: Test debug/', $result); + $this->assertMatchesRegularExpression('/^2[0-9]{3}-[0-9]+-[0-9]+ [0-9]+:[0-9]+:[0-9]+ Debug: Test debug/', $result); $this->assertFalse(strstr($result, 'greater than 5 bytes')); $this->assertEquals(0, count(glob($path . 'debug.log.*'))); } diff --git a/lib/Cake/Test/Case/Model/CakeSchemaTest.php b/lib/Cake/Test/Case/Model/CakeSchemaTest.php index ca1f03a45..ac3e5490e 100644 --- a/lib/Cake/Test/Case/Model/CakeSchemaTest.php +++ b/lib/Cake/Test/Case/Model/CakeSchemaTest.php @@ -736,7 +736,7 @@ class CakeSchemaTest extends CakeTestCase { 'indexes' => array('PRIMARY' => array('column' => 'id', 'unique' => true)), ); $result = $this->Schema->generateTable('posts', $posts); - $this->assertRegExp('/public \$posts/', $result); + $this->assertMatchesRegularExpression('/public \$posts/', $result); $posts = array( 'id' => array('type' => 'integer', 'null' => false, 'default' => 0, 'key' => 'primary'), @@ -752,8 +752,8 @@ class CakeSchemaTest extends CakeTestCase { ) ); $result = $this->Schema->generateTable('fields', $posts); - $this->assertRegExp('/public \$fields/', $result); - $this->assertRegExp('/\'type\' \=\> \'fulltext\'/', $result); + $this->assertMatchesRegularExpression('/public \$fields/', $result); + $this->assertMatchesRegularExpression('/\'type\' \=\> \'fulltext\'/', $result); } /** @@ -1154,11 +1154,11 @@ class CakeSchemaTest extends CakeTestCase { $col = $Schema->tables['testdescribes']['int_null']; $col['name'] = 'int_null'; $column = $this->db->buildColumn($col); - $this->assertRegExp('/' . preg_quote($column, '/') . '/', $sql); + $this->assertMatchesRegularExpression('/' . preg_quote($column, '/') . '/', $sql); $col = $Schema->tables['testdescribes']['int_not_null']; $col['name'] = 'int_not_null'; $column = $this->db->buildColumn($col); - $this->assertRegExp('/' . preg_quote($column, '/') . '/', $sql); + $this->assertMatchesRegularExpression('/' . preg_quote($column, '/') . '/', $sql); } } diff --git a/lib/Cake/Test/Case/Model/Datasource/Database/MysqlTest.php b/lib/Cake/Test/Case/Model/Datasource/Database/MysqlTest.php index b8806d26f..6fbc08df6 100644 --- a/lib/Cake/Test/Case/Model/Datasource/Database/MysqlTest.php +++ b/lib/Cake/Test/Case/Model/Datasource/Database/MysqlTest.php @@ -1211,7 +1211,7 @@ SQL; } $query = $this->Dbo->buildAssociationQuery($this->Model->Category2, $queryData); - $this->assertRegExp('/^SELECT\s+(.+)FROM(.+)`Category2`\.`group_id`\s+=\s+`Group`\.`id`\)\s+LEFT JOIN(.+)WHERE\s+1 = 1\s*$/', $query); + $this->assertMatchesRegularExpression('/^SELECT\s+(.+)FROM(.+)`Category2`\.`group_id`\s+=\s+`Group`\.`id`\)\s+LEFT JOIN(.+)WHERE\s+1 = 1\s*$/', $query); $this->Model = new TestModel4(); $this->Model->schema(); @@ -1258,10 +1258,10 @@ SQL; $this->assertEquals($expected, $queryData); $result = $this->Dbo->buildAssociationQuery($this->Model, $queryData); - $this->assertRegExp('/^SELECT\s+`TestModel4`\.`id`, `TestModel4`\.`name`, `TestModel4`\.`created`, `TestModel4`\.`updated`, `TestModel4Parent`\.`id`, `TestModel4Parent`\.`name`, `TestModel4Parent`\.`created`, `TestModel4Parent`\.`updated`\s+/', $result); - $this->assertRegExp('/FROM\s+\S+`test_model4` AS `TestModel4`\s+LEFT JOIN\s+\S+`test_model4` AS `TestModel4Parent`/', $result); - $this->assertRegExp('/\s+ON\s+\(`TestModel4`.`parent_id` = `TestModel4Parent`.`id`\)\s+WHERE/', $result); - $this->assertRegExp('/\s+WHERE\s+1 = 1$/', $result); + $this->assertMatchesRegularExpression('/^SELECT\s+`TestModel4`\.`id`, `TestModel4`\.`name`, `TestModel4`\.`created`, `TestModel4`\.`updated`, `TestModel4Parent`\.`id`, `TestModel4Parent`\.`name`, `TestModel4Parent`\.`created`, `TestModel4Parent`\.`updated`\s+/', $result); + $this->assertMatchesRegularExpression('/FROM\s+\S+`test_model4` AS `TestModel4`\s+LEFT JOIN\s+\S+`test_model4` AS `TestModel4Parent`/', $result); + $this->assertMatchesRegularExpression('/\s+ON\s+\(`TestModel4`.`parent_id` = `TestModel4Parent`.`id`\)\s+WHERE/', $result); + $this->assertMatchesRegularExpression('/\s+WHERE\s+1 = 1$/', $result); $params['assocData']['type'] = 'INNER'; $this->Model->belongsTo['TestModel4Parent']['type'] = 'INNER'; @@ -1421,10 +1421,10 @@ SQL; $this->assertTrue($result); $result = $this->Dbo->buildAssociationQuery($this->Model, $queryData); - $this->assertRegExp('/^SELECT\s+`TestModel8`\.`id`, `TestModel8`\.`test_model9_id`, `TestModel8`\.`name`, `TestModel8`\.`created`, `TestModel8`\.`updated`, `TestModel9`\.`id`, `TestModel9`\.`test_model8_id`, `TestModel9`\.`name`, `TestModel9`\.`created`, `TestModel9`\.`updated`\s+/', $result); - $this->assertRegExp('/FROM\s+\S+`test_model8` AS `TestModel8`\s+LEFT JOIN\s+\S+`test_model9` AS `TestModel9`/', $result); - $this->assertRegExp('/\s+ON\s+\(`TestModel9`\.`name` != \'mariano\'\s+AND\s+`TestModel9`.`test_model8_id` = `TestModel8`.`id`\)\s+WHERE/', $result); - $this->assertRegExp('/\s+WHERE\s+(?:\()?1\s+=\s+1(?:\))?\s*$/', $result); + $this->assertMatchesRegularExpression('/^SELECT\s+`TestModel8`\.`id`, `TestModel8`\.`test_model9_id`, `TestModel8`\.`name`, `TestModel8`\.`created`, `TestModel8`\.`updated`, `TestModel9`\.`id`, `TestModel9`\.`test_model8_id`, `TestModel9`\.`name`, `TestModel9`\.`created`, `TestModel9`\.`updated`\s+/', $result); + $this->assertMatchesRegularExpression('/FROM\s+\S+`test_model8` AS `TestModel8`\s+LEFT JOIN\s+\S+`test_model9` AS `TestModel9`/', $result); + $this->assertMatchesRegularExpression('/\s+ON\s+\(`TestModel9`\.`name` != \'mariano\'\s+AND\s+`TestModel9`.`test_model8_id` = `TestModel8`.`id`\)\s+WHERE/', $result); + $this->assertMatchesRegularExpression('/\s+WHERE\s+(?:\()?1\s+=\s+1(?:\))?\s*$/', $result); } /** @@ -1445,10 +1445,10 @@ SQL; $this->assertTrue($result); $result = $this->Dbo->buildAssociationQuery($this->Model, $queryData); - $this->assertRegExp('/^SELECT\s+`TestModel9`\.`id`, `TestModel9`\.`test_model8_id`, `TestModel9`\.`name`, `TestModel9`\.`created`, `TestModel9`\.`updated`, `TestModel8`\.`id`, `TestModel8`\.`test_model9_id`, `TestModel8`\.`name`, `TestModel8`\.`created`, `TestModel8`\.`updated`\s+/', $result); - $this->assertRegExp('/FROM\s+\S+`test_model9` AS `TestModel9`\s+LEFT JOIN\s+\S+`test_model8` AS `TestModel8`/', $result); - $this->assertRegExp('/\s+ON\s+\(`TestModel8`\.`name` != \'larry\'\s+AND\s+`TestModel9`.`test_model8_id` = `TestModel8`.`id`\)\s+WHERE/', $result); - $this->assertRegExp('/\s+WHERE\s+(?:\()?1\s+=\s+1(?:\))?\s*$/', $result); + $this->assertMatchesRegularExpression('/^SELECT\s+`TestModel9`\.`id`, `TestModel9`\.`test_model8_id`, `TestModel9`\.`name`, `TestModel9`\.`created`, `TestModel9`\.`updated`, `TestModel8`\.`id`, `TestModel8`\.`test_model9_id`, `TestModel8`\.`name`, `TestModel8`\.`created`, `TestModel8`\.`updated`\s+/', $result); + $this->assertMatchesRegularExpression('/FROM\s+\S+`test_model9` AS `TestModel9`\s+LEFT JOIN\s+\S+`test_model8` AS `TestModel8`/', $result); + $this->assertMatchesRegularExpression('/\s+ON\s+\(`TestModel8`\.`name` != \'larry\'\s+AND\s+`TestModel9`.`test_model8_id` = `TestModel8`.`id`\)\s+WHERE/', $result); + $this->assertMatchesRegularExpression('/\s+WHERE\s+(?:\()?1\s+=\s+1(?:\))?\s*$/', $result); } /** @@ -1470,10 +1470,10 @@ SQL; $this->assertTrue($result); $result = $this->Dbo->buildAssociationQuery($this->Model, $queryData); - $this->assertRegExp('/^SELECT\s+`TestModel4`\.`id`, `TestModel4`\.`name`, `TestModel4`\.`created`, `TestModel4`\.`updated`, `TestModel4Parent`\.`id`, `TestModel4Parent`\.`name`, `TestModel4Parent`\.`created`, `TestModel4Parent`\.`updated`\s+/', $result); - $this->assertRegExp('/FROM\s+\S+`test_model4` AS `TestModel4`\s+LEFT JOIN\s+\S+`test_model4` AS `TestModel4Parent`/', $result); - $this->assertRegExp('/\s+ON\s+\(`TestModel4`.`parent_id` = `TestModel4Parent`.`id`\)\s+WHERE/', $result); - $this->assertRegExp('/\s+WHERE\s+(?:\()?`TestModel4Parent`.`name`\s+!=\s+\'mariano\'(?:\))?\s*$/', $result); + $this->assertMatchesRegularExpression('/^SELECT\s+`TestModel4`\.`id`, `TestModel4`\.`name`, `TestModel4`\.`created`, `TestModel4`\.`updated`, `TestModel4Parent`\.`id`, `TestModel4Parent`\.`name`, `TestModel4Parent`\.`created`, `TestModel4Parent`\.`updated`\s+/', $result); + $this->assertMatchesRegularExpression('/FROM\s+\S+`test_model4` AS `TestModel4`\s+LEFT JOIN\s+\S+`test_model4` AS `TestModel4Parent`/', $result); + $this->assertMatchesRegularExpression('/\s+ON\s+\(`TestModel4`.`parent_id` = `TestModel4Parent`.`id`\)\s+WHERE/', $result); + $this->assertMatchesRegularExpression('/\s+WHERE\s+(?:\()?`TestModel4Parent`.`name`\s+!=\s+\'mariano\'(?:\))?\s*$/', $result); $this->Featured2 = new Featured2(); $this->Featured2->schema(); @@ -1498,7 +1498,7 @@ SQL; $this->assertTrue($result); $result = $this->Dbo->buildAssociationQuery($this->Featured2, $queryData); - $this->assertRegExp( + $this->assertMatchesRegularExpression( '/^SELECT\s+`Featured2`\.`id`, `Featured2`\.`article_id`, `Featured2`\.`category_id`, `Featured2`\.`name`,\s+' . '`ArticleFeatured2`\.`id`, `ArticleFeatured2`\.`title`, `ArticleFeatured2`\.`user_id`, `ArticleFeatured2`\.`published`\s+' . 'FROM\s+\S+`featured2` AS `Featured2`\s+LEFT JOIN\s+\S+`article_featured` AS `ArticleFeatured2`' . @@ -1533,10 +1533,10 @@ SQL; $this->assertEquals(trim($expected), trim($result)); $result = $this->Dbo->buildAssociationQuery($this->Model, $queryData); - $this->assertRegExp('/^SELECT\s+`TestModel4`\.`id`, `TestModel4`\.`name`, `TestModel4`\.`created`, `TestModel4`\.`updated`, `TestModel5`\.`id`, `TestModel5`\.`test_model4_id`, `TestModel5`\.`name`, `TestModel5`\.`created`, `TestModel5`\.`updated`\s+/', $result); - $this->assertRegExp('/\s+FROM\s+\S+`test_model4` AS `TestModel4`\s+LEFT JOIN\s+/', $result); - $this->assertRegExp('/`test_model5` AS `TestModel5`\s+ON\s+\(`TestModel5`.`test_model4_id` = `TestModel4`.`id`\)\s+WHERE/', $result); - $this->assertRegExp('/\s+WHERE\s+(?:\()?\s*1 = 1\s*(?:\))?\s*$/', $result); + $this->assertMatchesRegularExpression('/^SELECT\s+`TestModel4`\.`id`, `TestModel4`\.`name`, `TestModel4`\.`created`, `TestModel4`\.`updated`, `TestModel5`\.`id`, `TestModel5`\.`test_model4_id`, `TestModel5`\.`name`, `TestModel5`\.`created`, `TestModel5`\.`updated`\s+/', $result); + $this->assertMatchesRegularExpression('/\s+FROM\s+\S+`test_model4` AS `TestModel4`\s+LEFT JOIN\s+/', $result); + $this->assertMatchesRegularExpression('/`test_model5` AS `TestModel5`\s+ON\s+\(`TestModel5`.`test_model4_id` = `TestModel4`.`id`\)\s+WHERE/', $result); + $this->assertMatchesRegularExpression('/\s+WHERE\s+(?:\()?\s*1 = 1\s*(?:\))?\s*$/', $result); } /** @@ -1560,10 +1560,10 @@ SQL; $result = $this->Dbo->buildAssociationQuery($this->Model, $queryData); - $this->assertRegExp('/^SELECT\s+`TestModel4`\.`id`, `TestModel4`\.`name`, `TestModel4`\.`created`, `TestModel4`\.`updated`, `TestModel5`\.`id`, `TestModel5`\.`test_model4_id`, `TestModel5`\.`name`, `TestModel5`\.`created`, `TestModel5`\.`updated`\s+/', $result); - $this->assertRegExp('/\s+FROM\s+\S+`test_model4` AS `TestModel4`\s+LEFT JOIN\s+\S+`test_model5` AS `TestModel5`/', $result); - $this->assertRegExp('/\s+ON\s+\(`TestModel5`.`test_model4_id`\s+=\s+`TestModel4`.`id`\)\s+WHERE/', $result); - $this->assertRegExp('/\s+WHERE\s+(?:\()?\s*`TestModel5`.`name`\s+!=\s+\'mariano\'\s*(?:\))?\s*$/', $result); + $this->assertMatchesRegularExpression('/^SELECT\s+`TestModel4`\.`id`, `TestModel4`\.`name`, `TestModel4`\.`created`, `TestModel4`\.`updated`, `TestModel5`\.`id`, `TestModel5`\.`test_model4_id`, `TestModel5`\.`name`, `TestModel5`\.`created`, `TestModel5`\.`updated`\s+/', $result); + $this->assertMatchesRegularExpression('/\s+FROM\s+\S+`test_model4` AS `TestModel4`\s+LEFT JOIN\s+\S+`test_model5` AS `TestModel5`/', $result); + $this->assertMatchesRegularExpression('/\s+ON\s+\(`TestModel5`.`test_model4_id`\s+=\s+`TestModel4`.`id`\)\s+WHERE/', $result); + $this->assertMatchesRegularExpression('/\s+WHERE\s+(?:\()?\s*`TestModel5`.`name`\s+!=\s+\'mariano\'\s*(?:\))?\s*$/', $result); } /** @@ -1590,10 +1590,10 @@ SQL; $this->assertEquals(trim($expected), trim($result)); $result = $this->Dbo->buildAssociationQuery($this->Model, $queryData); - $this->assertRegExp('/^SELECT\s+`TestModel5`\.`id`, `TestModel5`\.`test_model4_id`, `TestModel5`\.`name`, `TestModel5`\.`created`, `TestModel5`\.`updated`, `TestModel4`\.`id`, `TestModel4`\.`name`, `TestModel4`\.`created`, `TestModel4`\.`updated`\s+/', $result); - $this->assertRegExp('/\s+FROM\s+\S+`test_model5` AS `TestModel5`\s+LEFT JOIN\s+\S+`test_model4` AS `TestModel4`/', $result); - $this->assertRegExp('/\s+ON\s+\(`TestModel5`.`test_model4_id` = `TestModel4`.`id`\)\s+WHERE\s+/', $result); - $this->assertRegExp('/\s+WHERE\s+(?:\()?\s*1 = 1\s*(?:\))?\s*$/', $result); + $this->assertMatchesRegularExpression('/^SELECT\s+`TestModel5`\.`id`, `TestModel5`\.`test_model4_id`, `TestModel5`\.`name`, `TestModel5`\.`created`, `TestModel5`\.`updated`, `TestModel4`\.`id`, `TestModel4`\.`name`, `TestModel4`\.`created`, `TestModel4`\.`updated`\s+/', $result); + $this->assertMatchesRegularExpression('/\s+FROM\s+\S+`test_model5` AS `TestModel5`\s+LEFT JOIN\s+\S+`test_model4` AS `TestModel4`/', $result); + $this->assertMatchesRegularExpression('/\s+ON\s+\(`TestModel5`.`test_model4_id` = `TestModel4`.`id`\)\s+WHERE\s+/', $result); + $this->assertMatchesRegularExpression('/\s+WHERE\s+(?:\()?\s*1 = 1\s*(?:\))?\s*$/', $result); } /** @@ -1620,10 +1620,10 @@ SQL; $this->assertEquals(trim($expected), trim($result)); $result = $this->Dbo->buildAssociationQuery($this->Model, $queryData); - $this->assertRegExp('/^SELECT\s+`TestModel5`\.`id`, `TestModel5`\.`test_model4_id`, `TestModel5`\.`name`, `TestModel5`\.`created`, `TestModel5`\.`updated`, `TestModel4`\.`id`, `TestModel4`\.`name`, `TestModel4`\.`created`, `TestModel4`\.`updated`\s+/', $result); - $this->assertRegExp('/\s+FROM\s+\S+`test_model5` AS `TestModel5`\s+LEFT JOIN\s+\S+`test_model4` AS `TestModel4`/', $result); - $this->assertRegExp('/\s+ON\s+\(`TestModel5`.`test_model4_id` = `TestModel4`.`id`\)\s+WHERE\s+/', $result); - $this->assertRegExp('/\s+WHERE\s+`TestModel5`.`name` != \'mariano\'\s*$/', $result); + $this->assertMatchesRegularExpression('/^SELECT\s+`TestModel5`\.`id`, `TestModel5`\.`test_model4_id`, `TestModel5`\.`name`, `TestModel5`\.`created`, `TestModel5`\.`updated`, `TestModel4`\.`id`, `TestModel4`\.`name`, `TestModel4`\.`created`, `TestModel4`\.`updated`\s+/', $result); + $this->assertMatchesRegularExpression('/\s+FROM\s+\S+`test_model5` AS `TestModel5`\s+LEFT JOIN\s+\S+`test_model4` AS `TestModel4`/', $result); + $this->assertMatchesRegularExpression('/\s+ON\s+\(`TestModel5`.`test_model4_id` = `TestModel4`.`id`\)\s+WHERE\s+/', $result); + $this->assertMatchesRegularExpression('/\s+WHERE\s+`TestModel5`.`name` != \'mariano\'\s*$/', $result); } /** @@ -1643,14 +1643,14 @@ SQL; $result = $this->Dbo->generateAssociationQuery($this->Model, $params['linkModel'], $params['type'], $params['assoc'], $params['assocData'], $queryData, $params['external']); - $this->assertRegExp('/^SELECT\s+`TestModel6`\.`id`, `TestModel6`\.`test_model5_id`, `TestModel6`\.`name`, `TestModel6`\.`created`, `TestModel6`\.`updated`\s+/', $result); - $this->assertRegExp('/\s+FROM\s+\S+`test_model6` AS `TestModel6`\s+WHERE/', $result); - $this->assertRegExp('/\s+WHERE\s+`TestModel6`.`test_model5_id`\s+=\s+\({\$__cakeID__\$}\)/', $result); + $this->assertMatchesRegularExpression('/^SELECT\s+`TestModel6`\.`id`, `TestModel6`\.`test_model5_id`, `TestModel6`\.`name`, `TestModel6`\.`created`, `TestModel6`\.`updated`\s+/', $result); + $this->assertMatchesRegularExpression('/\s+FROM\s+\S+`test_model6` AS `TestModel6`\s+WHERE/', $result); + $this->assertMatchesRegularExpression('/\s+WHERE\s+`TestModel6`.`test_model5_id`\s+=\s+\({\$__cakeID__\$}\)/', $result); $result = $this->Dbo->buildAssociationQuery($this->Model, $queryData); - $this->assertRegExp('/^SELECT\s+`TestModel5`\.`id`, `TestModel5`\.`test_model4_id`, `TestModel5`\.`name`, `TestModel5`\.`created`, `TestModel5`\.`updated`\s+/', $result); - $this->assertRegExp('/\s+FROM\s+\S+`test_model5` AS `TestModel5`\s+WHERE\s+/', $result); - $this->assertRegExp('/\s+WHERE\s+(?:\()?\s*1 = 1\s*(?:\))?\s*$/', $result); + $this->assertMatchesRegularExpression('/^SELECT\s+`TestModel5`\.`id`, `TestModel5`\.`test_model4_id`, `TestModel5`\.`name`, `TestModel5`\.`created`, `TestModel5`\.`updated`\s+/', $result); + $this->assertMatchesRegularExpression('/\s+FROM\s+\S+`test_model5` AS `TestModel5`\s+WHERE\s+/', $result); + $this->assertMatchesRegularExpression('/\s+WHERE\s+(?:\()?\s*1 = 1\s*(?:\))?\s*$/', $result); } /** @@ -1671,7 +1671,7 @@ SQL; $params = &$this->_prepareAssociationQuery($this->Model, $queryData, $binding); $result = $this->Dbo->generateAssociationQuery($this->Model, $params['linkModel'], $params['type'], $params['assoc'], $params['assocData'], $queryData, $params['external']); - $this->assertRegExp( + $this->assertMatchesRegularExpression( '/^SELECT\s+' . '`TestModel6`\.`id`, `TestModel6`\.`test_model5_id`, `TestModel6`\.`name`, `TestModel6`\.`created`, `TestModel6`\.`updated`\s+' . 'FROM\s+\S+`test_model6` AS `TestModel6`\s+WHERE\s+' . @@ -1681,7 +1681,7 @@ SQL; ); $result = $this->Dbo->buildAssociationQuery($this->Model, $queryData); - $this->assertRegExp( + $this->assertMatchesRegularExpression( '/^SELECT\s+' . '`TestModel5`\.`id`, `TestModel5`\.`test_model4_id`, `TestModel5`\.`name`, `TestModel5`\.`created`, `TestModel5`\.`updated`\s+' . 'FROM\s+\S+`test_model5` AS `TestModel5`\s+WHERE\s+' . @@ -1706,14 +1706,14 @@ SQL; $params = &$this->_prepareAssociationQuery($this->Model, $queryData, $binding); $result = $this->Dbo->generateAssociationQuery($this->Model, $params['linkModel'], $params['type'], $params['assoc'], $params['assocData'], $queryData, $params['external']); - $this->assertRegExp('/^SELECT\s+`TestModel6`\.`id`, `TestModel6`\.`test_model5_id`, `TestModel6`\.`name`, `TestModel6`\.`created`, `TestModel6`\.`updated`\s+/', $result); - $this->assertRegExp('/\s+FROM\s+\S+`test_model6` AS `TestModel6`\s+WHERE\s+/', $result); - $this->assertRegExp('/WHERE\s+(?:\()?`TestModel6`\.`test_model5_id`\s+=\s+\({\$__cakeID__\$}\)(?:\))?/', $result); + $this->assertMatchesRegularExpression('/^SELECT\s+`TestModel6`\.`id`, `TestModel6`\.`test_model5_id`, `TestModel6`\.`name`, `TestModel6`\.`created`, `TestModel6`\.`updated`\s+/', $result); + $this->assertMatchesRegularExpression('/\s+FROM\s+\S+`test_model6` AS `TestModel6`\s+WHERE\s+/', $result); + $this->assertMatchesRegularExpression('/WHERE\s+(?:\()?`TestModel6`\.`test_model5_id`\s+=\s+\({\$__cakeID__\$}\)(?:\))?/', $result); $result = $this->Dbo->buildAssociationQuery($this->Model, $queryData); - $this->assertRegExp('/^SELECT\s+`TestModel5`\.`id`, `TestModel5`\.`test_model4_id`, `TestModel5`\.`name`, `TestModel5`\.`created`, `TestModel5`\.`updated`\s+/', $result); - $this->assertRegExp('/\s+FROM\s+\S+`test_model5` AS `TestModel5`\s+WHERE\s+/', $result); - $this->assertRegExp('/\s+WHERE\s+(?:\()?`TestModel5`.`name`\s+!=\s+\'mariano\'(?:\))?\s*$/', $result); + $this->assertMatchesRegularExpression('/^SELECT\s+`TestModel5`\.`id`, `TestModel5`\.`test_model4_id`, `TestModel5`\.`name`, `TestModel5`\.`created`, `TestModel5`\.`updated`\s+/', $result); + $this->assertMatchesRegularExpression('/\s+FROM\s+\S+`test_model5` AS `TestModel5`\s+WHERE\s+/', $result); + $this->assertMatchesRegularExpression('/\s+WHERE\s+(?:\()?`TestModel5`.`name`\s+!=\s+\'mariano\'(?:\))?\s*$/', $result); } /** @@ -1738,15 +1738,15 @@ SQL; $result = $this->Dbo->generateAssociationQuery($this->Model, $params['linkModel'], $params['type'], $params['assoc'], $params['assocData'], $queryData, $params['external']); - $this->assertRegExp('/^SELECT\s+`TestModel6`\.`id`, `TestModel6`\.`test_model5_id`, `TestModel6`\.`name`, `TestModel6`\.`created`, `TestModel6`\.`updated`\s+/', $result); - $this->assertRegExp('/\s+FROM\s+\S+`test_model6` AS `TestModel6`\s+WHERE\s+/', $result); - $this->assertRegExp('/WHERE\s+(?:\()?`TestModel6`\.`test_model5_id`\s+=\s+\({\$__cakeID__\$}\)(?:\))?/', $result); - $this->assertRegExp('/\s+LIMIT 2,\s*5\s*$/', $result); + $this->assertMatchesRegularExpression('/^SELECT\s+`TestModel6`\.`id`, `TestModel6`\.`test_model5_id`, `TestModel6`\.`name`, `TestModel6`\.`created`, `TestModel6`\.`updated`\s+/', $result); + $this->assertMatchesRegularExpression('/\s+FROM\s+\S+`test_model6` AS `TestModel6`\s+WHERE\s+/', $result); + $this->assertMatchesRegularExpression('/WHERE\s+(?:\()?`TestModel6`\.`test_model5_id`\s+=\s+\({\$__cakeID__\$}\)(?:\))?/', $result); + $this->assertMatchesRegularExpression('/\s+LIMIT 2,\s*5\s*$/', $result); $result = $this->Dbo->buildAssociationQuery($this->Model, $queryData); - $this->assertRegExp('/^SELECT\s+`TestModel5`\.`id`, `TestModel5`\.`test_model4_id`, `TestModel5`\.`name`, `TestModel5`\.`created`, `TestModel5`\.`updated`\s+/', $result); - $this->assertRegExp('/\s+FROM\s+\S+`test_model5` AS `TestModel5`\s+WHERE\s+/', $result); - $this->assertRegExp('/\s+WHERE\s+(?:\()?1\s+=\s+1(?:\))?\s*$/', $result); + $this->assertMatchesRegularExpression('/^SELECT\s+`TestModel5`\.`id`, `TestModel5`\.`test_model4_id`, `TestModel5`\.`name`, `TestModel5`\.`created`, `TestModel5`\.`updated`\s+/', $result); + $this->assertMatchesRegularExpression('/\s+FROM\s+\S+`test_model5` AS `TestModel5`\s+WHERE\s+/', $result); + $this->assertMatchesRegularExpression('/\s+WHERE\s+(?:\()?1\s+=\s+1(?:\))?\s*$/', $result); $this->Model->hasMany['TestModel6'] = $backup; } @@ -1771,15 +1771,15 @@ SQL; $params = &$this->_prepareAssociationQuery($this->Model, $queryData, $binding); $result = $this->Dbo->generateAssociationQuery($this->Model, $params['linkModel'], $params['type'], $params['assoc'], $params['assocData'], $queryData, $params['external']); - $this->assertRegExp('/^SELECT\s+`TestModel6`\.`id`, `TestModel6`\.`test_model5_id`, `TestModel6`\.`name`, `TestModel6`\.`created`, `TestModel6`\.`updated`\s+/', $result); - $this->assertRegExp('/\s+FROM\s+\S+`test_model6` AS `TestModel6`\s+WHERE\s+/', $result); - $this->assertRegExp('/WHERE\s+(?:\()?`TestModel6`\.`test_model5_id`\s+=\s+\({\$__cakeID__\$}\)(?:\))?/', $result); - $this->assertRegExp('/\s+LIMIT 5,\s*5\s*$/', $result); + $this->assertMatchesRegularExpression('/^SELECT\s+`TestModel6`\.`id`, `TestModel6`\.`test_model5_id`, `TestModel6`\.`name`, `TestModel6`\.`created`, `TestModel6`\.`updated`\s+/', $result); + $this->assertMatchesRegularExpression('/\s+FROM\s+\S+`test_model6` AS `TestModel6`\s+WHERE\s+/', $result); + $this->assertMatchesRegularExpression('/WHERE\s+(?:\()?`TestModel6`\.`test_model5_id`\s+=\s+\({\$__cakeID__\$}\)(?:\))?/', $result); + $this->assertMatchesRegularExpression('/\s+LIMIT 5,\s*5\s*$/', $result); $result = $this->Dbo->buildAssociationQuery($this->Model, $queryData); - $this->assertRegExp('/^SELECT\s+`TestModel5`\.`id`, `TestModel5`\.`test_model4_id`, `TestModel5`\.`name`, `TestModel5`\.`created`, `TestModel5`\.`updated`\s+/', $result); - $this->assertRegExp('/\s+FROM\s+\S+`test_model5` AS `TestModel5`\s+WHERE\s+/', $result); - $this->assertRegExp('/\s+WHERE\s+(?:\()?1\s+=\s+1(?:\))?\s*$/', $result); + $this->assertMatchesRegularExpression('/^SELECT\s+`TestModel5`\.`id`, `TestModel5`\.`test_model4_id`, `TestModel5`\.`name`, `TestModel5`\.`created`, `TestModel5`\.`updated`\s+/', $result); + $this->assertMatchesRegularExpression('/\s+FROM\s+\S+`test_model5` AS `TestModel5`\s+WHERE\s+/', $result); + $this->assertMatchesRegularExpression('/\s+WHERE\s+(?:\()?1\s+=\s+1(?:\))?\s*$/', $result); $this->Model->hasMany['TestModel6'] = $backup; } @@ -1800,14 +1800,14 @@ SQL; $params = &$this->_prepareAssociationQuery($this->Model, $queryData, $binding); $result = $this->Dbo->generateAssociationQuery($this->Model, $params['linkModel'], $params['type'], $params['assoc'], $params['assocData'], $queryData, $params['external']); - $this->assertRegExp('/^SELECT\s+`TestModel6`\.`id`, `TestModel6`\.`test_model5_id`, `TestModel6`\.`name`, `TestModel6`\.`created`, `TestModel6`\.`updated`\s+/', $result); - $this->assertRegExp('/\s+FROM\s+\S+`test_model6` AS `TestModel6`\s+WHERE\s+/', $result); - $this->assertRegExp('/WHERE\s+(?:\()?`TestModel6`\.`test_model5_id`\s+=\s+\({\$__cakeID__\$}\)(?:\))?/', $result); + $this->assertMatchesRegularExpression('/^SELECT\s+`TestModel6`\.`id`, `TestModel6`\.`test_model5_id`, `TestModel6`\.`name`, `TestModel6`\.`created`, `TestModel6`\.`updated`\s+/', $result); + $this->assertMatchesRegularExpression('/\s+FROM\s+\S+`test_model6` AS `TestModel6`\s+WHERE\s+/', $result); + $this->assertMatchesRegularExpression('/WHERE\s+(?:\()?`TestModel6`\.`test_model5_id`\s+=\s+\({\$__cakeID__\$}\)(?:\))?/', $result); $result = $this->Dbo->buildAssociationQuery($this->Model, $queryData); - $this->assertRegExp('/^SELECT\s+`TestModel5`\.`name`, `TestModel5`\.`id`\s+/', $result); - $this->assertRegExp('/\s+FROM\s+\S+`test_model5` AS `TestModel5`\s+WHERE\s+/', $result); - $this->assertRegExp('/\s+WHERE\s+(?:\()?1\s+=\s+1(?:\))?\s*$/', $result); + $this->assertMatchesRegularExpression('/^SELECT\s+`TestModel5`\.`name`, `TestModel5`\.`id`\s+/', $result); + $this->assertMatchesRegularExpression('/\s+FROM\s+\S+`test_model5` AS `TestModel5`\s+WHERE\s+/', $result); + $this->assertMatchesRegularExpression('/\s+WHERE\s+(?:\()?1\s+=\s+1(?:\))?\s*$/', $result); $binding = array('type' => 'hasMany', 'model' => 'TestModel6'); $queryData = array('fields' => array('`TestModel5`.`id`, `TestModel5`.`name`')); @@ -1815,14 +1815,14 @@ SQL; $params = &$this->_prepareAssociationQuery($this->Model, $queryData, $binding); $result = $this->Dbo->generateAssociationQuery($this->Model, $params['linkModel'], $params['type'], $params['assoc'], $params['assocData'], $queryData, $params['external']); - $this->assertRegExp('/^SELECT\s+`TestModel6`\.`id`, `TestModel6`\.`test_model5_id`, `TestModel6`\.`name`, `TestModel6`\.`created`, `TestModel6`\.`updated`\s+/', $result); - $this->assertRegExp('/\s+FROM\s+\S+`test_model6` AS `TestModel6`\s+WHERE\s+/', $result); - $this->assertRegExp('/WHERE\s+(?:\()?`TestModel6`\.`test_model5_id`\s+=\s+\({\$__cakeID__\$}\)(?:\))?/', $result); + $this->assertMatchesRegularExpression('/^SELECT\s+`TestModel6`\.`id`, `TestModel6`\.`test_model5_id`, `TestModel6`\.`name`, `TestModel6`\.`created`, `TestModel6`\.`updated`\s+/', $result); + $this->assertMatchesRegularExpression('/\s+FROM\s+\S+`test_model6` AS `TestModel6`\s+WHERE\s+/', $result); + $this->assertMatchesRegularExpression('/WHERE\s+(?:\()?`TestModel6`\.`test_model5_id`\s+=\s+\({\$__cakeID__\$}\)(?:\))?/', $result); $result = $this->Dbo->buildAssociationQuery($this->Model, $queryData); - $this->assertRegExp('/^SELECT\s+`TestModel5`\.`id`, `TestModel5`\.`name`\s+/', $result); - $this->assertRegExp('/\s+FROM\s+\S+`test_model5` AS `TestModel5`\s+WHERE\s+/', $result); - $this->assertRegExp('/\s+WHERE\s+(?:\()?1\s+=\s+1(?:\))?\s*$/', $result); + $this->assertMatchesRegularExpression('/^SELECT\s+`TestModel5`\.`id`, `TestModel5`\.`name`\s+/', $result); + $this->assertMatchesRegularExpression('/\s+FROM\s+\S+`test_model5` AS `TestModel5`\s+WHERE\s+/', $result); + $this->assertMatchesRegularExpression('/\s+WHERE\s+(?:\()?1\s+=\s+1(?:\))?\s*$/', $result); $binding = array('type' => 'hasMany', 'model' => 'TestModel6'); $queryData = array('fields' => array('`TestModel5`.`name`', '`TestModel5`.`created`')); @@ -1830,14 +1830,14 @@ SQL; $params = &$this->_prepareAssociationQuery($this->Model, $queryData, $binding); $result = $this->Dbo->generateAssociationQuery($this->Model, $params['linkModel'], $params['type'], $params['assoc'], $params['assocData'], $queryData, $params['external']); - $this->assertRegExp('/^SELECT\s+`TestModel6`\.`id`, `TestModel6`\.`test_model5_id`, `TestModel6`\.`name`, `TestModel6`\.`created`, `TestModel6`\.`updated`\s+/', $result); - $this->assertRegExp('/\s+FROM\s+\S+`test_model6` AS `TestModel6`\s+WHERE\s+/', $result); - $this->assertRegExp('/WHERE\s+(?:\()?`TestModel6`\.`test_model5_id`\s+=\s+\({\$__cakeID__\$}\)(?:\))?/', $result); + $this->assertMatchesRegularExpression('/^SELECT\s+`TestModel6`\.`id`, `TestModel6`\.`test_model5_id`, `TestModel6`\.`name`, `TestModel6`\.`created`, `TestModel6`\.`updated`\s+/', $result); + $this->assertMatchesRegularExpression('/\s+FROM\s+\S+`test_model6` AS `TestModel6`\s+WHERE\s+/', $result); + $this->assertMatchesRegularExpression('/WHERE\s+(?:\()?`TestModel6`\.`test_model5_id`\s+=\s+\({\$__cakeID__\$}\)(?:\))?/', $result); $result = $this->Dbo->buildAssociationQuery($this->Model, $queryData); - $this->assertRegExp('/^SELECT\s+`TestModel5`\.`name`, `TestModel5`\.`created`, `TestModel5`\.`id`\s+/', $result); - $this->assertRegExp('/\s+FROM\s+\S+`test_model5` AS `TestModel5`\s+WHERE\s+/', $result); - $this->assertRegExp('/\s+WHERE\s+(?:\()?1\s+=\s+1(?:\))?\s*$/', $result); + $this->assertMatchesRegularExpression('/^SELECT\s+`TestModel5`\.`name`, `TestModel5`\.`created`, `TestModel5`\.`id`\s+/', $result); + $this->assertMatchesRegularExpression('/\s+FROM\s+\S+`test_model5` AS `TestModel5`\s+WHERE\s+/', $result); + $this->assertMatchesRegularExpression('/\s+WHERE\s+(?:\()?1\s+=\s+1(?:\))?\s*$/', $result); $this->Model->hasMany['TestModel6']['fields'] = array('name'); @@ -1847,14 +1847,14 @@ SQL; $params = &$this->_prepareAssociationQuery($this->Model, $queryData, $binding); $result = $this->Dbo->generateAssociationQuery($this->Model, $params['linkModel'], $params['type'], $params['assoc'], $params['assocData'], $queryData, $params['external']); - $this->assertRegExp('/^SELECT\s+`TestModel6`\.`name`, `TestModel6`\.`test_model5_id`\s+/', $result); - $this->assertRegExp('/\s+FROM\s+\S+`test_model6` AS `TestModel6`\s+WHERE\s+/', $result); - $this->assertRegExp('/WHERE\s+(?:\()?`TestModel6`\.`test_model5_id`\s+=\s+\({\$__cakeID__\$}\)(?:\))?/', $result); + $this->assertMatchesRegularExpression('/^SELECT\s+`TestModel6`\.`name`, `TestModel6`\.`test_model5_id`\s+/', $result); + $this->assertMatchesRegularExpression('/\s+FROM\s+\S+`test_model6` AS `TestModel6`\s+WHERE\s+/', $result); + $this->assertMatchesRegularExpression('/WHERE\s+(?:\()?`TestModel6`\.`test_model5_id`\s+=\s+\({\$__cakeID__\$}\)(?:\))?/', $result); $result = $this->Dbo->buildAssociationQuery($this->Model, $queryData); - $this->assertRegExp('/^SELECT\s+`TestModel5`\.`id`, `TestModel5`\.`name`\s+/', $result); - $this->assertRegExp('/\s+FROM\s+\S+`test_model5` AS `TestModel5`\s+WHERE\s+/', $result); - $this->assertRegExp('/\s+WHERE\s+(?:\()?1\s+=\s+1(?:\))?\s*$/', $result); + $this->assertMatchesRegularExpression('/^SELECT\s+`TestModel5`\.`id`, `TestModel5`\.`name`\s+/', $result); + $this->assertMatchesRegularExpression('/\s+FROM\s+\S+`test_model5` AS `TestModel5`\s+WHERE\s+/', $result); + $this->assertMatchesRegularExpression('/\s+WHERE\s+(?:\()?1\s+=\s+1(?:\))?\s*$/', $result); unset($this->Model->hasMany['TestModel6']['fields']); @@ -1866,14 +1866,14 @@ SQL; $params = &$this->_prepareAssociationQuery($this->Model, $queryData, $binding); $result = $this->Dbo->generateAssociationQuery($this->Model, $params['linkModel'], $params['type'], $params['assoc'], $params['assocData'], $queryData, $params['external']); - $this->assertRegExp('/^SELECT\s+`TestModel6`\.`id`, `TestModel6`\.`name`, `TestModel6`\.`test_model5_id`\s+/', $result); - $this->assertRegExp('/\s+FROM\s+\S+`test_model6` AS `TestModel6`\s+WHERE\s+/', $result); - $this->assertRegExp('/WHERE\s+(?:\()?`TestModel6`\.`test_model5_id`\s+=\s+\({\$__cakeID__\$}\)(?:\))?/', $result); + $this->assertMatchesRegularExpression('/^SELECT\s+`TestModel6`\.`id`, `TestModel6`\.`name`, `TestModel6`\.`test_model5_id`\s+/', $result); + $this->assertMatchesRegularExpression('/\s+FROM\s+\S+`test_model6` AS `TestModel6`\s+WHERE\s+/', $result); + $this->assertMatchesRegularExpression('/WHERE\s+(?:\()?`TestModel6`\.`test_model5_id`\s+=\s+\({\$__cakeID__\$}\)(?:\))?/', $result); $result = $this->Dbo->buildAssociationQuery($this->Model, $queryData); - $this->assertRegExp('/^SELECT\s+`TestModel5`\.`id`, `TestModel5`\.`name`\s+/', $result); - $this->assertRegExp('/\s+FROM\s+\S+`test_model5` AS `TestModel5`\s+WHERE\s+/', $result); - $this->assertRegExp('/\s+WHERE\s+(?:\()?1\s+=\s+1(?:\))?\s*$/', $result); + $this->assertMatchesRegularExpression('/^SELECT\s+`TestModel5`\.`id`, `TestModel5`\.`name`\s+/', $result); + $this->assertMatchesRegularExpression('/\s+FROM\s+\S+`test_model5` AS `TestModel5`\s+WHERE\s+/', $result); + $this->assertMatchesRegularExpression('/\s+WHERE\s+(?:\()?1\s+=\s+1(?:\))?\s*$/', $result); unset($this->Model->hasMany['TestModel6']['fields']); @@ -1885,14 +1885,14 @@ SQL; $params = &$this->_prepareAssociationQuery($this->Model, $queryData, $binding); $result = $this->Dbo->generateAssociationQuery($this->Model, $params['linkModel'], $params['type'], $params['assoc'], $params['assocData'], $queryData, $params['external']); - $this->assertRegExp('/^SELECT\s+`TestModel6`\.`test_model5_id`, `TestModel6`\.`name`\s+/', $result); - $this->assertRegExp('/\s+FROM\s+\S+`test_model6` AS `TestModel6`\s+WHERE\s+/', $result); - $this->assertRegExp('/WHERE\s+(?:\()?`TestModel6`\.`test_model5_id`\s+=\s+\({\$__cakeID__\$}\)(?:\))?/', $result); + $this->assertMatchesRegularExpression('/^SELECT\s+`TestModel6`\.`test_model5_id`, `TestModel6`\.`name`\s+/', $result); + $this->assertMatchesRegularExpression('/\s+FROM\s+\S+`test_model6` AS `TestModel6`\s+WHERE\s+/', $result); + $this->assertMatchesRegularExpression('/WHERE\s+(?:\()?`TestModel6`\.`test_model5_id`\s+=\s+\({\$__cakeID__\$}\)(?:\))?/', $result); $result = $this->Dbo->buildAssociationQuery($this->Model, $queryData); - $this->assertRegExp('/^SELECT\s+`TestModel5`\.`id`, `TestModel5`\.`name`\s+/', $result); - $this->assertRegExp('/\s+FROM\s+\S+`test_model5` AS `TestModel5`\s+WHERE\s+/', $result); - $this->assertRegExp('/\s+WHERE\s+(?:\()?1\s+=\s+1(?:\))?\s*$/', $result); + $this->assertMatchesRegularExpression('/^SELECT\s+`TestModel5`\.`id`, `TestModel5`\.`name`\s+/', $result); + $this->assertMatchesRegularExpression('/\s+FROM\s+\S+`test_model5` AS `TestModel5`\s+WHERE\s+/', $result); + $this->assertMatchesRegularExpression('/\s+WHERE\s+(?:\()?1\s+=\s+1(?:\))?\s*$/', $result); unset($this->Model->hasMany['TestModel6']['fields']); } @@ -1913,7 +1913,7 @@ SQL; $this->Model->recursive = 0; $result = $this->Dbo->buildAssociationQuery($this->Model, $queryData); - $this->assertRegExp('/^SELECT\s+MIN\(`TestModel5`\.`test_model4_id`\)\s+FROM/', $result); + $this->assertMatchesRegularExpression('/^SELECT\s+MIN\(`TestModel5`\.`test_model4_id`\)\s+FROM/', $result); } /** @@ -1933,16 +1933,16 @@ SQL; $result = $this->Dbo->generateAssociationQuery($this->Model, $params['linkModel'], $params['type'], $params['assoc'], $params['assocData'], $queryData, $params['external']); $assocTable = $this->Dbo->fullTableName($this->Model->TestModel4TestModel7, true, true); - $this->assertRegExp('/^SELECT\s+`TestModel7`\.`id`, `TestModel7`\.`name`, `TestModel7`\.`created`, `TestModel7`\.`updated`, `TestModel4TestModel7`\.`test_model4_id`, `TestModel4TestModel7`\.`test_model7_id`\s+/', $result); - $this->assertRegExp('/\s+FROM\s+\S+`test_model7` AS `TestModel7`\s+JOIN\s+' . $assocTable . '/', $result); - $this->assertRegExp('/\s+ON\s+\(`TestModel4TestModel7`\.`test_model4_id`\s+=\s+{\$__cakeID__\$}\s+AND/', $result); - $this->assertRegExp('/\s+AND\s+`TestModel4TestModel7`\.`test_model7_id`\s+=\s+`TestModel7`\.`id`\)/', $result); - $this->assertRegExp('/WHERE\s+(?:\()?1 = 1(?:\))?\s*$/', $result); + $this->assertMatchesRegularExpression('/^SELECT\s+`TestModel7`\.`id`, `TestModel7`\.`name`, `TestModel7`\.`created`, `TestModel7`\.`updated`, `TestModel4TestModel7`\.`test_model4_id`, `TestModel4TestModel7`\.`test_model7_id`\s+/', $result); + $this->assertMatchesRegularExpression('/\s+FROM\s+\S+`test_model7` AS `TestModel7`\s+JOIN\s+' . $assocTable . '/', $result); + $this->assertMatchesRegularExpression('/\s+ON\s+\(`TestModel4TestModel7`\.`test_model4_id`\s+=\s+{\$__cakeID__\$}\s+AND/', $result); + $this->assertMatchesRegularExpression('/\s+AND\s+`TestModel4TestModel7`\.`test_model7_id`\s+=\s+`TestModel7`\.`id`\)/', $result); + $this->assertMatchesRegularExpression('/WHERE\s+(?:\()?1 = 1(?:\))?\s*$/', $result); $result = $this->Dbo->buildAssociationQuery($this->Model, $queryData); - $this->assertRegExp('/^SELECT\s+`TestModel4`\.`id`, `TestModel4`\.`name`, `TestModel4`\.`created`, `TestModel4`\.`updated`\s+/', $result); - $this->assertRegExp('/\s+FROM\s+\S+`test_model4` AS `TestModel4`\s+WHERE/', $result); - $this->assertRegExp('/\s+WHERE\s+(?:\()?1 = 1(?:\))?\s*$/', $result); + $this->assertMatchesRegularExpression('/^SELECT\s+`TestModel4`\.`id`, `TestModel4`\.`name`, `TestModel4`\.`created`, `TestModel4`\.`updated`\s+/', $result); + $this->assertMatchesRegularExpression('/\s+FROM\s+\S+`test_model4` AS `TestModel4`\s+WHERE/', $result); + $this->assertMatchesRegularExpression('/\s+WHERE\s+(?:\()?1 = 1(?:\))?\s*$/', $result); } /** @@ -1961,14 +1961,14 @@ SQL; $params = $this->_prepareAssociationQuery($this->Model, $queryData, $binding); $result = $this->Dbo->generateAssociationQuery($this->Model, $params['linkModel'], $params['type'], $params['assoc'], $params['assocData'], $queryData, $params['external']); - $this->assertRegExp('/^SELECT\s+`TestModel7`\.`id`, `TestModel7`\.`name`, `TestModel7`\.`created`, `TestModel7`\.`updated`, `TestModel4TestModel7`\.`test_model4_id`, `TestModel4TestModel7`\.`test_model7_id`\s+/', $result); - $this->assertRegExp('/\s+FROM\s+\S+`test_model7`\s+AS\s+`TestModel7`\s+JOIN\s+\S+`test_model4_test_model7`\s+AS\s+`TestModel4TestModel7`/', $result); - $this->assertRegExp('/\s+ON\s+\(`TestModel4TestModel7`\.`test_model4_id`\s+=\s+{\$__cakeID__\$}/', $result); - $this->assertRegExp('/\s+AND\s+`TestModel4TestModel7`\.`test_model7_id`\s+=\s+`TestModel7`\.`id`\)\s+WHERE\s+/', $result); + $this->assertMatchesRegularExpression('/^SELECT\s+`TestModel7`\.`id`, `TestModel7`\.`name`, `TestModel7`\.`created`, `TestModel7`\.`updated`, `TestModel4TestModel7`\.`test_model4_id`, `TestModel4TestModel7`\.`test_model7_id`\s+/', $result); + $this->assertMatchesRegularExpression('/\s+FROM\s+\S+`test_model7`\s+AS\s+`TestModel7`\s+JOIN\s+\S+`test_model4_test_model7`\s+AS\s+`TestModel4TestModel7`/', $result); + $this->assertMatchesRegularExpression('/\s+ON\s+\(`TestModel4TestModel7`\.`test_model4_id`\s+=\s+{\$__cakeID__\$}/', $result); + $this->assertMatchesRegularExpression('/\s+AND\s+`TestModel4TestModel7`\.`test_model7_id`\s+=\s+`TestModel7`\.`id`\)\s+WHERE\s+/', $result); $result = $this->Dbo->buildAssociationQuery($this->Model, $queryData); - $this->assertRegExp('/^SELECT\s+`TestModel4`\.`id`, `TestModel4`\.`name`, `TestModel4`\.`created`, `TestModel4`\.`updated`\s+/', $result); - $this->assertRegExp('/\s+FROM\s+\S+`test_model4` AS `TestModel4`\s+WHERE\s+(?:\()?`TestModel4`.`name`\s+!=\s+\'mariano\'(?:\))?\s*$/', $result); + $this->assertMatchesRegularExpression('/^SELECT\s+`TestModel4`\.`id`, `TestModel4`\.`name`, `TestModel4`\.`created`, `TestModel4`\.`updated`\s+/', $result); + $this->assertMatchesRegularExpression('/\s+FROM\s+\S+`test_model4` AS `TestModel4`\s+WHERE\s+(?:\()?`TestModel4`.`name`\s+!=\s+\'mariano\'(?:\))?\s*$/', $result); } /** @@ -1992,15 +1992,15 @@ SQL; $params = &$this->_prepareAssociationQuery($this->Model, $queryData, $binding); $result = $this->Dbo->generateAssociationQuery($this->Model, $params['linkModel'], $params['type'], $params['assoc'], $params['assocData'], $queryData, $params['external']); - $this->assertRegExp('/^SELECT\s+`TestModel7`\.`id`, `TestModel7`\.`name`, `TestModel7`\.`created`, `TestModel7`\.`updated`, `TestModel4TestModel7`\.`test_model4_id`, `TestModel4TestModel7`\.`test_model7_id`\s+/', $result); - $this->assertRegExp('/\s+FROM\s+\S+`test_model7`\s+AS\s+`TestModel7`\s+JOIN\s+\S+`test_model4_test_model7`\s+AS\s+`TestModel4TestModel7`/', $result); - $this->assertRegExp('/\s+ON\s+\(`TestModel4TestModel7`\.`test_model4_id`\s+=\s+{\$__cakeID__\$}\s+/', $result); - $this->assertRegExp('/\s+AND\s+`TestModel4TestModel7`\.`test_model7_id`\s+=\s+`TestModel7`\.`id`\)\s+WHERE\s+/', $result); - $this->assertRegExp('/\s+(?:\()?1\s+=\s+1(?:\))?\s*\s+LIMIT 2,\s*5\s*$/', $result); + $this->assertMatchesRegularExpression('/^SELECT\s+`TestModel7`\.`id`, `TestModel7`\.`name`, `TestModel7`\.`created`, `TestModel7`\.`updated`, `TestModel4TestModel7`\.`test_model4_id`, `TestModel4TestModel7`\.`test_model7_id`\s+/', $result); + $this->assertMatchesRegularExpression('/\s+FROM\s+\S+`test_model7`\s+AS\s+`TestModel7`\s+JOIN\s+\S+`test_model4_test_model7`\s+AS\s+`TestModel4TestModel7`/', $result); + $this->assertMatchesRegularExpression('/\s+ON\s+\(`TestModel4TestModel7`\.`test_model4_id`\s+=\s+{\$__cakeID__\$}\s+/', $result); + $this->assertMatchesRegularExpression('/\s+AND\s+`TestModel4TestModel7`\.`test_model7_id`\s+=\s+`TestModel7`\.`id`\)\s+WHERE\s+/', $result); + $this->assertMatchesRegularExpression('/\s+(?:\()?1\s+=\s+1(?:\))?\s*\s+LIMIT 2,\s*5\s*$/', $result); $result = $this->Dbo->buildAssociationQuery($this->Model, $queryData); - $this->assertRegExp('/^SELECT\s+`TestModel4`\.`id`, `TestModel4`\.`name`, `TestModel4`\.`created`, `TestModel4`\.`updated`\s+/', $result); - $this->assertRegExp('/\s+FROM\s+\S+`test_model4` AS `TestModel4`\s+WHERE\s+(?:\()?1\s+=\s+1(?:\))?\s*$/', $result); + $this->assertMatchesRegularExpression('/^SELECT\s+`TestModel4`\.`id`, `TestModel4`\.`name`, `TestModel4`\.`created`, `TestModel4`\.`updated`\s+/', $result); + $this->assertMatchesRegularExpression('/\s+FROM\s+\S+`test_model4` AS `TestModel4`\s+WHERE\s+(?:\()?1\s+=\s+1(?:\))?\s*$/', $result); $this->Model->hasAndBelongsToMany['TestModel7'] = $backup; } @@ -2026,15 +2026,15 @@ SQL; $params = &$this->_prepareAssociationQuery($this->Model, $queryData, $binding); $result = $this->Dbo->generateAssociationQuery($this->Model, $params['linkModel'], $params['type'], $params['assoc'], $params['assocData'], $queryData, $params['external']); - $this->assertRegExp('/^SELECT\s+`TestModel7`\.`id`, `TestModel7`\.`name`, `TestModel7`\.`created`, `TestModel7`\.`updated`, `TestModel4TestModel7`\.`test_model4_id`, `TestModel4TestModel7`\.`test_model7_id`\s+/', $result); - $this->assertRegExp('/\s+FROM\s+\S+`test_model7`\s+AS\s+`TestModel7`\s+JOIN\s+\S+`test_model4_test_model7`\s+AS\s+`TestModel4TestModel7`/', $result); - $this->assertRegExp('/\s+ON\s+\(`TestModel4TestModel7`\.`test_model4_id`\s+=\s+{\$__cakeID__\$}/', $result); - $this->assertRegExp('/\s+AND\s+`TestModel4TestModel7`\.`test_model7_id`\s+=\s+`TestModel7`\.`id`\)\s+WHERE\s+/', $result); - $this->assertRegExp('/\s+(?:\()?1\s+=\s+1(?:\))?\s*\s+LIMIT 5,\s*5\s*$/', $result); + $this->assertMatchesRegularExpression('/^SELECT\s+`TestModel7`\.`id`, `TestModel7`\.`name`, `TestModel7`\.`created`, `TestModel7`\.`updated`, `TestModel4TestModel7`\.`test_model4_id`, `TestModel4TestModel7`\.`test_model7_id`\s+/', $result); + $this->assertMatchesRegularExpression('/\s+FROM\s+\S+`test_model7`\s+AS\s+`TestModel7`\s+JOIN\s+\S+`test_model4_test_model7`\s+AS\s+`TestModel4TestModel7`/', $result); + $this->assertMatchesRegularExpression('/\s+ON\s+\(`TestModel4TestModel7`\.`test_model4_id`\s+=\s+{\$__cakeID__\$}/', $result); + $this->assertMatchesRegularExpression('/\s+AND\s+`TestModel4TestModel7`\.`test_model7_id`\s+=\s+`TestModel7`\.`id`\)\s+WHERE\s+/', $result); + $this->assertMatchesRegularExpression('/\s+(?:\()?1\s+=\s+1(?:\))?\s*\s+LIMIT 5,\s*5\s*$/', $result); $result = $this->Dbo->buildAssociationQuery($this->Model, $queryData); - $this->assertRegExp('/^SELECT\s+`TestModel4`\.`id`, `TestModel4`\.`name`, `TestModel4`\.`created`, `TestModel4`\.`updated`\s+/', $result); - $this->assertRegExp('/\s+FROM\s+\S+`test_model4` AS `TestModel4`\s+WHERE\s+(?:\()?1\s+=\s+1(?:\))?\s*$/', $result); + $this->assertMatchesRegularExpression('/^SELECT\s+`TestModel4`\.`id`, `TestModel4`\.`name`, `TestModel4`\.`created`, `TestModel4`\.`updated`\s+/', $result); + $this->assertMatchesRegularExpression('/\s+FROM\s+\S+`test_model4` AS `TestModel4`\s+WHERE\s+(?:\()?1\s+=\s+1(?:\))?\s*$/', $result); $this->Model->hasAndBelongsToMany['TestModel7'] = $backup; } @@ -2105,7 +2105,7 @@ SQL; $result = $this->Dbo->conditions('Sportstaette.sportstaette LIKE "%ru%" AND Sportstaette.sportstaettenart_id = 2'); $expected = ' WHERE `Sportstaette`.`sportstaette` LIKE "%ru%" AND `Sportstaette`.`sportstaettenart_id` = 2'; - $this->assertRegExp('/\s*WHERE\s+`Sportstaette`\.`sportstaette`\s+LIKE\s+"%ru%"\s+AND\s+`Sports/', $result); + $this->assertMatchesRegularExpression('/\s*WHERE\s+`Sportstaette`\.`sportstaette`\s+LIKE\s+"%ru%"\s+AND\s+`Sports/', $result); $this->assertEquals($expected, $result); $result = $this->Dbo->conditions('Sportstaette.sportstaettenart_id = 2 AND Sportstaette.sportstaette LIKE "%ru%"'); @@ -2223,46 +2223,46 @@ SQL; */ public function testParenthesisInStringConditions() { $result = $this->Dbo->conditions('Member.name = \'(lu\''); - $this->assertRegExp('/^\s+WHERE\s+`Member`.`name`\s+=\s+\'\(lu\'$/', $result); + $this->assertMatchesRegularExpression('/^\s+WHERE\s+`Member`.`name`\s+=\s+\'\(lu\'$/', $result); $result = $this->Dbo->conditions('Member.name = \')lu\''); - $this->assertRegExp('/^\s+WHERE\s+`Member`.`name`\s+=\s+\'\)lu\'$/', $result); + $this->assertMatchesRegularExpression('/^\s+WHERE\s+`Member`.`name`\s+=\s+\'\)lu\'$/', $result); $result = $this->Dbo->conditions('Member.name = \'va(lu\''); - $this->assertRegExp('/^\s+WHERE\s+`Member`.`name`\s+=\s+\'va\(lu\'$/', $result); + $this->assertMatchesRegularExpression('/^\s+WHERE\s+`Member`.`name`\s+=\s+\'va\(lu\'$/', $result); $result = $this->Dbo->conditions('Member.name = \'va)lu\''); - $this->assertRegExp('/^\s+WHERE\s+`Member`.`name`\s+=\s+\'va\)lu\'$/', $result); + $this->assertMatchesRegularExpression('/^\s+WHERE\s+`Member`.`name`\s+=\s+\'va\)lu\'$/', $result); $result = $this->Dbo->conditions('Member.name = \'va(lu)\''); - $this->assertRegExp('/^\s+WHERE\s+`Member`.`name`\s+=\s+\'va\(lu\)\'$/', $result); + $this->assertMatchesRegularExpression('/^\s+WHERE\s+`Member`.`name`\s+=\s+\'va\(lu\)\'$/', $result); $result = $this->Dbo->conditions('Member.name = \'va(lu)e\''); - $this->assertRegExp('/^\s+WHERE\s+`Member`.`name`\s+=\s+\'va\(lu\)e\'$/', $result); + $this->assertMatchesRegularExpression('/^\s+WHERE\s+`Member`.`name`\s+=\s+\'va\(lu\)e\'$/', $result); $result = $this->Dbo->conditions('Member.name = \'(mariano)\''); - $this->assertRegExp('/^\s+WHERE\s+`Member`.`name`\s+=\s+\'\(mariano\)\'$/', $result); + $this->assertMatchesRegularExpression('/^\s+WHERE\s+`Member`.`name`\s+=\s+\'\(mariano\)\'$/', $result); $result = $this->Dbo->conditions('Member.name = \'(mariano)iglesias\''); - $this->assertRegExp('/^\s+WHERE\s+`Member`.`name`\s+=\s+\'\(mariano\)iglesias\'$/', $result); + $this->assertMatchesRegularExpression('/^\s+WHERE\s+`Member`.`name`\s+=\s+\'\(mariano\)iglesias\'$/', $result); $result = $this->Dbo->conditions('Member.name = \'(mariano) iglesias\''); - $this->assertRegExp('/^\s+WHERE\s+`Member`.`name`\s+=\s+\'\(mariano\) iglesias\'$/', $result); + $this->assertMatchesRegularExpression('/^\s+WHERE\s+`Member`.`name`\s+=\s+\'\(mariano\) iglesias\'$/', $result); $result = $this->Dbo->conditions('Member.name = \'(mariano word) iglesias\''); - $this->assertRegExp('/^\s+WHERE\s+`Member`.`name`\s+=\s+\'\(mariano word\) iglesias\'$/', $result); + $this->assertMatchesRegularExpression('/^\s+WHERE\s+`Member`.`name`\s+=\s+\'\(mariano word\) iglesias\'$/', $result); $result = $this->Dbo->conditions('Member.name = \'(mariano.iglesias)\''); - $this->assertRegExp('/^\s+WHERE\s+`Member`.`name`\s+=\s+\'\(mariano.iglesias\)\'$/', $result); + $this->assertMatchesRegularExpression('/^\s+WHERE\s+`Member`.`name`\s+=\s+\'\(mariano.iglesias\)\'$/', $result); $result = $this->Dbo->conditions('Member.name = \'Mariano Iglesias (mariano.iglesias)\''); - $this->assertRegExp('/^\s+WHERE\s+`Member`.`name`\s+=\s+\'Mariano Iglesias \(mariano.iglesias\)\'$/', $result); + $this->assertMatchesRegularExpression('/^\s+WHERE\s+`Member`.`name`\s+=\s+\'Mariano Iglesias \(mariano.iglesias\)\'$/', $result); $result = $this->Dbo->conditions('Member.name = \'Mariano Iglesias (mariano.iglesias) CakePHP\''); - $this->assertRegExp('/^\s+WHERE\s+`Member`.`name`\s+=\s+\'Mariano Iglesias \(mariano.iglesias\) CakePHP\'$/', $result); + $this->assertMatchesRegularExpression('/^\s+WHERE\s+`Member`.`name`\s+=\s+\'Mariano Iglesias \(mariano.iglesias\) CakePHP\'$/', $result); $result = $this->Dbo->conditions('Member.name = \'(mariano.iglesias) CakePHP\''); - $this->assertRegExp('/^\s+WHERE\s+`Member`.`name`\s+=\s+\'\(mariano.iglesias\) CakePHP\'$/', $result); + $this->assertMatchesRegularExpression('/^\s+WHERE\s+`Member`.`name`\s+=\s+\'\(mariano.iglesias\) CakePHP\'$/', $result); } /** @@ -2272,46 +2272,46 @@ SQL; */ public function testParenthesisInArrayConditions() { $result = $this->Dbo->conditions(array('Member.name' => '(lu')); - $this->assertRegExp('/^\s+WHERE\s+`Member`.`name`\s+=\s+\'\(lu\'$/', $result); + $this->assertMatchesRegularExpression('/^\s+WHERE\s+`Member`.`name`\s+=\s+\'\(lu\'$/', $result); $result = $this->Dbo->conditions(array('Member.name' => ')lu')); - $this->assertRegExp('/^\s+WHERE\s+`Member`.`name`\s+=\s+\'\)lu\'$/', $result); + $this->assertMatchesRegularExpression('/^\s+WHERE\s+`Member`.`name`\s+=\s+\'\)lu\'$/', $result); $result = $this->Dbo->conditions(array('Member.name' => 'va(lu')); - $this->assertRegExp('/^\s+WHERE\s+`Member`.`name`\s+=\s+\'va\(lu\'$/', $result); + $this->assertMatchesRegularExpression('/^\s+WHERE\s+`Member`.`name`\s+=\s+\'va\(lu\'$/', $result); $result = $this->Dbo->conditions(array('Member.name' => 'va)lu')); - $this->assertRegExp('/^\s+WHERE\s+`Member`.`name`\s+=\s+\'va\)lu\'$/', $result); + $this->assertMatchesRegularExpression('/^\s+WHERE\s+`Member`.`name`\s+=\s+\'va\)lu\'$/', $result); $result = $this->Dbo->conditions(array('Member.name' => 'va(lu)')); - $this->assertRegExp('/^\s+WHERE\s+`Member`.`name`\s+=\s+\'va\(lu\)\'$/', $result); + $this->assertMatchesRegularExpression('/^\s+WHERE\s+`Member`.`name`\s+=\s+\'va\(lu\)\'$/', $result); $result = $this->Dbo->conditions(array('Member.name' => 'va(lu)e')); - $this->assertRegExp('/^\s+WHERE\s+`Member`.`name`\s+=\s+\'va\(lu\)e\'$/', $result); + $this->assertMatchesRegularExpression('/^\s+WHERE\s+`Member`.`name`\s+=\s+\'va\(lu\)e\'$/', $result); $result = $this->Dbo->conditions(array('Member.name' => '(mariano)')); - $this->assertRegExp('/^\s+WHERE\s+`Member`.`name`\s+=\s+\'\(mariano\)\'$/', $result); + $this->assertMatchesRegularExpression('/^\s+WHERE\s+`Member`.`name`\s+=\s+\'\(mariano\)\'$/', $result); $result = $this->Dbo->conditions(array('Member.name' => '(mariano)iglesias')); - $this->assertRegExp('/^\s+WHERE\s+`Member`.`name`\s+=\s+\'\(mariano\)iglesias\'$/', $result); + $this->assertMatchesRegularExpression('/^\s+WHERE\s+`Member`.`name`\s+=\s+\'\(mariano\)iglesias\'$/', $result); $result = $this->Dbo->conditions(array('Member.name' => '(mariano) iglesias')); - $this->assertRegExp('/^\s+WHERE\s+`Member`.`name`\s+=\s+\'\(mariano\) iglesias\'$/', $result); + $this->assertMatchesRegularExpression('/^\s+WHERE\s+`Member`.`name`\s+=\s+\'\(mariano\) iglesias\'$/', $result); $result = $this->Dbo->conditions(array('Member.name' => '(mariano word) iglesias')); - $this->assertRegExp('/^\s+WHERE\s+`Member`.`name`\s+=\s+\'\(mariano word\) iglesias\'$/', $result); + $this->assertMatchesRegularExpression('/^\s+WHERE\s+`Member`.`name`\s+=\s+\'\(mariano word\) iglesias\'$/', $result); $result = $this->Dbo->conditions(array('Member.name' => '(mariano.iglesias)')); - $this->assertRegExp('/^\s+WHERE\s+`Member`.`name`\s+=\s+\'\(mariano.iglesias\)\'$/', $result); + $this->assertMatchesRegularExpression('/^\s+WHERE\s+`Member`.`name`\s+=\s+\'\(mariano.iglesias\)\'$/', $result); $result = $this->Dbo->conditions(array('Member.name' => 'Mariano Iglesias (mariano.iglesias)')); - $this->assertRegExp('/^\s+WHERE\s+`Member`.`name`\s+=\s+\'Mariano Iglesias \(mariano.iglesias\)\'$/', $result); + $this->assertMatchesRegularExpression('/^\s+WHERE\s+`Member`.`name`\s+=\s+\'Mariano Iglesias \(mariano.iglesias\)\'$/', $result); $result = $this->Dbo->conditions(array('Member.name' => 'Mariano Iglesias (mariano.iglesias) CakePHP')); - $this->assertRegExp('/^\s+WHERE\s+`Member`.`name`\s+=\s+\'Mariano Iglesias \(mariano.iglesias\) CakePHP\'$/', $result); + $this->assertMatchesRegularExpression('/^\s+WHERE\s+`Member`.`name`\s+=\s+\'Mariano Iglesias \(mariano.iglesias\) CakePHP\'$/', $result); $result = $this->Dbo->conditions(array('Member.name' => '(mariano.iglesias) CakePHP')); - $this->assertRegExp('/^\s+WHERE\s+`Member`.`name`\s+=\s+\'\(mariano.iglesias\) CakePHP\'$/', $result); + $this->assertMatchesRegularExpression('/^\s+WHERE\s+`Member`.`name`\s+=\s+\'\(mariano.iglesias\) CakePHP\'$/', $result); } /** @@ -2322,10 +2322,10 @@ SQL; public function testArrayConditionsParsing() { $this->loadFixtures('Post', 'Author'); $result = $this->Dbo->conditions(array('Stereo.type' => 'in dash speakers')); - $this->assertRegExp("/^\s+WHERE\s+`Stereo`.`type`\s+=\s+'in dash speakers'/", $result); + $this->assertMatchesRegularExpression("/^\s+WHERE\s+`Stereo`.`type`\s+=\s+'in dash speakers'/", $result); $result = $this->Dbo->conditions(array('Candy.name LIKE' => 'a', 'HardCandy.name LIKE' => 'c')); - $this->assertRegExp("/^\s+WHERE\s+`Candy`.`name` LIKE\s+'a'\s+AND\s+`HardCandy`.`name`\s+LIKE\s+'c'/", $result); + $this->assertMatchesRegularExpression("/^\s+WHERE\s+`Candy`.`name` LIKE\s+'a'\s+AND\s+`HardCandy`.`name`\s+LIKE\s+'c'/", $result); $result = $this->Dbo->conditions(array('HardCandy.name LIKE' => 'a', 'Candy.name LIKE' => 'c')); $expected = " WHERE `HardCandy`.`name` LIKE 'a' AND `Candy`.`name` LIKE 'c'"; @@ -2473,10 +2473,10 @@ SQL; 'NOT' => array('Course.id' => null, 'Course.vet' => 'N', 'level_of_education_id' => array(912, 999)), 'Enrollment.yearcompleted >' => '0') ); - $this->assertRegExp('/^\s*WHERE\s+\(NOT\s+\(`Course`\.`id` IS NULL\)\s+AND NOT\s+\(`Course`\.`vet`\s+=\s+\'N\'\)\s+AND NOT\s+\(`level_of_education_id` IN \(912, 999\)\)\)\s+AND\s+`Enrollment`\.`yearcompleted`\s+>\s+\'0\'\s*$/', $result); + $this->assertMatchesRegularExpression('/^\s*WHERE\s+\(NOT\s+\(`Course`\.`id` IS NULL\)\s+AND NOT\s+\(`Course`\.`vet`\s+=\s+\'N\'\)\s+AND NOT\s+\(`level_of_education_id` IN \(912, 999\)\)\)\s+AND\s+`Enrollment`\.`yearcompleted`\s+>\s+\'0\'\s*$/', $result); $result = $this->Dbo->conditions(array('id <>' => '8')); - $this->assertRegExp('/^\s*WHERE\s+`id`\s+<>\s+\'8\'\s*$/', $result); + $this->assertMatchesRegularExpression('/^\s*WHERE\s+`id`\s+<>\s+\'8\'\s*$/', $result); $result = $this->Dbo->conditions(array('TestModel.field =' => 'gribe$@()lu')); $expected = " WHERE `TestModel`.`field` = 'gribe$@()lu'"; @@ -2649,7 +2649,7 @@ SQL; '1=1 GROUP BY Thread.project_id' ); $result = $this->Dbo->conditions($conditions); - $this->assertRegExp('/^\s*WHERE\s+`Thread`.`project_id`\s*=\s*5\s+AND\s+`Thread`.`buyer_id`\s*=\s*14\s+AND\s+1\s*=\s*1\s+GROUP BY `Thread`.`project_id`$/', $result); + $this->assertMatchesRegularExpression('/^\s*WHERE\s+`Thread`.`project_id`\s*=\s*5\s+AND\s+`Thread`.`buyer_id`\s*=\s*14\s+AND\s+1\s*=\s*1\s+GROUP BY `Thread`.`project_id`$/', $result); } /** @@ -2659,10 +2659,10 @@ SQL; */ public function testConditionsOptionalArguments() { $result = $this->Dbo->conditions(array('Member.name' => 'Mariano'), true, false); - $this->assertRegExp('/^\s*`Member`.`name`\s*=\s*\'Mariano\'\s*$/', $result); + $this->assertMatchesRegularExpression('/^\s*`Member`.`name`\s*=\s*\'Mariano\'\s*$/', $result); $result = $this->Dbo->conditions(array(), true, false); - $this->assertRegExp('/^\s*1\s*=\s*1\s*$/', $result); + $this->assertMatchesRegularExpression('/^\s*1\s*=\s*1\s*$/', $result); } /** @@ -2849,19 +2849,19 @@ SQL; 'fields' => 'id', 'table' => 'table', 'conditions' => 'WHERE 1=1', 'alias' => '', 'joins' => '', 'order' => '', 'limit' => '', 'group' => '' )); - $this->assertRegExp('/^\s*SELECT\s+id\s+FROM\s+table\s+WHERE\s+1=1\s*$/', $result); + $this->assertMatchesRegularExpression('/^\s*SELECT\s+id\s+FROM\s+table\s+WHERE\s+1=1\s*$/', $result); $result = $this->Dbo->renderStatement('update', array('fields' => 'value=2', 'table' => 'table', 'conditions' => 'WHERE 1=1', 'alias' => '')); - $this->assertRegExp('/^\s*UPDATE\s+table\s+SET\s+value=2\s+WHERE\s+1=1\s*$/', $result); + $this->assertMatchesRegularExpression('/^\s*UPDATE\s+table\s+SET\s+value=2\s+WHERE\s+1=1\s*$/', $result); $result = $this->Dbo->renderStatement('update', array('fields' => 'value=2', 'table' => 'table', 'conditions' => 'WHERE 1=1', 'alias' => 'alias', 'joins' => '')); - $this->assertRegExp('/^\s*UPDATE\s+table\s+AS\s+alias\s+SET\s+value=2\s+WHERE\s+1=1\s*$/', $result); + $this->assertMatchesRegularExpression('/^\s*UPDATE\s+table\s+AS\s+alias\s+SET\s+value=2\s+WHERE\s+1=1\s*$/', $result); $result = $this->Dbo->renderStatement('delete', array('fields' => 'value=2', 'table' => 'table', 'conditions' => 'WHERE 1=1', 'alias' => '')); - $this->assertRegExp('/^\s*DELETE\s+FROM\s+table\s+WHERE\s+1=1\s*$/', $result); + $this->assertMatchesRegularExpression('/^\s*DELETE\s+FROM\s+table\s+WHERE\s+1=1\s*$/', $result); $result = $this->Dbo->renderStatement('delete', array('fields' => 'value=2', 'table' => 'table', 'conditions' => 'WHERE 1=1', 'alias' => 'alias', 'joins' => '')); - $this->assertRegExp('/^\s*DELETE\s+alias\s+FROM\s+table\s+AS\s+alias\s+WHERE\s+1=1\s*$/', $result); + $this->assertMatchesRegularExpression('/^\s*DELETE\s+alias\s+FROM\s+table\s+AS\s+alias\s+WHERE\s+1=1\s*$/', $result); } /** @@ -2877,7 +2877,7 @@ SQL; $this->assertTrue(empty($result)); $result = $this->Dbo->dropSchema($Schema, 'table'); - $this->assertRegExp('/^\s*DROP TABLE IF EXISTS\s+' . $this->Dbo->fullTableName('table') . ';\s*$/s', $result); + $this->assertMatchesRegularExpression('/^\s*DROP TABLE IF EXISTS\s+' . $this->Dbo->fullTableName('table') . ';\s*$/s', $result); } /** @@ -2907,56 +2907,56 @@ SQL; $this->assertEquals($expected, $result); $result = $this->Dbo->order("title, id"); - $this->assertRegExp('/^\s*ORDER BY\s+`title`\s+ASC,\s+`id`\s+ASC\s*$/', $result); + $this->assertMatchesRegularExpression('/^\s*ORDER BY\s+`title`\s+ASC,\s+`id`\s+ASC\s*$/', $result); $result = $this->Dbo->order("title desc, id desc"); - $this->assertRegExp('/^\s*ORDER BY\s+`title`\s+desc,\s+`id`\s+desc\s*$/', $result); + $this->assertMatchesRegularExpression('/^\s*ORDER BY\s+`title`\s+desc,\s+`id`\s+desc\s*$/', $result); $result = $this->Dbo->order(array("title desc, id desc")); - $this->assertRegExp('/^\s*ORDER BY\s+`title`\s+desc,\s+`id`\s+desc\s*$/', $result); + $this->assertMatchesRegularExpression('/^\s*ORDER BY\s+`title`\s+desc,\s+`id`\s+desc\s*$/', $result); $result = $this->Dbo->order(array("title", "id")); - $this->assertRegExp('/^\s*ORDER BY\s+`title`\s+ASC,\s+`id`\s+ASC\s*$/', $result); + $this->assertMatchesRegularExpression('/^\s*ORDER BY\s+`title`\s+ASC,\s+`id`\s+ASC\s*$/', $result); $result = $this->Dbo->order(array(array('title'), array('id'))); - $this->assertRegExp('/^\s*ORDER BY\s+`title`\s+ASC,\s+`id`\s+ASC\s*$/', $result); + $this->assertMatchesRegularExpression('/^\s*ORDER BY\s+`title`\s+ASC,\s+`id`\s+ASC\s*$/', $result); $result = $this->Dbo->order(array("Post.title" => 'asc', "Post.id" => 'desc')); - $this->assertRegExp('/^\s*ORDER BY\s+`Post`.`title`\s+asc,\s+`Post`.`id`\s+desc\s*$/', $result); + $this->assertMatchesRegularExpression('/^\s*ORDER BY\s+`Post`.`title`\s+asc,\s+`Post`.`id`\s+desc\s*$/', $result); $result = $this->Dbo->order(array(array("Post.title" => 'asc', "Post.id" => 'desc'))); - $this->assertRegExp('/^\s*ORDER BY\s+`Post`.`title`\s+asc,\s+`Post`.`id`\s+desc\s*$/', $result); + $this->assertMatchesRegularExpression('/^\s*ORDER BY\s+`Post`.`title`\s+asc,\s+`Post`.`id`\s+desc\s*$/', $result); $result = $this->Dbo->order(array("title")); - $this->assertRegExp('/^\s*ORDER BY\s+`title`\s+ASC\s*$/', $result); + $this->assertMatchesRegularExpression('/^\s*ORDER BY\s+`title`\s+ASC\s*$/', $result); $result = $this->Dbo->order(array(array("title"))); - $this->assertRegExp('/^\s*ORDER BY\s+`title`\s+ASC\s*$/', $result); + $this->assertMatchesRegularExpression('/^\s*ORDER BY\s+`title`\s+ASC\s*$/', $result); $result = $this->Dbo->order("Dealer.id = 7 desc, Dealer.id = 3 desc, Dealer.title asc"); $expected = " ORDER BY `Dealer`.`id` = 7 desc, `Dealer`.`id` = 3 desc, `Dealer`.`title` asc"; $this->assertEquals($expected, $result); $result = $this->Dbo->order(array("Page.name" => "='test' DESC")); - $this->assertRegExp("/^\s*ORDER BY\s+`Page`\.`name`\s*='test'\s+DESC\s*$/", $result); + $this->assertMatchesRegularExpression("/^\s*ORDER BY\s+`Page`\.`name`\s*='test'\s+DESC\s*$/", $result); $result = $this->Dbo->order("Page.name = 'view' DESC"); - $this->assertRegExp("/^\s*ORDER BY\s+`Page`\.`name`\s*=\s*'view'\s+DESC\s*$/", $result); + $this->assertMatchesRegularExpression("/^\s*ORDER BY\s+`Page`\.`name`\s*=\s*'view'\s+DESC\s*$/", $result); $result = $this->Dbo->order("(Post.views)"); - $this->assertRegExp("/^\s*ORDER BY\s+\(`Post`\.`views`\)\s+ASC\s*$/", $result); + $this->assertMatchesRegularExpression("/^\s*ORDER BY\s+\(`Post`\.`views`\)\s+ASC\s*$/", $result); $result = $this->Dbo->order("(Post.views)*Post.views"); - $this->assertRegExp("/^\s*ORDER BY\s+\(`Post`\.`views`\)\*`Post`\.`views`\s+ASC\s*$/", $result); + $this->assertMatchesRegularExpression("/^\s*ORDER BY\s+\(`Post`\.`views`\)\*`Post`\.`views`\s+ASC\s*$/", $result); $result = $this->Dbo->order("(Post.views) * Post.views"); - $this->assertRegExp("/^\s*ORDER BY\s+\(`Post`\.`views`\) \* `Post`\.`views`\s+ASC\s*$/", $result); + $this->assertMatchesRegularExpression("/^\s*ORDER BY\s+\(`Post`\.`views`\) \* `Post`\.`views`\s+ASC\s*$/", $result); $result = $this->Dbo->order("(Model.field1 + Model.field2) * Model.field3"); - $this->assertRegExp("/^\s*ORDER BY\s+\(`Model`\.`field1` \+ `Model`\.`field2`\) \* `Model`\.`field3`\s+ASC\s*$/", $result); + $this->assertMatchesRegularExpression("/^\s*ORDER BY\s+\(`Model`\.`field1` \+ `Model`\.`field2`\) \* `Model`\.`field3`\s+ASC\s*$/", $result); $result = $this->Dbo->order("Model.name+0 ASC"); - $this->assertRegExp("/^\s*ORDER BY\s+`Model`\.`name`\+0\s+ASC\s*$/", $result); + $this->assertMatchesRegularExpression("/^\s*ORDER BY\s+`Model`\.`name`\+0\s+ASC\s*$/", $result); $result = $this->Dbo->order("Anuncio.destaque & 2 DESC"); $expected = ' ORDER BY `Anuncio`.`destaque` & 2 DESC'; @@ -2978,7 +2978,7 @@ SQL; */ public function testComplexSortExpression() { $result = $this->Dbo->order(array('(Model.field > 100) DESC', 'Model.field ASC')); - $this->assertRegExp("/^\s*ORDER BY\s+\(`Model`\.`field`\s+>\s+100\)\s+DESC,\s+`Model`\.`field`\s+ASC\s*$/", $result); + $this->assertMatchesRegularExpression("/^\s*ORDER BY\s+\(`Model`\.`field`\s+>\s+100\)\s+DESC,\s+`Model`\.`field`\s+ASC\s*$/", $result); } /** @@ -3581,9 +3581,9 @@ SQL; $conditions = array('distance >=' => 20); $result = $this->Dbo->conditions($conditions, true, true, $Article); - $this->assertRegExp('/\) >= 20/', $result); - $this->assertRegExp('/[`\'"]Article[`\'"].[`\'"]latitude[`\'"]/', $result); - $this->assertRegExp('/[`\'"]Article[`\'"].[`\'"]longitude[`\'"]/', $result); + $this->assertMatchesRegularExpression('/\) >= 20/', $result); + $this->assertMatchesRegularExpression('/[`\'"]Article[`\'"].[`\'"]latitude[`\'"]/', $result); + $this->assertMatchesRegularExpression('/[`\'"]Article[`\'"].[`\'"]longitude[`\'"]/', $result); } /** @@ -3625,7 +3625,7 @@ SQL; ); $result = $this->Dbo->fields($Article, null, array()); $result = $this->Dbo->fields($Article, $Article->alias, $result); - $this->assertRegExp('/[`\"]User[`\"]\.[`\"]id[`\"] \+ [`\"]User[`\"]\.[`\"]id[`\"]/', $result[7]); + $this->assertMatchesRegularExpression('/[`\"]User[`\"]\.[`\"]id[`\"] \+ [`\"]User[`\"]\.[`\"]id[`\"]/', $result[7]); } /** @@ -3667,9 +3667,9 @@ SQL; $qe = $this->Dbo->endQuote; $this->assertEquals("{$qs}Article{$qe}.{$qs}id{$qe}", $result[0]); - $this->assertRegExp('/Article__distance/', $result[1]); - $this->assertRegExp('/[`\'"]Article[`\'"].[`\'"]latitude[`\'"]/', $result[1]); - $this->assertRegExp('/[`\'"]Article[`\'"].[`\'"]longitude[`\'"]/', $result[1]); + $this->assertMatchesRegularExpression('/Article__distance/', $result[1]); + $this->assertMatchesRegularExpression('/[`\'"]Article[`\'"].[`\'"]latitude[`\'"]/', $result[1]); + $this->assertMatchesRegularExpression('/[`\'"]Article[`\'"].[`\'"]longitude[`\'"]/', $result[1]); } /** diff --git a/lib/Cake/Test/Case/Model/Datasource/Database/PostgresTest.php b/lib/Cake/Test/Case/Model/Datasource/Database/PostgresTest.php index 5e34c6bbb..18c8863d7 100644 --- a/lib/Cake/Test/Case/Model/Datasource/Database/PostgresTest.php +++ b/lib/Cake/Test/Case/Model/Datasource/Database/PostgresTest.php @@ -567,7 +567,7 @@ class PostgresTest extends CakeTestCase { $result = $db1->createSchema($schema, 'datatype_tests'); $this->assertNotRegExp('/timestamp DEFAULT/', $result); - $this->assertRegExp('/\"full_length\"\s*text\s.*,/', $result); + $this->assertMatchesRegularExpression('/\"full_length\"\s*text\s.*,/', $result); $this->assertContains('timestamp ,', $result); $this->assertContains('"huge_int" bigint NOT NULL,', $result); diff --git a/lib/Cake/Test/Case/Model/Datasource/Database/SqlserverTest.php b/lib/Cake/Test/Case/Model/Datasource/Database/SqlserverTest.php index 197ce145e..2aa12a70a 100644 --- a/lib/Cake/Test/Case/Model/Datasource/Database/SqlserverTest.php +++ b/lib/Cake/Test/Case/Model/Datasource/Database/SqlserverTest.php @@ -400,14 +400,14 @@ class SqlserverTest extends CakeTestCase { 'limit' => 5 )); $result = $this->db->getLastQuery(); - $this->assertRegExp('/^SELECT DISTINCT TOP 5/', $result); + $this->assertMatchesRegularExpression('/^SELECT DISTINCT TOP 5/', $result); $this->db->read($this->model, array( 'fields' => array('DISTINCT SqlserverTestModel.city', 'SqlserverTestModel.country'), 'limit' => '5' )); $result = $this->db->getLastQuery(); - $this->assertRegExp('/^SELECT DISTINCT TOP 5/', $result); + $this->assertMatchesRegularExpression('/^SELECT DISTINCT TOP 5/', $result); } /** @@ -646,8 +646,8 @@ class SqlserverTest extends CakeTestCase { $result = $this->db->getLastQuery(); $this->assertNotRegExp('/SqlserverTestModel/', $result); - $this->assertRegExp('/^UPDATE \[sqlserver_test_models\]/', $result); - $this->assertRegExp('/SET \[client_id\] = \[client_id\] \+ 1/', $result); + $this->assertMatchesRegularExpression('/^UPDATE \[sqlserver_test_models\]/', $result); + $this->assertMatchesRegularExpression('/SET \[client_id\] = \[client_id\] \+ 1/', $result); } /** diff --git a/lib/Cake/Test/Case/Model/Datasource/DboSourceTest.php b/lib/Cake/Test/Case/Model/Datasource/DboSourceTest.php index 88623a182..4826304fb 100644 --- a/lib/Cake/Test/Case/Model/Datasource/DboSourceTest.php +++ b/lib/Cake/Test/Case/Model/Datasource/DboSourceTest.php @@ -955,15 +955,15 @@ class DboSourceTest extends CakeTestCase { $this->testDb->showLog(); $contents = ob_get_clean(); - $this->assertRegExp('/Query 1/s', $contents); - $this->assertRegExp('/Query 2/s', $contents); + $this->assertMatchesRegularExpression('/Query 1/s', $contents); + $this->assertMatchesRegularExpression('/Query 2/s', $contents); ob_start(); $this->testDb->showLog(true); $contents = ob_get_clean(); - $this->assertRegExp('/Query 1/s', $contents); - $this->assertRegExp('/Query 2/s', $contents); + $this->assertMatchesRegularExpression('/Query 1/s', $contents); + $this->assertMatchesRegularExpression('/Query 2/s', $contents); Configure::write('debug', $oldDebug); } diff --git a/lib/Cake/Test/Case/Network/Http/DigestAuthenticationTest.php b/lib/Cake/Test/Case/Network/Http/DigestAuthenticationTest.php index b61ad6970..37deca110 100644 --- a/lib/Cake/Test/Case/Network/Http/DigestAuthenticationTest.php +++ b/lib/Cake/Test/Case/Network/Http/DigestAuthenticationTest.php @@ -121,7 +121,7 @@ class DigestAuthenticationTest extends CakeTestCase { $auth = array('user' => 'admin', 'pass' => '1234'); DigestAuthentication::authentication($this->HttpSocket, $auth); $expected = '@Digest username="admin", realm="The batcave", nonce="4cded326c6c51", uri="/", response="[a-z0-9]{32}", qop="auth", nc=00000001, cnonce="[a-z0-9]+"@'; - $this->assertRegExp($expected, $this->HttpSocket->request['header']['Authorization']); + $this->assertMatchesRegularExpression($expected, $this->HttpSocket->request['header']['Authorization']); $this->assertEquals('auth', $auth['qop']); $this->assertEquals(2, $auth['nc']); } diff --git a/lib/Cake/Test/Case/Routing/DispatcherTest.php b/lib/Cake/Test/Case/Routing/DispatcherTest.php index aab7eef2b..806f75efd 100644 --- a/lib/Cake/Test/Case/Routing/DispatcherTest.php +++ b/lib/Cake/Test/Case/Routing/DispatcherTest.php @@ -635,7 +635,7 @@ class DispatcherTest extends CakeTestCase { $this->assertSame($test['controller'], 'testcontroller'); $this->assertSame($test['action'], 'testaction'); $this->assertSame($test['pass'][0], '1'); - $this->assertRegExp('/\\A(?:0)\\z/', $test['pass'][1]); + $this->assertMatchesRegularExpression('/\\A(?:0)\\z/', $test['pass'][1]); $this->assertSame($test['pass'][2], '23'); } @@ -651,12 +651,12 @@ class DispatcherTest extends CakeTestCase { $event = new CakeEvent('DispatcherTest', $Dispatcher, array('request' => $test)); $Dispatcher->parseParams($event); - $this->assertRegExp('/\\A(?:0)\\z/', $test['pass'][0]); - $this->assertRegExp('/\\A(?:0)\\z/', $test['pass'][1]); - $this->assertRegExp('/\\A(?:0)\\z/', $test['pass'][2]); - $this->assertRegExp('/\\A(?:0)\\z/', $test['pass'][3]); - $this->assertRegExp('/\\A(?:0)\\z/', $test['pass'][4]); - $this->assertRegExp('/\\A(?:0)\\z/', $test['pass'][5]); + $this->assertMatchesRegularExpression('/\\A(?:0)\\z/', $test['pass'][0]); + $this->assertMatchesRegularExpression('/\\A(?:0)\\z/', $test['pass'][1]); + $this->assertMatchesRegularExpression('/\\A(?:0)\\z/', $test['pass'][2]); + $this->assertMatchesRegularExpression('/\\A(?:0)\\z/', $test['pass'][3]); + $this->assertMatchesRegularExpression('/\\A(?:0)\\z/', $test['pass'][4]); + $this->assertMatchesRegularExpression('/\\A(?:0)\\z/', $test['pass'][5]); } /** @@ -671,12 +671,12 @@ class DispatcherTest extends CakeTestCase { $event = new CakeEvent('DispatcherTest', $Dispatcher, array('request' => $test)); $Dispatcher->parseParams($event); - $this->assertRegExp('/\\A(?:000)\\z/', $test['pass'][0]); - $this->assertRegExp('/\\A(?:0000)\\z/', $test['pass'][1]); - $this->assertRegExp('/\\A(?:00000)\\z/', $test['pass'][2]); - $this->assertRegExp('/\\A(?:000000)\\z/', $test['pass'][3]); - $this->assertRegExp('/\\A(?:000000)\\z/', $test['pass'][4]); - $this->assertRegExp('/\\A(?:0000000)\\z/', $test['pass'][5]); + $this->assertMatchesRegularExpression('/\\A(?:000)\\z/', $test['pass'][0]); + $this->assertMatchesRegularExpression('/\\A(?:0000)\\z/', $test['pass'][1]); + $this->assertMatchesRegularExpression('/\\A(?:00000)\\z/', $test['pass'][2]); + $this->assertMatchesRegularExpression('/\\A(?:000000)\\z/', $test['pass'][3]); + $this->assertMatchesRegularExpression('/\\A(?:000000)\\z/', $test['pass'][4]); + $this->assertMatchesRegularExpression('/\\A(?:0000000)\\z/', $test['pass'][5]); } /** @@ -691,12 +691,12 @@ class DispatcherTest extends CakeTestCase { $event = new CakeEvent('DispatcherTest', $Dispatcher, array('request' => $test)); $Dispatcher->parseParams($event); - $this->assertRegExp('/\\A(?:01)\\z/', $test['pass'][0]); - $this->assertRegExp('/\\A(?:0403)\\z/', $test['pass'][1]); - $this->assertRegExp('/\\A(?:04010)\\z/', $test['pass'][2]); - $this->assertRegExp('/\\A(?:000002)\\z/', $test['pass'][3]); - $this->assertRegExp('/\\A(?:000030)\\z/', $test['pass'][4]); - $this->assertRegExp('/\\A(?:0000400)\\z/', $test['pass'][5]); + $this->assertMatchesRegularExpression('/\\A(?:01)\\z/', $test['pass'][0]); + $this->assertMatchesRegularExpression('/\\A(?:0403)\\z/', $test['pass'][1]); + $this->assertMatchesRegularExpression('/\\A(?:04010)\\z/', $test['pass'][2]); + $this->assertMatchesRegularExpression('/\\A(?:000002)\\z/', $test['pass'][3]); + $this->assertMatchesRegularExpression('/\\A(?:000030)\\z/', $test['pass'][4]); + $this->assertMatchesRegularExpression('/\\A(?:0000400)\\z/', $test['pass'][5]); } /** @@ -718,8 +718,8 @@ class DispatcherTest extends CakeTestCase { $event = new CakeEvent('DispatcherTest', $Dispatcher, array('request' => $request)); $Dispatcher->parseParams($event); - $this->assertRegExp('/posts/', $request['controller']); - $this->assertRegExp('/home/', $request['action']); + $this->assertMatchesRegularExpression('/posts/', $request['controller']); + $this->assertMatchesRegularExpression('/home/', $request['action']); $this->assertTrue(isset($request['url']['sleep'])); $this->assertTrue(isset($request['url']['coffee'])); @@ -728,8 +728,8 @@ class DispatcherTest extends CakeTestCase { $event = new CakeEvent('DispatcherTest', $Dispatcher, array('request' => $request)); $Dispatcher->parseParams($event); - $this->assertRegExp('/pages/', $request['controller']); - $this->assertRegExp('/display/', $request['action']); + $this->assertMatchesRegularExpression('/pages/', $request['controller']); + $this->assertMatchesRegularExpression('/display/', $request['action']); $this->assertTrue(isset($request['url']['sleep'])); $this->assertTrue(isset($request['url']['coffee'])); $this->assertEquals('life', $request['url']['coffee']); diff --git a/lib/Cake/Test/Case/Routing/Route/CakeRouteTest.php b/lib/Cake/Test/Case/Routing/Route/CakeRouteTest.php index 5e6b99097..528b435df 100644 --- a/lib/Cake/Test/Case/Routing/Route/CakeRouteTest.php +++ b/lib/Cake/Test/Case/Routing/Route/CakeRouteTest.php @@ -65,16 +65,16 @@ class CakeRouteTest extends CakeTestCase { $route = new CakeRoute('/:controller/:action', array('controller' => 'posts')); $result = $route->compile(); - $this->assertRegExp($result, '/posts/edit'); - $this->assertRegExp($result, '/posts/super_delete'); + $this->assertMatchesRegularExpression($result, '/posts/edit'); + $this->assertMatchesRegularExpression($result, '/posts/super_delete'); $this->assertNotRegExp($result, '/posts'); $this->assertNotRegExp($result, '/posts/super_delete/1'); $route = new CakeRoute('/posts/foo:id', array('controller' => 'posts', 'action' => 'view')); $result = $route->compile(); - $this->assertRegExp($result, '/posts/foo:1'); - $this->assertRegExp($result, '/posts/foo:param'); + $this->assertMatchesRegularExpression($result, '/posts/foo:1'); + $this->assertMatchesRegularExpression($result, '/posts/foo:param'); $this->assertNotRegExp($result, '/posts'); $this->assertNotRegExp($result, '/posts/'); @@ -82,9 +82,9 @@ class CakeRouteTest extends CakeTestCase { $route = new CakeRoute('/:plugin/:controller/:action/*', array('plugin' => 'test_plugin', 'action' => 'index')); $result = $route->compile(); - $this->assertRegExp($result, '/test_plugin/posts/index'); - $this->assertRegExp($result, '/test_plugin/posts/edit/5'); - $this->assertRegExp($result, '/test_plugin/posts/edit/5/name:value/nick:name'); + $this->assertMatchesRegularExpression($result, '/test_plugin/posts/index'); + $this->assertMatchesRegularExpression($result, '/test_plugin/posts/edit/5'); + $this->assertMatchesRegularExpression($result, '/test_plugin/posts/edit/5/name:value/nick:name'); } /** @@ -95,11 +95,11 @@ class CakeRouteTest extends CakeTestCase { public function testRouteParameterOverlap() { $route = new CakeRoute('/invoices/add/:idd/:id', array('controller' => 'invoices', 'action' => 'add')); $result = $route->compile(); - $this->assertRegExp($result, '/invoices/add/1/3'); + $this->assertMatchesRegularExpression($result, '/invoices/add/1/3'); $route = new CakeRoute('/invoices/add/:id/:idd', array('controller' => 'invoices', 'action' => 'add')); $result = $route->compile(); - $this->assertRegExp($result, '/invoices/add/1/3'); + $this->assertMatchesRegularExpression($result, '/invoices/add/1/3'); } /** @@ -114,8 +114,8 @@ class CakeRouteTest extends CakeTestCase { array('id' => Router::ID) ); $result = $route->compile(); - $this->assertRegExp($result, '/posts/edit/1'); - $this->assertRegExp($result, '/posts/view/518098'); + $this->assertMatchesRegularExpression($result, '/posts/edit/1'); + $this->assertMatchesRegularExpression($result, '/posts/view/518098'); $this->assertNotRegExp($result, '/posts/edit/name-of-post'); $this->assertNotRegExp($result, '/posts/edit/4/other:param'); $this->assertEquals(array('id', 'controller', 'action'), $route->keys); @@ -126,8 +126,8 @@ class CakeRouteTest extends CakeTestCase { array('id' => Router::ID, 'lang' => '[a-z]{3}') ); $result = $route->compile(); - $this->assertRegExp($result, '/eng/posts/edit/1'); - $this->assertRegExp($result, '/cze/articles/view/1'); + $this->assertMatchesRegularExpression($result, '/eng/posts/edit/1'); + $this->assertMatchesRegularExpression($result, '/cze/articles/view/1'); $this->assertNotRegExp($result, '/language/articles/view/2'); $this->assertNotRegExp($result, '/eng/articles/view/name-of-article'); $this->assertEquals(array('lang', 'id', 'controller', 'action'), $route->keys); @@ -136,8 +136,8 @@ class CakeRouteTest extends CakeTestCase { $route = new CakeRoute('/posts/:id' . $delim . ':title'); $result = $route->compile(); - $this->assertRegExp($result, '/posts/1' . $delim . 'name-of-article'); - $this->assertRegExp($result, '/posts/13244' . $delim . 'name-of_Article[]'); + $this->assertMatchesRegularExpression($result, '/posts/1' . $delim . 'name-of-article'); + $this->assertMatchesRegularExpression($result, '/posts/13244' . $delim . 'name-of_Article[]'); $this->assertNotRegExp($result, '/posts/11!nameofarticle'); $this->assertNotRegExp($result, '/posts/11'); @@ -150,8 +150,8 @@ class CakeRouteTest extends CakeTestCase { array('id' => Router::ID, 'year' => Router::YEAR, 'title' => '[a-z-_]+') ); $result = $route->compile(); - $this->assertRegExp($result, '/posts/1:name-of-article/2009/'); - $this->assertRegExp($result, '/posts/13244:name-of-article/1999'); + $this->assertMatchesRegularExpression($result, '/posts/1:name-of-article/2009/'); + $this->assertMatchesRegularExpression($result, '/posts/13244:name-of-article/1999'); $this->assertNotRegExp($result, '/posts/hey_now:nameofarticle'); $this->assertNotRegExp($result, '/posts/:nameofarticle/2009'); $this->assertNotRegExp($result, '/posts/:nameofarticle/01'); @@ -163,8 +163,8 @@ class CakeRouteTest extends CakeTestCase { array('pass' => array('id', 'url_title'), 'id' => Router::ID) ); $result = $route->compile(); - $this->assertRegExp($result, '/posts/some_title_for_article-(uuid:12534)/'); - $this->assertRegExp($result, '/posts/some_title_for_article-(uuid:12534)'); + $this->assertMatchesRegularExpression($result, '/posts/some_title_for_article-(uuid:12534)/'); + $this->assertMatchesRegularExpression($result, '/posts/some_title_for_article-(uuid:12534)'); $this->assertNotRegExp($result, '/posts/'); $this->assertNotRegExp($result, '/posts/nameofarticle'); $this->assertNotRegExp($result, '/posts/nameofarticle-12347'); @@ -184,7 +184,7 @@ class CakeRouteTest extends CakeTestCase { array('year' => Router::YEAR, 'month' => Router::MONTH, 'day' => Router::DAY) ); $result = $route->compile(); - $this->assertRegExp($result, '/posts/08/01/2007/title-of-post'); + $this->assertMatchesRegularExpression($result, '/posts/08/01/2007/title-of-post'); $result = $route->parse('/posts/08/01/2007/title-of-post'); $this->assertEquals(7, count($result)); @@ -202,8 +202,8 @@ class CakeRouteTest extends CakeTestCase { ); $result = $route->compile(); - $this->assertRegExp($result, '/some_extra/page/this_is_the_slug'); - $this->assertRegExp($result, '/page/this_is_the_slug'); + $this->assertMatchesRegularExpression($result, '/some_extra/page/this_is_the_slug'); + $this->assertMatchesRegularExpression($result, '/page/this_is_the_slug'); $this->assertEquals(array('slug', 'extra'), $route->keys); $this->assertEquals(array('extra' => '[a-z1-9_]*', 'slug' => '[a-z1-9_]+', 'action' => 'view'), $route->options); $expected = array( @@ -224,8 +224,8 @@ class CakeRouteTest extends CakeTestCase { $result = $route->compile(); $this->assertNotRegExp($result, '/some_project/source'); - $this->assertRegExp($result, '/source/view'); - $this->assertRegExp($result, '/source/view/other/params'); + $this->assertMatchesRegularExpression($result, '/source/view'); + $this->assertMatchesRegularExpression($result, '/source/view/other/params'); $this->assertNotRegExp($result, '/chaw_test/wiki'); $this->assertNotRegExp($result, '/source/wierd_action'); } diff --git a/lib/Cake/Test/Case/Routing/RouterTest.php b/lib/Cake/Test/Case/Routing/RouterTest.php index 6f5191326..004e2ddf8 100644 --- a/lib/Cake/Test/Case/Routing/RouterTest.php +++ b/lib/Cake/Test/Case/Routing/RouterTest.php @@ -58,9 +58,9 @@ class RouterTest extends CakeTestCase { * @return void */ public function testFullBaseUrl() { - $this->assertRegExp('/^http(s)?:\/\//', Router::url('/', true)); - $this->assertRegExp('/^http(s)?:\/\//', Router::url(null, true)); - $this->assertRegExp('/^http(s)?:\/\//', Router::url(array('full_base' => true))); + $this->assertMatchesRegularExpression('/^http(s)?:\/\//', Router::url('/', true)); + $this->assertMatchesRegularExpression('/^http(s)?:\/\//', Router::url(null, true)); + $this->assertMatchesRegularExpression('/^http(s)?:\/\//', Router::url(array('full_base' => true))); $this->assertSame(FULL_BASE_URL . '/', Router::url(array('full_base' => true))); } @@ -2551,7 +2551,7 @@ class RouterTest extends CakeTestCase { 'url' => array('url' => 'eng/posts/view/1'), ); $result = Router::reverse($params, true); - $this->assertRegExp('/^http(s)?:\/\//', $result); + $this->assertMatchesRegularExpression('/^http(s)?:\/\//', $result); } public function testReverseToArrayNamed() { diff --git a/lib/Cake/Test/Case/TestSuite/ControllerTestCaseTest.php b/lib/Cake/Test/Case/TestSuite/ControllerTestCaseTest.php index 09a1933ab..3c837a2d8 100644 --- a/lib/Cake/Test/Case/TestSuite/ControllerTestCaseTest.php +++ b/lib/Cake/Test/Case/TestSuite/ControllerTestCaseTest.php @@ -332,7 +332,7 @@ class ControllerTestCaseTest extends CakeTestCase { $this->assertEquals($expected, $results); $result = $this->Case->controller->response->body(); - $this->assertRegExp('/This is the TestsAppsController index view/', $result); + $this->assertMatchesRegularExpression('/This is the TestsAppsController index view/', $result); $Controller = $this->Case->generate('TestsApps'); $this->Case->testAction('/tests_apps/redirect_to'); @@ -439,9 +439,9 @@ class ControllerTestCaseTest extends CakeTestCase { $result = $this->Case->testAction('/tests_apps/set_action', array( 'return' => 'contents' )); - $this->assertRegExp('/assertRegExp('/This is the TestsAppsController index view/', $result); - $this->assertRegExp('/<\/html>/', $result); + $this->assertMatchesRegularExpression('/assertMatchesRegularExpression('/This is the TestsAppsController index view/', $result); + $this->assertMatchesRegularExpression('/<\/html>/', $result); } /** @@ -585,9 +585,9 @@ class ControllerTestCaseTest extends CakeTestCase { $result = $this->Case->testAction('/tests_apps/set_action', array( 'return' => 'contents' )); - $this->assertRegExp('/assertRegExp('/This is the TestsAppsController index view/', $result); - $this->assertRegExp('/<\/html>/', $result); + $this->assertMatchesRegularExpression('/assertMatchesRegularExpression('/This is the TestsAppsController index view/', $result); + $this->assertMatchesRegularExpression('/<\/html>/', $result); } /** diff --git a/lib/Cake/Test/Case/TestSuite/HtmlCoverageReportTest.php b/lib/Cake/Test/Case/TestSuite/HtmlCoverageReportTest.php index 74529f03a..2c418891e 100644 --- a/lib/Cake/Test/Case/TestSuite/HtmlCoverageReportTest.php +++ b/lib/Cake/Test/Case/TestSuite/HtmlCoverageReportTest.php @@ -118,9 +118,9 @@ class HtmlCoverageReportTest extends CakeTestCase { 10 => array(array('id' => 'HtmlCoverageReportTest::testGenerateDiff')) ); $result = $this->Coverage->generateDiff('myfile.php', $file, $coverage); - $this->assertRegExp('/myfile\.php Code coverage\: \d+\.?\d*\%/', $result); - $this->assertRegExp('/
assertRegExp('//', $result); + $this->assertMatchesRegularExpression('/myfile\.php Code coverage\: \d+\.?\d*\%/', $result); + $this->assertMatchesRegularExpression('/assertMatchesRegularExpression('//', $result); foreach ($file as $i => $line) { $this->assertTrue(strpos($line, $result) !== 0, 'Content is missing ' . $i); $class = 'covered'; @@ -166,9 +166,9 @@ class HtmlCoverageReportTest extends CakeTestCase { ); $result = $this->Coverage->generateDiff('myfile.php', $file, $coverage); - $this->assertRegExp('/myfile\.php Code coverage\: \d+\.?\d*\%/', $result); - $this->assertRegExp('/assertRegExp('//', $result); + $this->assertMatchesRegularExpression('/myfile\.php Code coverage\: \d+\.?\d*\%/', $result); + $this->assertMatchesRegularExpression('/assertMatchesRegularExpression('//', $result); foreach ($file as $i => $line) { $this->assertTrue(strpos($line, $result) !== 0, 'Content is missing ' . $i); $class = 'covered'; diff --git a/lib/Cake/Test/Case/Utility/CakeTimeTest.php b/lib/Cake/Test/Case/Utility/CakeTimeTest.php index 33d9189a6..c0b738134 100644 --- a/lib/Cake/Test/Case/Utility/CakeTimeTest.php +++ b/lib/Cake/Test/Case/Utility/CakeTimeTest.php @@ -285,13 +285,13 @@ class CakeTimeTest extends CakeTestCase { strtotime('+2 weeks +2 days'), 'Y-m-d' ); - $this->assertRegExp('/^in 2 weeks, [1|2] day(s)?$/', $result); + $this->assertMatchesRegularExpression('/^in 2 weeks, [1|2] day(s)?$/', $result); $result = $this->Time->timeAgoInWords( strtotime('+2 weeks +2 days'), '%x' ); - $this->assertRegExp('/^in 2 weeks, [1|2] day(s)?$/', $result); + $this->assertMatchesRegularExpression('/^in 2 weeks, [1|2] day(s)?$/', $result); $result = $this->Time->timeAgoInWords( strtotime('+2 months +2 days'), diff --git a/lib/Cake/Test/Case/Utility/DebuggerTest.php b/lib/Cake/Test/Case/Utility/DebuggerTest.php index 5f1e02647..57e40f368 100644 --- a/lib/Cake/Test/Case/Utility/DebuggerTest.php +++ b/lib/Cake/Test/Case/Utility/DebuggerTest.php @@ -80,20 +80,20 @@ class DebuggerTest extends CakeTestCase { $result = Debugger::excerpt(__FILE__, __LINE__, 2); $this->assertTrue(is_array($result)); $this->assertEquals(5, count($result)); - $this->assertRegExp('/function(.+)testExcerpt/', $result[1]); + $this->assertMatchesRegularExpression('/function(.+)testExcerpt/', $result[1]); $result = Debugger::excerpt(__FILE__, 2, 2); $this->assertTrue(is_array($result)); $this->assertEquals(4, count($result)); $pattern = '/.*?.*?<\?php/'; - $this->assertRegExp($pattern, $result[0]); + $this->assertMatchesRegularExpression($pattern, $result[0]); $result = Debugger::excerpt(__FILE__, 11, 2); $this->assertEquals(5, count($result)); $pattern = '/\*<\/span>/'; - $this->assertRegExp($pattern, $result[0]); + $this->assertMatchesRegularExpression($pattern, $result[0]); $return = Debugger::excerpt('[internal]', 2, 2); $this->assertTrue(empty($return)); @@ -114,25 +114,25 @@ class DebuggerTest extends CakeTestCase { $result = Debugger::output(true); $this->assertEquals('Notice', $result[0]['error']); - $this->assertRegExp('/Undefined variable\:\s+out/', $result[0]['description']); - $this->assertRegExp('/DebuggerTest::testOutput/i', $result[0]['trace']); + $this->assertMatchesRegularExpression('/Undefined variable\:\s+out/', $result[0]['description']); + $this->assertMatchesRegularExpression('/DebuggerTest::testOutput/i', $result[0]['trace']); ob_start(); Debugger::output('txt'); $other .= ''; $result = ob_get_clean(); - $this->assertRegExp('/Undefined variable:\s+other/', $result); - $this->assertRegExp('/Context:/', $result); - $this->assertRegExp('/DebuggerTest::testOutput/i', $result); + $this->assertMatchesRegularExpression('/Undefined variable:\s+other/', $result); + $this->assertMatchesRegularExpression('/Context:/', $result); + $this->assertMatchesRegularExpression('/DebuggerTest::testOutput/i', $result); ob_start(); Debugger::output('html'); $wrong .= ''; $result = ob_get_clean(); - $this->assertRegExp('/
.+<\/pre>/', $result); - $this->assertRegExp('/Notice<\/b>/', $result); - $this->assertRegExp('/variable:\s+wrong/', $result); + $this->assertMatchesRegularExpression('/.+<\/pre>/', $result); + $this->assertMatchesRegularExpression('/Notice<\/b>/', $result); + $this->assertMatchesRegularExpression('/variable:\s+wrong/', $result); ob_start(); Debugger::output('js'); @@ -149,9 +149,9 @@ class DebuggerTest extends CakeTestCase { 'b' => array(), 'Notice', '/b', ' (8)', )); - $this->assertRegExp('/Undefined variable:\s+buzz/', $result[1]); - $this->assertRegExp('/]+>Code/', $result[1]); - $this->assertRegExp('/]+>Context/', $result[2]); + $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.'); } @@ -187,7 +187,7 @@ class DebuggerTest extends CakeTestCase { '&line={:line}">{:path}, line {:line}' )); $result = Debugger::trace(); - $this->assertRegExp('/' . preg_quote('txmt://open?url=file://', '/') . '(\/|[A-Z]:\\\\)' . '/', $result); + $this->assertMatchesRegularExpression('/' . preg_quote('txmt://open?url=file://', '/') . '(\/|[A-Z]:\\\\)' . '/', $result); Debugger::output('xml', array( 'error' => '{:code}
{:file} {:line} ' . @@ -248,7 +248,7 @@ class DebuggerTest extends CakeTestCase { Debugger::outputAs('js'); $result = Debugger::trace(); - $this->assertRegExp('/' . preg_quote('txmt://open?url=file://', '/') . '(\/|[A-Z]:\\\\)' . '/', $result); + $this->assertMatchesRegularExpression('/' . preg_quote('txmt://open?url=file://', '/') . '(\/|[A-Z]:\\\\)' . '/', $result); Debugger::addFormat('xml', array( 'error' => '{:code}
{:file} {:line} ' . @@ -641,7 +641,7 @@ TEXT; */ public function testTraceExclude() { $result = Debugger::trace(); - $this->assertRegExp('/^DebuggerTest::testTraceExclude/', $result); + $this->assertMatchesRegularExpression('/^DebuggerTest::testTraceExclude/', $result); $result = Debugger::trace(array( 'exclude' => array('DebuggerTest::testTraceExclude') diff --git a/lib/Cake/Test/Case/View/Helper/CacheHelperTest.php b/lib/Cake/Test/Case/View/Helper/CacheHelperTest.php index d9ba88c0c..fa9fec6cf 100644 --- a/lib/Cake/Test/Case/View/Helper/CacheHelperTest.php +++ b/lib/Cake/Test/Case/View/Helper/CacheHelperTest.php @@ -125,9 +125,9 @@ class CacheHelperTest extends CakeTestCase { $this->assertTrue(file_exists($filename)); $contents = file_get_contents($filename); - $this->assertRegExp('/php echo \$variable/', $contents); - $this->assertRegExp('/php echo microtime()/', $contents); - $this->assertRegExp('/clark kent/', $result); + $this->assertMatchesRegularExpression('/php echo \$variable/', $contents); + $this->assertMatchesRegularExpression('/php echo microtime()/', $contents); + $this->assertMatchesRegularExpression('/clark kent/', $result); unlink($filename); } @@ -184,9 +184,9 @@ class CacheHelperTest extends CakeTestCase { $this->assertTrue(file_exists($filename)); $contents = file_get_contents($filename); - $this->assertRegExp('/if \(is_writable\(TMP\)\)\:/', $contents); - $this->assertRegExp('/php echo \$variable/', $contents); - $this->assertRegExp('/php echo microtime()/', $contents); + $this->assertMatchesRegularExpression('/if \(is_writable\(TMP\)\)\:/', $contents); + $this->assertMatchesRegularExpression('/php echo \$variable/', $contents); + $this->assertMatchesRegularExpression('/php echo microtime()/', $contents); $this->assertNotRegExp('/cake:nocache/', $contents); unlink($filename); @@ -247,13 +247,13 @@ class CacheHelperTest extends CakeTestCase { $this->assertNotRegExp('/cake:nocache/', $result); $this->assertNotRegExp('/php echo/', $result); - $this->assertRegExp('/A\. Layout Before Content/', $result); - $this->assertRegExp('/B\. In Plain Element/', $result); - $this->assertRegExp('/C\. Layout After Test Element/', $result); - $this->assertRegExp('/D\. In View File/', $result); - $this->assertRegExp('/E\. Layout After Content/', $result); - $this->assertRegExp('/F\. In Element With No Cache Tags/', $result); - $this->assertRegExp('/G\. Layout After Content And After Element With No Cache Tags/', $result); + $this->assertMatchesRegularExpression('/A\. Layout Before Content/', $result); + $this->assertMatchesRegularExpression('/B\. In Plain Element/', $result); + $this->assertMatchesRegularExpression('/C\. Layout After Test Element/', $result); + $this->assertMatchesRegularExpression('/D\. In View File/', $result); + $this->assertMatchesRegularExpression('/E\. Layout After Content/', $result); + $this->assertMatchesRegularExpression('/F\. In Element With No Cache Tags/', $result); + $this->assertMatchesRegularExpression('/G\. Layout After Content And After Element With No Cache Tags/', $result); $this->assertNotRegExp('/1\. layout before content/', $result); $this->assertNotRegExp('/2\. in plain element/', $result); $this->assertNotRegExp('/3\. layout after test element/', $result); @@ -267,20 +267,20 @@ class CacheHelperTest extends CakeTestCase { $contents = file_get_contents($filename); unlink($filename); - $this->assertRegExp('/A\. Layout Before Content/', $contents); + $this->assertMatchesRegularExpression('/A\. Layout Before Content/', $contents); $this->assertNotRegExp('/B\. In Plain Element/', $contents); - $this->assertRegExp('/C\. Layout After Test Element/', $contents); - $this->assertRegExp('/D\. In View File/', $contents); - $this->assertRegExp('/E\. Layout After Content/', $contents); - $this->assertRegExp('/F\. In Element With No Cache Tags/', $contents); - $this->assertRegExp('/G\. Layout After Content And After Element With No Cache Tags/', $contents); - $this->assertRegExp('/1\. layout before content/', $contents); + $this->assertMatchesRegularExpression('/C\. Layout After Test Element/', $contents); + $this->assertMatchesRegularExpression('/D\. In View File/', $contents); + $this->assertMatchesRegularExpression('/E\. Layout After Content/', $contents); + $this->assertMatchesRegularExpression('/F\. In Element With No Cache Tags/', $contents); + $this->assertMatchesRegularExpression('/G\. Layout After Content And After Element With No Cache Tags/', $contents); + $this->assertMatchesRegularExpression('/1\. layout before content/', $contents); $this->assertNotRegExp('/2\. in plain element/', $contents); - $this->assertRegExp('/3\. layout after test element/', $contents); - $this->assertRegExp('/4\. in view file/', $contents); - $this->assertRegExp('/5\. layout after content/', $contents); - $this->assertRegExp('/6\. in element with no cache tags/', $contents); - $this->assertRegExp('/7\. layout after content and after element with no cache tags/', $contents); + $this->assertMatchesRegularExpression('/3\. layout after test element/', $contents); + $this->assertMatchesRegularExpression('/4\. in view file/', $contents); + $this->assertMatchesRegularExpression('/5\. layout after content/', $contents); + $this->assertMatchesRegularExpression('/6\. in element with no cache tags/', $contents); + $this->assertMatchesRegularExpression('/7\. layout after content and after element with no cache tags/', $contents); } /** @@ -308,9 +308,9 @@ class CacheHelperTest extends CakeTestCase { $this->assertTrue(file_exists($filename)); $contents = file_get_contents($filename); - $this->assertRegExp('/\$this\-\>viewVars/', $contents); - $this->assertRegExp('/extract\(\$this\-\>viewVars, EXTR_SKIP\);/', $contents); - $this->assertRegExp('/php echo \$variable/', $contents); + $this->assertMatchesRegularExpression('/\$this\-\>viewVars/', $contents); + $this->assertMatchesRegularExpression('/extract\(\$this\-\>viewVars, EXTR_SKIP\);/', $contents); + $this->assertMatchesRegularExpression('/php echo \$variable/', $contents); unlink($filename); } @@ -344,7 +344,7 @@ class CacheHelperTest extends CakeTestCase { $contents = file_get_contents($filename); - $this->assertRegExp('/\$controller->startupProcess\(\);/', $contents); + $this->assertMatchesRegularExpression('/\$controller->startupProcess\(\);/', $contents); unlink($filename); } @@ -622,7 +622,7 @@ class CacheHelperTest extends CakeTestCase { $result = $View->render('cache_empty_sections'); $this->assertNotRegExp('/nocache/', $result); $this->assertNotRegExp('/php echo/', $result); - $this->assertRegExp( + $this->assertMatchesRegularExpression( '@\s*\s*' . '\s*' . 'View Content\s*' . @@ -633,7 +633,7 @@ class CacheHelperTest extends CakeTestCase { $this->assertTrue(file_exists($filename)); $contents = file_get_contents($filename); $this->assertNotRegExp('/nocache/', $contents); - $this->assertRegExp( + $this->assertMatchesRegularExpression( '@\s*Posts \s*' . '<\?php \$x \= 1; \?>\s*' . '\s*' . diff --git a/lib/Cake/Test/Case/View/Helper/FormHelperTest.php b/lib/Cake/Test/Case/View/Helper/FormHelperTest.php index e688a0552..ab4b0dd4f 100644 --- a/lib/Cake/Test/Case/View/Helper/FormHelperTest.php +++ b/lib/Cake/Test/Case/View/Helper/FormHelperTest.php @@ -639,7 +639,7 @@ class FormHelperTest extends CakeTestCase { public function testValidateHashNoModel() { $this->Form->request['_Token'] = array('key' => 'foo'); $result = $this->Form->secure(array('anything')); - $this->assertRegExp('/540ac9c60d323c22bafe997b72c0790f39a8bdef/', $result); + $this->assertMatchesRegularExpression('/540ac9c60d323c22bafe997b72c0790f39a8bdef/', $result); } /** @@ -656,18 +656,18 @@ class FormHelperTest extends CakeTestCase { $result = $this->Form->input('ValidateUser.name'); $this->assertEquals(array('ValidateUser', 'name'), $this->Form->entity()); - $this->assertRegExp('/name="data\[ValidateUser\]\[name\]"/', $result); - $this->assertRegExp('/type="text"/', $result); + $this->assertMatchesRegularExpression('/name="data\[ValidateUser\]\[name\]"/', $result); + $this->assertMatchesRegularExpression('/type="text"/', $result); $result = $this->Form->input('ValidateItem.name'); $this->assertEquals(array('ValidateItem', 'name'), $this->Form->entity()); - $this->assertRegExp('/name="data\[ValidateItem\]\[name\]"/', $result); - $this->assertRegExp('/