/', $result);
- $this->assertRegExp('/(Notice|Warning)<\/b>/', $result);
- $this->assertRegExp('/variable\:?\s+\$?wrong/', $result);
+ $this->assertMatchesRegularExpression('//', $result);
+ $this->assertMatchesRegularExpression('/(Notice|Warning)<\/b>/', $result);
+ $this->assertMatchesRegularExpression('/variable\:?\s+\$?wrong/', $result);
restore_error_handler();
}
@@ -133,7 +133,7 @@ public function testErrorMapping($error, $expected) {
trigger_error('Test error', $error);
$result = ob_get_clean();
- $this->assertRegExp('/' . $expected . '<\/b>/', $result);
+ $this->assertMatchesRegularExpression('/' . $expected . '<\/b>/', $result);
restore_error_handler();
}
@@ -181,7 +181,7 @@ public function testHandleErrorDebugOff() {
$result = file(LOGS . 'debug.log');
$this->assertIsArray($result);
$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]
);
@@ -207,7 +207,7 @@ public function testHandleErrorDebugOffPHP8() {
$result = file(LOGS . 'error.log');
$this->assertIsArray($result);
$this->assertEquals(1, count($result));
- $this->assertRegExp(
+ $this->assertMatchesRegularExpression(
'/^\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2} Warning: Warning \(2\): Undefined variable \$out in \[.+ line \d+\]$/',
$result[0]
);
@@ -237,12 +237,12 @@ public function testHandleErrorLoggingTrace() {
$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');
}
@@ -265,12 +265,12 @@ public function testHandleErrorLoggingTracePHP8() {
$result = file(LOGS . 'error.log');
- $this->assertRegExp(
+ $this->assertMatchesRegularExpression(
'/^\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2} Warning: Warning \(2\): Undefined variable \$out in \[.+ line \d+\]$/',
$result[0]
);
- $this->assertRegExp('/^Trace:/', $result[1]);
- $this->assertRegExp('/^ErrorHandlerTest\:\:testHandleErrorLoggingTracePHP8\(\)/', $result[3]);
+ $this->assertMatchesRegularExpression('/^Trace:/', $result[1]);
+ $this->assertMatchesRegularExpression('/^ErrorHandlerTest\:\:testHandleErrorLoggingTracePHP8\(\)/', $result[3]);
if (file_exists(LOGS . 'error.log')) {
unlink(LOGS . 'error.log');
}
@@ -287,7 +287,7 @@ public function testHandleException() {
ob_start();
ErrorHandler::handleException($error);
$result = ob_get_clean();
- $this->assertRegExp('/Kaboom!/', $result, 'message missing.');
+ $this->assertMatchesRegularExpression('/Kaboom!/', $result, 'message missing.');
}
/**
@@ -305,7 +305,7 @@ public function testHandleExceptionLog() {
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->assertStringContainsString('[NotFoundException] Kaboom!', $log[0], 'message missing.');
@@ -329,12 +329,12 @@ public function testHandleExceptionLogSkipping() {
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->assertStringNotContainsString('[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 3b0f835..cd04979 100644
--- a/lib/Cake/Test/Case/Error/ExceptionRendererTest.php
+++ b/lib/Cake/Test/Case/Error/ExceptionRendererTest.php
@@ -237,7 +237,7 @@ public function testSubclassConvertingFrameworkErrors() {
$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 @@ public function testError400() {
$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);
}
/**
@@ -452,8 +452,8 @@ public function testError400NoInjection() {
$ExceptionRenderer->render();
$result = ob_get_clean();
- $this->assertNotRegExp('##', $result);
+ $this->assertDoesNotMatchRegularExpression('##', $result);
}
/**
@@ -471,7 +471,7 @@ public function testError500Message() {
$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 @@ public function testMissingController() {
$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 @@ public function testCakeExceptionHandling($exception, $patterns, $code) {
$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 f7fbbfd..d5a2165 100644
--- a/lib/Cake/Test/Case/Log/CakeLogTest.php
+++ b/lib/Cake/Test/Case/Log/CakeLogTest.php
@@ -160,7 +160,7 @@ public function testConfig() {
$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 @@ public function testLogFileWriting() {
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 @@ public function testConvenienceMethods() {
$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 @@ public function testConvenienceMethods() {
$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 56df657..30a4349 100644
--- a/lib/Cake/Test/Case/Log/Engine/FileLogTest.php
+++ b/lib/Cake/Test/Case/Log/Engine/FileLogTest.php
@@ -38,19 +38,19 @@ public function testLogFileWriting() {
$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 @@ public function testRotation() {
$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 @@ public function testRotation() {
$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 @@ public function testRotation() {
$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 @@ public function testRotation() {
$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 102e178..bf38c69 100644
--- a/lib/Cake/Test/Case/Model/CakeSchemaTest.php
+++ b/lib/Cake/Test/Case/Model/CakeSchemaTest.php
@@ -737,7 +737,7 @@ public function testGenerateTable() {
'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'),
@@ -753,8 +753,8 @@ public function testGenerateTable() {
)
);
$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);
}
/**
@@ -1155,11 +1155,11 @@ public function testSchemaCreateTable() {
$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 6591e02..056614a 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 @@ public function testGenerateAssociationQuerySelfJoin() {
}
$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 @@ public function testGenerateAssociationQuerySelfJoin() {
$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 @@ public function testGenerateAssociationQuerySelfJoinWithConditionsInHasOneBindin
$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 @@ public function testGenerateAssociationQuerySelfJoinWithConditionsInBelongsToBin
$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 @@ public function testGenerateAssociationQuerySelfJoinWithConditions() {
$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 @@ public function testGenerateAssociationQuerySelfJoinWithConditions() {
$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 @@ public function testGenerateAssociationQueryHasOne() {
$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 @@ public function testGenerateAssociationQueryHasOneWithConditions() {
$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 @@ public function testGenerateAssociationQueryBelongsTo() {
$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 @@ public function testGenerateAssociationQueryBelongsToWithConditions() {
$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 @@ public function testGenerateAssociationQueryHasMany() {
$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 @@ public function testGenerateAssociationQueryHasManyWithLimit() {
$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 @@ public function testGenerateAssociationQueryHasManyWithLimit() {
);
$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 @@ public function testGenerateAssociationQueryHasManyWithConditions() {
$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 @@ public function testGenerateAssociationQueryHasManyWithOffsetAndLimit() {
$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 @@ public function testGenerateAssociationQueryHasManyWithPageAndLimit() {
$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 @@ public function testGenerateAssociationQueryHasManyWithFields() {
$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 @@ public function testGenerateAssociationQueryHasManyWithFields() {
$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 @@ public function testGenerateAssociationQueryHasManyWithFields() {
$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 @@ public function testGenerateAssociationQueryHasManyWithFields() {
$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 @@ public function testGenerateAssociationQueryHasManyWithFields() {
$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 @@ public function testGenerateAssociationQueryHasManyWithFields() {
$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 @@ public function testGenerateAssociationQueryHasManyAndAggregateFunction() {
$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 @@ public function testGenerateAssociationQueryHasAndBelongsToMany() {
$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 @@ public function testGenerateAssociationQueryHasAndBelongsToManyWithConditions()
$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 @@ public function testGenerateAssociationQueryHasAndBelongsToManyWithOffsetAndLimi
$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 @@ public function testGenerateAssociationQueryHasAndBelongsToManyWithPageAndLimit(
$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 @@ public function testStringConditionsParsing() {
$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 @@ public function testHypenInStringConditionsAndFieldNames() {
*/
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 @@ public function testParenthesisInStringConditions() {
*/
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 @@ public function testParenthesisInArrayConditions() {
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 @@ public function testArrayConditionsParsing() {
'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 @@ public function testMixedConditionsParsing() {
'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 @@ public function testMixedConditionsParsing() {
*/
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 @@ public function testRenderStatement() {
'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 @@ public function testSchema() {
$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 @@ public function testOrderParsing() {
$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 @@ public function testOrderParsing() {
*/
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 @@ public function testConditionsWithComplexVirtualFields() {
$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 @@ public function testReadVirtualFieldsWithNewLines() {
);
$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 @@ public function testFieldsWithComplexVirtualFields() {
$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 2dcd6d0..ad8f766 100644
--- a/lib/Cake/Test/Case/Model/Datasource/Database/PostgresTest.php
+++ b/lib/Cake/Test/Case/Model/Datasource/Database/PostgresTest.php
@@ -530,7 +530,7 @@ public function testSchemaIndexSyntax() {
));
$result = $this->Dbo->createSchema($schema);
- $this->assertNotRegExp('/^CREATE INDEX(.+);,$/', $result);
+ $this->assertDoesNotMatchRegularExpression('/^CREATE INDEX(.+);,$/', $result);
}
/**
@@ -566,8 +566,8 @@ public function testCakeSchema() {
);
$result = $db1->createSchema($schema, 'datatype_tests');
- $this->assertNotRegExp('/timestamp DEFAULT/', $result);
- $this->assertRegExp('/\"full_length\"\s*text\s.*,/', $result);
+ $this->assertDoesNotMatchRegularExpression('/timestamp DEFAULT/', $result);
+ $this->assertMatchesRegularExpression('/\"full_length\"\s*text\s.*,/', $result);
$this->assertContains('timestamp ,', $result);
$this->assertContains('"huge_int" bigint NOT NULL,', $result);
@@ -709,7 +709,7 @@ public function testAlterSchema() {
)
));
$result = $this->Dbo->alterSchema($New->compare($Old), 'alter_posts');
- $this->assertNotRegExp('/varchar\(36\) NOT NULL/i', $result);
+ $this->assertDoesNotMatchRegularExpression('/varchar\(36\) NOT NULL/i', $result);
}
/**
diff --git a/lib/Cake/Test/Case/Model/Datasource/Database/SqlserverTest.php b/lib/Cake/Test/Case/Model/Datasource/Database/SqlserverTest.php
index 8cfef90..68c68f9 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 @@ public function testDistinctWithLimit() {
'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);
}
/**
@@ -645,9 +645,9 @@ public function testUpdateAllSyntax() {
$this->db->update($this->model, $fields, null, $conditions);
$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->assertDoesNotMatchRegularExpression('/SqlserverTestModel/', $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 b22d6dc..cf83d2c 100644
--- a/lib/Cake/Test/Case/Model/Datasource/DboSourceTest.php
+++ b/lib/Cake/Test/Case/Model/Datasource/DboSourceTest.php
@@ -996,15 +996,15 @@ public function testLog() {
$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/Model/ModelReadTest.php b/lib/Cake/Test/Case/Model/ModelReadTest.php
index a9b4124..c7eda51 100644
--- a/lib/Cake/Test/Case/Model/ModelReadTest.php
+++ b/lib/Cake/Test/Case/Model/ModelReadTest.php
@@ -7351,7 +7351,7 @@ public function testFindCount() {
$log = $this->db->getLog();
$this->assertTrue(isset($log['log'][0]['query']));
- $this->assertNotRegExp('/ORDER\s+BY/', $log['log'][0]['query']);
+ $this->assertDoesNotMatchRegularExpression('/ORDER\s+BY/', $log['log'][0]['query']);
$Article = new Article();
$Article->order = null;
diff --git a/lib/Cake/Test/Case/Network/Http/DigestAuthenticationTest.php b/lib/Cake/Test/Case/Network/Http/DigestAuthenticationTest.php
index da621c1..e755795 100644
--- a/lib/Cake/Test/Case/Network/Http/DigestAuthenticationTest.php
+++ b/lib/Cake/Test/Case/Network/Http/DigestAuthenticationTest.php
@@ -121,7 +121,7 @@ public function testQop() {
$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 4fbe1f2..30c652f 100644
--- a/lib/Cake/Test/Case/Routing/DispatcherTest.php
+++ b/lib/Cake/Test/Case/Routing/DispatcherTest.php
@@ -635,7 +635,7 @@ public function testParseParamsWithSingleZero() {
$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 @@ public function testParseParamsWithManySingleZeros() {
$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 @@ public function testParseParamsWithManyZerosInEachSectionOfUrl() {
$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 @@ public function testParseParamsWithMixedOneToManyZerosInEachSectionOfUrl() {
$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 @@ public function testQueryStringOnRoot() {
$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 @@ public function testQueryStringOnRoot() {
$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 5d61cce..b6cb2aa 100644
--- a/lib/Cake/Test/Case/Routing/Route/CakeRouteTest.php
+++ b/lib/Cake/Test/Case/Routing/Route/CakeRouteTest.php
@@ -65,26 +65,26 @@ public function testBasicRouteCompiling() {
$route = new CakeRoute('/:controller/:action', array('controller' => 'posts'));
$result = $route->compile();
- $this->assertRegExp($result, '/posts/edit');
- $this->assertRegExp($result, '/posts/super_delete');
- $this->assertNotRegExp($result, '/posts');
- $this->assertNotRegExp($result, '/posts/super_delete/1');
+ $this->assertMatchesRegularExpression($result, '/posts/edit');
+ $this->assertMatchesRegularExpression($result, '/posts/super_delete');
+ $this->assertDoesNotMatchRegularExpression($result, '/posts');
+ $this->assertDoesNotMatchRegularExpression($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->assertNotRegExp($result, '/posts');
- $this->assertNotRegExp($result, '/posts/');
+ $this->assertMatchesRegularExpression($result, '/posts/foo:1');
+ $this->assertMatchesRegularExpression($result, '/posts/foo:param');
+ $this->assertDoesNotMatchRegularExpression($result, '/posts');
+ $this->assertDoesNotMatchRegularExpression($result, '/posts/');
$this->assertEquals(array('id'), $route->keys);
$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 @@ public function testBasicRouteCompiling() {
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,10 +114,10 @@ public function testRouteCompilingWithParamPatterns() {
array('id' => Router::ID)
);
$result = $route->compile();
- $this->assertRegExp($result, '/posts/edit/1');
- $this->assertRegExp($result, '/posts/view/518098');
- $this->assertNotRegExp($result, '/posts/edit/name-of-post');
- $this->assertNotRegExp($result, '/posts/edit/4/other:param');
+ $this->assertMatchesRegularExpression($result, '/posts/edit/1');
+ $this->assertMatchesRegularExpression($result, '/posts/view/518098');
+ $this->assertDoesNotMatchRegularExpression($result, '/posts/edit/name-of-post');
+ $this->assertDoesNotMatchRegularExpression($result, '/posts/edit/4/other:param');
$this->assertEquals(array('id', 'controller', 'action'), $route->keys);
$route = new CakeRoute(
@@ -126,20 +126,20 @@ public function testRouteCompilingWithParamPatterns() {
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->assertNotRegExp($result, '/language/articles/view/2');
- $this->assertNotRegExp($result, '/eng/articles/view/name-of-article');
+ $this->assertMatchesRegularExpression($result, '/eng/posts/edit/1');
+ $this->assertMatchesRegularExpression($result, '/cze/articles/view/1');
+ $this->assertDoesNotMatchRegularExpression($result, '/language/articles/view/2');
+ $this->assertDoesNotMatchRegularExpression($result, '/eng/articles/view/name-of-article');
$this->assertEquals(array('lang', 'id', 'controller', 'action'), $route->keys);
foreach (array(':', '@', ';', '$', '-') as $delim) {
$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->assertNotRegExp($result, '/posts/11!nameofarticle');
- $this->assertNotRegExp($result, '/posts/11');
+ $this->assertMatchesRegularExpression($result, '/posts/1' . $delim . 'name-of-article');
+ $this->assertMatchesRegularExpression($result, '/posts/13244' . $delim . 'name-of_Article[]');
+ $this->assertDoesNotMatchRegularExpression($result, '/posts/11!nameofarticle');
+ $this->assertDoesNotMatchRegularExpression($result, '/posts/11');
$this->assertEquals(array('title', 'id'), $route->keys);
}
@@ -150,11 +150,11 @@ public function testRouteCompilingWithParamPatterns() {
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->assertNotRegExp($result, '/posts/hey_now:nameofarticle');
- $this->assertNotRegExp($result, '/posts/:nameofarticle/2009');
- $this->assertNotRegExp($result, '/posts/:nameofarticle/01');
+ $this->assertMatchesRegularExpression($result, '/posts/1:name-of-article/2009/');
+ $this->assertMatchesRegularExpression($result, '/posts/13244:name-of-article/1999');
+ $this->assertDoesNotMatchRegularExpression($result, '/posts/hey_now:nameofarticle');
+ $this->assertDoesNotMatchRegularExpression($result, '/posts/:nameofarticle/2009');
+ $this->assertDoesNotMatchRegularExpression($result, '/posts/:nameofarticle/01');
$this->assertEquals(array('year', 'title', 'id'), $route->keys);
$route = new CakeRoute(
@@ -163,11 +163,11 @@ public function testRouteCompilingWithParamPatterns() {
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->assertNotRegExp($result, '/posts/');
- $this->assertNotRegExp($result, '/posts/nameofarticle');
- $this->assertNotRegExp($result, '/posts/nameofarticle-12347');
+ $this->assertMatchesRegularExpression($result, '/posts/some_title_for_article-(uuid:12534)/');
+ $this->assertMatchesRegularExpression($result, '/posts/some_title_for_article-(uuid:12534)');
+ $this->assertDoesNotMatchRegularExpression($result, '/posts/');
+ $this->assertDoesNotMatchRegularExpression($result, '/posts/nameofarticle');
+ $this->assertDoesNotMatchRegularExpression($result, '/posts/nameofarticle-12347');
$this->assertEquals(array('url_title', 'id'), $route->keys);
}
@@ -184,7 +184,7 @@ public function testComplexRouteCompilingAndParsing() {
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 @@ public function testComplexRouteCompilingAndParsing() {
);
$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(
@@ -223,11 +223,11 @@ public function testComplexRouteCompilingAndParsing() {
$this->assertFalse($route->parse('/chaw_test/wiki'));
$result = $route->compile();
- $this->assertNotRegExp($result, '/some_project/source');
- $this->assertRegExp($result, '/source/view');
- $this->assertRegExp($result, '/source/view/other/params');
- $this->assertNotRegExp($result, '/chaw_test/wiki');
- $this->assertNotRegExp($result, '/source/wierd_action');
+ $this->assertDoesNotMatchRegularExpression($result, '/some_project/source');
+ $this->assertMatchesRegularExpression($result, '/source/view');
+ $this->assertMatchesRegularExpression($result, '/source/view/other/params');
+ $this->assertDoesNotMatchRegularExpression($result, '/chaw_test/wiki');
+ $this->assertDoesNotMatchRegularExpression($result, '/source/wierd_action');
}
/**
diff --git a/lib/Cake/Test/Case/Routing/RouterTest.php b/lib/Cake/Test/Case/Routing/RouterTest.php
index d9ffb3b..36c3f62 100644
--- a/lib/Cake/Test/Case/Routing/RouterTest.php
+++ b/lib/Cake/Test/Case/Routing/RouterTest.php
@@ -58,9 +58,9 @@ public function tearDown(): void {
* @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 @@ public function testReverseFull() {
'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 78ca15f..8a15e4e 100644
--- a/lib/Cake/Test/Case/TestSuite/ControllerTestCaseTest.php
+++ b/lib/Cake/Test/Case/TestSuite/ControllerTestCaseTest.php
@@ -332,7 +332,7 @@ public function testTestAction() {
$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 @@ public function testBCSetReturn() {
$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 @@ public function testNoMocking() {
$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 c97d621..9db4ed3 100644
--- a/lib/Cake/Test/Case/TestSuite/HtmlCoverageReportTest.php
+++ b/lib/Cake/Test/Case/TestSuite/HtmlCoverageReportTest.php
@@ -118,9 +118,9 @@ public function testGenerateDiff() {
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 @@ public function testPhpunit36Compatibility() {
);
$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 b652548..519ae48 100644
--- a/lib/Cake/Test/Case/Utility/CakeTimeTest.php
+++ b/lib/Cake/Test/Case/Utility/CakeTimeTest.php
@@ -285,13 +285,13 @@ public function testTimeAgoInWordsWithFormat() {
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 3b9b3b3..a83555f 100644
--- a/lib/Cake/Test/Case/Utility/DebuggerTest.php
+++ b/lib/Cake/Test/Case/Utility/DebuggerTest.php
@@ -80,20 +80,23 @@ public function testExcerpt() {
$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]);
+ if (version_compare(PHP_VERSION, '8.3.0') >= 0) {
+ $pattern = '/.*?.*?<\?php/';
+ }
+ $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));
@@ -116,14 +119,14 @@ public function testOutput() {
$type = $this->isPHP7() ? 'Notice' : 'Warning';
$this->assertEquals($type, $result[0]['error']);
if ($this->isPHP8()) {
- $this->assertRegExp('/Undefined variable \$out/', $result[0]['description']);
+ $this->assertMatchesRegularExpression('/Undefined variable \$out/', $result[0]['description']);
}
if ($this->isPHP7()) {
- $this->assertRegExp('/Undefined variable\:\s+out/', $result[0]['description']);
+ $this->assertMatchesRegularExpression('/Undefined variable\:\s+out/', $result[0]['description']);
}
- $this->assertRegExp('/DebuggerTest::testOutput/i', $result[0]['trace']);
+ $this->assertMatchesRegularExpression('/DebuggerTest::testOutput/i', $result[0]['trace']);
ob_start();
Debugger::output('txt');
@@ -131,29 +134,29 @@ public function testOutput() {
$result = ob_get_clean();
if ($this->isPHP7()) {
- $this->assertRegExp('/Undefined variable:\s+other/', $result);
+ $this->assertMatchesRegularExpression('/Undefined variable:\s+other/', $result);
}
if ($this->isPHP8()) {
- $this->assertRegExp('/Undefined variable \$other/', $result);
+ $this->assertMatchesRegularExpression('/Undefined variable \$other/', $result);
}
- $this->assertRegExp('/Trace:/', $result);
- $this->assertRegExp('/DebuggerTest::testOutput/i', $result);
+ $this->assertMatchesRegularExpression('/Trace:/', $result);
+ $this->assertMatchesRegularExpression('/DebuggerTest::testOutput/i', $result);
ob_start();
Debugger::output('html');
$wrong .= '';
$result = ob_get_clean();
- $this->assertRegExp('/.+<\/pre>/', $result);
+ $this->assertMatchesRegularExpression('/.+<\/pre>/', $result);
if ($this->isPHP7()) {
- $this->assertRegExp('/Notice<\/b>/', $result);
- $this->assertRegExp('/variable:\s+wrong/', $result);
+ $this->assertMatchesRegularExpression('/Notice<\/b>/', $result);
+ $this->assertMatchesRegularExpression('/variable:\s+wrong/', $result);
}
if ($this->isPHP8()) {
- $this->assertRegExp('/Warning<\/b>/', $result);
- $this->assertRegExp('/variable \$wrong/', $result);
+ $this->assertMatchesRegularExpression('/Warning<\/b>/', $result);
+ $this->assertMatchesRegularExpression('/variable \$wrong/', $result);
}
@@ -190,9 +193,9 @@ public function testOutput() {
if ($this->isPHP8()) {
$pattern = '/Undefined variable \$buzz/';
}
- $this->assertRegExp($pattern, $result[1]);
- $this->assertRegExp('/]+>Code/', $result[1]);
- $this->assertRegExp('/]+>Context/', $result[2]);
+ $this->assertMatchesRegularExpression($pattern, $result[1]);
+ $this->assertMatchesRegularExpression('/]+>Code/', $result[1]);
+ $this->assertMatchesRegularExpression('/]+>Context/', $result[2]);
if (!$this->isPHP8()) {
$this->assertStringContainsString('$wrong = ''', $result[3], 'Context should be HTML escaped.');
}
@@ -232,7 +235,7 @@ public function testChangeOutputFormats() {
'&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} ' .
@@ -305,7 +308,7 @@ public function testAddFormat() {
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} ' .
@@ -713,11 +716,11 @@ public function testExportVarRecursion() {
*/
public function testTraceExclude() {
$result = Debugger::trace();
- $this->assertRegExp('/^DebuggerTest::testTraceExclude/', $result);
+ $this->assertMatchesRegularExpression('/^DebuggerTest::testTraceExclude/', $result);
$result = Debugger::trace(array(
'exclude' => array('DebuggerTest::testTraceExclude')
));
- $this->assertNotRegExp('/^DebuggerTest::testTraceExclude/', $result);
+ $this->assertDoesNotMatchRegularExpression('/^DebuggerTest::testTraceExclude/', $result);
}
}
diff --git a/lib/Cake/Test/Case/Utility/XmlTest.php b/lib/Cake/Test/Case/Utility/XmlTest.php
index 427cb48..c9b126b 100644
--- a/lib/Cake/Test/Case/Utility/XmlTest.php
+++ b/lib/Cake/Test/Case/Utility/XmlTest.php
@@ -164,7 +164,7 @@ public function testBuild() {
$this->assertEquals('value', $obj->firstChild->nodeValue);
$obj = Xml::build($xml, array('return' => 'domdocument', 'encoding' => null));
- $this->assertNotRegExp('/encoding/', $obj->saveXML());
+ $this->assertDoesNotMatchRegularExpression('/encoding/', $obj->saveXML());
}
/**
diff --git a/lib/Cake/Test/Case/View/Helper/CacheHelperTest.php b/lib/Cake/Test/Case/View/Helper/CacheHelperTest.php
index 0f2a852..b5369cf 100644
--- a/lib/Cake/Test/Case/View/Helper/CacheHelperTest.php
+++ b/lib/Cake/Test/Case/View/Helper/CacheHelperTest.php
@@ -118,16 +118,16 @@ public function testLayoutCacheParsingNoTagsInView() {
$View = new View($this->Controller);
$result = $View->render('index');
- $this->assertNotRegExp('/cake:nocache/', $result);
- $this->assertNotRegExp('/php echo/', $result);
+ $this->assertDoesNotMatchRegularExpression('/cake:nocache/', $result);
+ $this->assertDoesNotMatchRegularExpression('/php echo/', $result);
$filename = CACHE . 'views' . DS . 'cachetest_cache_parsing.php';
$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);
}
@@ -177,17 +177,17 @@ public function testLayoutCacheParsingWithTagsInView() {
$View = new View($this->Controller);
$result = $View->render('test_nocache_tags');
- $this->assertNotRegExp('/cake:nocache/', $result);
- $this->assertNotRegExp('/php echo/', $result);
+ $this->assertDoesNotMatchRegularExpression('/cake:nocache/', $result);
+ $this->assertDoesNotMatchRegularExpression('/php echo/', $result);
$filename = CACHE . 'views' . DS . 'cachetest_cache_parsing.php';
$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->assertNotRegExp('/cake:nocache/', $contents);
+ $this->assertMatchesRegularExpression('/if \(is_writable\(TMP\)\)\:/', $contents);
+ $this->assertMatchesRegularExpression('/php echo \$variable/', $contents);
+ $this->assertMatchesRegularExpression('/php echo microtime()/', $contents);
+ $this->assertDoesNotMatchRegularExpression('/cake:nocache/', $contents);
unlink($filename);
}
@@ -212,14 +212,14 @@ public function testMultipleNoCacheTagsInViewfile() {
$View = new View($this->Controller);
$result = $View->render('multiple_nocache');
- $this->assertNotRegExp('/cake:nocache/', $result);
- $this->assertNotRegExp('/php echo/', $result);
+ $this->assertDoesNotMatchRegularExpression('/cake:nocache/', $result);
+ $this->assertDoesNotMatchRegularExpression('/php echo/', $result);
$filename = CACHE . 'views' . DS . 'cachetest_cache_parsing.php';
$this->assertTrue(file_exists($filename));
$contents = file_get_contents($filename);
- $this->assertNotRegExp('/cake:nocache/', $contents);
+ $this->assertDoesNotMatchRegularExpression('/cake:nocache/', $contents);
unlink($filename);
}
@@ -245,42 +245,42 @@ public function testComplexNoCache() {
$View = new View($this->Controller);
$result = $View->render('sequencial_nocache');
- $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->assertNotRegExp('/1\. layout before content/', $result);
- $this->assertNotRegExp('/2\. in plain element/', $result);
- $this->assertNotRegExp('/3\. layout after test element/', $result);
- $this->assertNotRegExp('/4\. in view file/', $result);
- $this->assertNotRegExp('/5\. layout after content/', $result);
- $this->assertNotRegExp('/6\. in element with no cache tags/', $result);
- $this->assertNotRegExp('/7\. layout after content and after element with no cache tags/', $result);
+ $this->assertDoesNotMatchRegularExpression('/cake:nocache/', $result);
+ $this->assertDoesNotMatchRegularExpression('/php echo/', $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->assertDoesNotMatchRegularExpression('/1\. layout before content/', $result);
+ $this->assertDoesNotMatchRegularExpression('/2\. in plain element/', $result);
+ $this->assertDoesNotMatchRegularExpression('/3\. layout after test element/', $result);
+ $this->assertDoesNotMatchRegularExpression('/4\. in view file/', $result);
+ $this->assertDoesNotMatchRegularExpression('/5\. layout after content/', $result);
+ $this->assertDoesNotMatchRegularExpression('/6\. in element with no cache tags/', $result);
+ $this->assertDoesNotMatchRegularExpression('/7\. layout after content and after element with no cache tags/', $result);
$filename = CACHE . 'views' . DS . 'cachetest_cache_complex.php';
$this->assertTrue(file_exists($filename));
$contents = file_get_contents($filename);
unlink($filename);
- $this->assertRegExp('/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->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('/A\. Layout Before Content/', $contents);
+ $this->assertDoesNotMatchRegularExpression('/B\. In Plain Element/', $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->assertDoesNotMatchRegularExpression('/2\. in plain element/', $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);
}
/**
@@ -301,16 +301,16 @@ public function testCacheViewVars() {
$View = new View($this->Controller);
$result = $View->render('index');
- $this->assertNotRegExp('/cake:nocache/', $result);
- $this->assertNotRegExp('/php echo/', $result);
+ $this->assertDoesNotMatchRegularExpression('/cake:nocache/', $result);
+ $this->assertDoesNotMatchRegularExpression('/php echo/', $result);
$filename = CACHE . 'views' . DS . 'cachetest_cache_parsing.php';
$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 @@ public function testCacheCallbacks() {
$contents = file_get_contents($filename);
- $this->assertRegExp('/\$controller->startupProcess\(\);/', $contents);
+ $this->assertMatchesRegularExpression('/\$controller->startupProcess\(\);/', $contents);
unlink($filename);
}
@@ -371,8 +371,8 @@ public function testCacheActionArray() {
$View = new View($this->Controller);
$result = $View->render('index');
- $this->assertNotRegExp('/cake:nocache/', $result);
- $this->assertNotRegExp('/php echo/', $result);
+ $this->assertDoesNotMatchRegularExpression('/cake:nocache/', $result);
+ $this->assertDoesNotMatchRegularExpression('/php echo/', $result);
$filename = CACHE . 'views' . DS . 'cache_test_cache_parsing.php';
$this->assertTrue(file_exists($filename));
@@ -400,8 +400,8 @@ public function testCacheActionArrayCamelCase() {
$View = new View($this->Controller);
$result = $View->render('index');
- $this->assertNotRegExp('/cake:nocache/', $result);
- $this->assertNotRegExp('/php echo/', $result);
+ $this->assertDoesNotMatchRegularExpression('/cake:nocache/', $result);
+ $this->assertDoesNotMatchRegularExpression('/php echo/', $result);
$filename = CACHE . 'views' . DS . 'cachetest_cache_parsing.php';
$this->assertTrue(file_exists($filename));
@@ -434,8 +434,8 @@ public function testCacheWithNamedAndPassedArgs() {
$View = new View($this->Controller);
$result = $View->render('index');
- $this->assertNotRegExp('/cake:nocache/', $result);
- $this->assertNotRegExp('/php echo/', $result);
+ $this->assertDoesNotMatchRegularExpression('/cake:nocache/', $result);
+ $this->assertDoesNotMatchRegularExpression('/php echo/', $result);
$filename = CACHE . 'views' . DS . 'cache_test_cache_parsing_1_2_name_mark_ice_cream.php';
$this->assertTrue(file_exists($filename));
@@ -466,8 +466,8 @@ public function testCacheWithQueryStringParams() {
$View = new View($this->Controller);
$result = $View->render('index');
- $this->assertNotRegExp('/cake:nocache/', $result);
- $this->assertNotRegExp('/php echo/', $result);
+ $this->assertDoesNotMatchRegularExpression('/cake:nocache/', $result);
+ $this->assertDoesNotMatchRegularExpression('/php echo/', $result);
$filename = CACHE . 'views' . DS . 'cache_test_cache_parsing_q_cakephp.php';
$this->assertTrue(file_exists($filename), 'Missing cache file ' . $filename);
@@ -500,8 +500,8 @@ public function testCacheWithCustomRoutes() {
$View = new View($this->Controller);
$result = $View->render('index');
- $this->assertNotRegExp('/cake:nocache/', $result);
- $this->assertNotRegExp('/php echo/', $result);
+ $this->assertDoesNotMatchRegularExpression('/cake:nocache/', $result);
+ $this->assertDoesNotMatchRegularExpression('/php echo/', $result);
$filename = CACHE . 'views' . DS . 'en_cache_test_cache_parsing.php';
$this->assertTrue(file_exists($filename));
@@ -535,8 +535,8 @@ public function testCacheBaseNameControllerName() {
$View = new View($this->Controller);
$result = $View->render('index');
- $this->assertNotRegExp('/cake:nocache/', $result);
- $this->assertNotRegExp('/php echo/', $result);
+ $this->assertDoesNotMatchRegularExpression('/cake:nocache/', $result);
+ $this->assertDoesNotMatchRegularExpression('/php echo/', $result);
$filename = CACHE . 'views' . DS . 'cache_cachetest_cache_name.php';
$this->assertTrue(file_exists($filename));
@@ -620,9 +620,9 @@ public function testCacheEmptySections() {
$View = new View($this->Controller);
$result = $View->render('cache_empty_sections');
- $this->assertNotRegExp('/nocache/', $result);
- $this->assertNotRegExp('/php echo/', $result);
- $this->assertRegExp(
+ $this->assertDoesNotMatchRegularExpression('/nocache/', $result);
+ $this->assertDoesNotMatchRegularExpression('/php echo/', $result);
+ $this->assertMatchesRegularExpression(
'@\s*\s*' .
'\s*' .
'View Content\s*' .
@@ -632,8 +632,8 @@ public function testCacheEmptySections() {
$filename = CACHE . 'views' . DS . 'cachetest_cache_empty_sections.php';
$this->assertTrue(file_exists($filename));
$contents = file_get_contents($filename);
- $this->assertNotRegExp('/nocache/', $contents);
- $this->assertRegExp(
+ $this->assertDoesNotMatchRegularExpression('/nocache/', $contents);
+ $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 2c8a8e0..3474e60 100644
--- a/lib/Cake/Test/Case/View/Helper/FormHelperTest.php
+++ b/lib/Cake/Test/Case/View/Helper/FormHelperTest.php
@@ -639,7 +639,7 @@ public function testCreateClearingFields() {
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 @@ public function testDuplicateFieldNameResolution() {
$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('/