mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
test: Replace deprecated assertRegExp() with assertMatchesRegularExpression().
Co-authored-by: Kenshin Okinaka <okinakak@yahoo.co.jp>
This commit is contained in:
parent
c194e9b63e
commit
883ce8041e
43 changed files with 663 additions and 663 deletions
|
@ -806,9 +806,9 @@ class BasicsTest extends CakeTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
$result = file_get_contents(LOGS . 'error.log');
|
$result = file_get_contents(LOGS . 'error.log');
|
||||||
$this->assertRegExp('/Error: Testing LogError\(\) basic function/', $result);
|
$this->assertMatchesRegularExpression('/Error: Testing LogError\(\) basic function/', $result);
|
||||||
$this->assertNotRegExp("/Error: Testing with\nmulti-line\nstring/", $result);
|
$this->assertNotRegExp("/Error: Testing with\nmulti-line\nstring/", $result);
|
||||||
$this->assertRegExp('/Error: Testing with multi-line string/', $result);
|
$this->assertMatchesRegularExpression('/Error: Testing with multi-line string/', $result);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -98,16 +98,16 @@ class CommandListShellTest extends CakeTestCase {
|
||||||
$output = $this->Shell->stdout->output;
|
$output = $this->Shell->stdout->output;
|
||||||
|
|
||||||
$expected = "/\[.*TestPlugin.*\] example/";
|
$expected = "/\[.*TestPlugin.*\] example/";
|
||||||
$this->assertRegExp($expected, $output);
|
$this->assertMatchesRegularExpression($expected, $output);
|
||||||
|
|
||||||
$expected = "/\[.*TestPluginTwo.*\] example, welcome/";
|
$expected = "/\[.*TestPluginTwo.*\] example, welcome/";
|
||||||
$this->assertRegExp($expected, $output);
|
$this->assertMatchesRegularExpression($expected, $output);
|
||||||
|
|
||||||
$expected = "/\[.*CORE.*\] acl, api, bake, command_list, completion, console, i18n, schema, server, test, testsuite, upgrade/";
|
$expected = "/\[.*CORE.*\] acl, api, bake, command_list, completion, console, i18n, schema, server, test, testsuite, upgrade/";
|
||||||
$this->assertRegExp($expected, $output);
|
$this->assertMatchesRegularExpression($expected, $output);
|
||||||
|
|
||||||
$expected = "/\[.*app.*\] sample/";
|
$expected = "/\[.*app.*\] sample/";
|
||||||
$this->assertRegExp($expected, $output);
|
$this->assertMatchesRegularExpression($expected, $output);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -113,7 +113,7 @@ class CompletionShellTest extends CakeTestCase {
|
||||||
$output = $this->Shell->stdout->output;
|
$output = $this->Shell->stdout->output;
|
||||||
|
|
||||||
$expected = "/This command is not intended to be called manually/";
|
$expected = "/This command is not intended to be called manually/";
|
||||||
$this->assertRegExp($expected, $output);
|
$this->assertMatchesRegularExpression($expected, $output);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -218,14 +218,14 @@ class SchemaShellTest extends CakeTestCase {
|
||||||
|
|
||||||
$this->file = new File(TMP . 'tests' . DS . 'i18n.sql');
|
$this->file = new File(TMP . 'tests' . DS . 'i18n.sql');
|
||||||
$contents = $this->file->read();
|
$contents = $this->file->read();
|
||||||
$this->assertRegExp('/DROP TABLE/', $contents);
|
$this->assertMatchesRegularExpression('/DROP TABLE/', $contents);
|
||||||
$this->assertRegExp('/CREATE TABLE.*?i18n/', $contents);
|
$this->assertMatchesRegularExpression('/CREATE TABLE.*?i18n/', $contents);
|
||||||
$this->assertRegExp('/id/', $contents);
|
$this->assertMatchesRegularExpression('/id/', $contents);
|
||||||
$this->assertRegExp('/model/', $contents);
|
$this->assertMatchesRegularExpression('/model/', $contents);
|
||||||
$this->assertRegExp('/field/', $contents);
|
$this->assertMatchesRegularExpression('/field/', $contents);
|
||||||
$this->assertRegExp('/locale/', $contents);
|
$this->assertMatchesRegularExpression('/locale/', $contents);
|
||||||
$this->assertRegExp('/foreign_key/', $contents);
|
$this->assertMatchesRegularExpression('/foreign_key/', $contents);
|
||||||
$this->assertRegExp('/content/', $contents);
|
$this->assertMatchesRegularExpression('/content/', $contents);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -250,9 +250,9 @@ class SchemaShellTest extends CakeTestCase {
|
||||||
$this->file = new File(TMP . 'tests' . DS . 'dump_test.sql');
|
$this->file = new File(TMP . 'tests' . DS . 'dump_test.sql');
|
||||||
$contents = $this->file->read();
|
$contents = $this->file->read();
|
||||||
|
|
||||||
$this->assertRegExp('/CREATE TABLE.*?test_plugin_acos/', $contents);
|
$this->assertMatchesRegularExpression('/CREATE TABLE.*?test_plugin_acos/', $contents);
|
||||||
$this->assertRegExp('/id/', $contents);
|
$this->assertMatchesRegularExpression('/id/', $contents);
|
||||||
$this->assertRegExp('/model/', $contents);
|
$this->assertMatchesRegularExpression('/model/', $contents);
|
||||||
|
|
||||||
$this->file->delete();
|
$this->file->delete();
|
||||||
App::build();
|
App::build();
|
||||||
|
@ -353,11 +353,11 @@ class SchemaShellTest extends CakeTestCase {
|
||||||
$this->file = new File(TMP . 'tests' . DS . 'schema.php');
|
$this->file = new File(TMP . 'tests' . DS . 'schema.php');
|
||||||
$contents = $this->file->read();
|
$contents = $this->file->read();
|
||||||
|
|
||||||
$this->assertRegExp('/class TestPluginSchema/', $contents);
|
$this->assertMatchesRegularExpression('/class TestPluginSchema/', $contents);
|
||||||
$this->assertRegExp('/public \$posts/', $contents);
|
$this->assertMatchesRegularExpression('/public \$posts/', $contents);
|
||||||
$this->assertRegExp('/public \$auth_users/', $contents);
|
$this->assertMatchesRegularExpression('/public \$auth_users/', $contents);
|
||||||
$this->assertRegExp('/public \$authors/', $contents);
|
$this->assertMatchesRegularExpression('/public \$authors/', $contents);
|
||||||
$this->assertRegExp('/public \$test_plugin_comments/', $contents);
|
$this->assertMatchesRegularExpression('/public \$test_plugin_comments/', $contents);
|
||||||
$this->assertNotRegExp('/public \$users/', $contents);
|
$this->assertNotRegExp('/public \$users/', $contents);
|
||||||
$this->assertNotRegExp('/public \$articles/', $contents);
|
$this->assertNotRegExp('/public \$articles/', $contents);
|
||||||
CakePlugin::unload();
|
CakePlugin::unload();
|
||||||
|
@ -389,8 +389,8 @@ class SchemaShellTest extends CakeTestCase {
|
||||||
$this->file = new File(TMP . 'tests' . DS . 'schema.php');
|
$this->file = new File(TMP . 'tests' . DS . 'schema.php');
|
||||||
$contents = $this->file->read();
|
$contents = $this->file->read();
|
||||||
|
|
||||||
$this->assertRegExp('/class TestPluginSchema/', $contents);
|
$this->assertMatchesRegularExpression('/class TestPluginSchema/', $contents);
|
||||||
$this->assertRegExp('/public \$test_plugin_comments/', $contents);
|
$this->assertMatchesRegularExpression('/public \$test_plugin_comments/', $contents);
|
||||||
$this->assertNotRegExp('/public \$authors/', $contents);
|
$this->assertNotRegExp('/public \$authors/', $contents);
|
||||||
$this->assertNotRegExp('/public \$auth_users/', $contents);
|
$this->assertNotRegExp('/public \$auth_users/', $contents);
|
||||||
$this->assertNotRegExp('/public \$posts/', $contents);
|
$this->assertNotRegExp('/public \$posts/', $contents);
|
||||||
|
@ -628,7 +628,7 @@ class SchemaShellTest extends CakeTestCase {
|
||||||
$this->Shell->generate();
|
$this->Shell->generate();
|
||||||
|
|
||||||
$contents = file_get_contents($this->Shell->Schema->path . DS . 'custom_names.php');
|
$contents = file_get_contents($this->Shell->Schema->path . DS . 'custom_names.php');
|
||||||
$this->assertRegExp('/class CustomNamesSchema/', $contents);
|
$this->assertMatchesRegularExpression('/class CustomNamesSchema/', $contents);
|
||||||
unlink($this->Shell->Schema->path . DS . 'custom_names.php');
|
unlink($this->Shell->Schema->path . DS . 'custom_names.php');
|
||||||
CakePlugin::unload();
|
CakePlugin::unload();
|
||||||
}
|
}
|
||||||
|
@ -661,7 +661,7 @@ class SchemaShellTest extends CakeTestCase {
|
||||||
|
|
||||||
$this->assertFileExists($file);
|
$this->assertFileExists($file);
|
||||||
$contents = file_get_contents($file);
|
$contents = file_get_contents($file);
|
||||||
$this->assertRegExp('/class CustomNameSchema/', $contents);
|
$this->assertMatchesRegularExpression('/class CustomNameSchema/', $contents);
|
||||||
|
|
||||||
if (file_exists($file)) {
|
if (file_exists($file)) {
|
||||||
unlink($file);
|
unlink($file);
|
||||||
|
|
|
@ -448,7 +448,7 @@ class ControllerTaskTest extends CakeTestCase {
|
||||||
)->will($this->returnValue(true));
|
)->will($this->returnValue(true));
|
||||||
|
|
||||||
$result = $this->Task->execute();
|
$result = $this->Task->execute();
|
||||||
$this->assertRegExp('/admin_index/', $result);
|
$this->assertMatchesRegularExpression('/admin_index/', $result);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -88,68 +88,68 @@ class ExtractTaskTest extends CakeTestCase {
|
||||||
$this->assertFalse(file_exists($this->path . DS . 'cake.pot'));
|
$this->assertFalse(file_exists($this->path . DS . 'cake.pot'));
|
||||||
|
|
||||||
$pattern = '/"Content-Type\: text\/plain; charset\=utf-8/';
|
$pattern = '/"Content-Type\: text\/plain; charset\=utf-8/';
|
||||||
$this->assertRegExp($pattern, $result);
|
$this->assertMatchesRegularExpression($pattern, $result);
|
||||||
$pattern = '/"Content-Transfer-Encoding\: 8bit/';
|
$pattern = '/"Content-Transfer-Encoding\: 8bit/';
|
||||||
$this->assertRegExp($pattern, $result);
|
$this->assertMatchesRegularExpression($pattern, $result);
|
||||||
$pattern = '/"Plural-Forms\: nplurals\=INTEGER; plural\=EXPRESSION;/';
|
$pattern = '/"Plural-Forms\: nplurals\=INTEGER; plural\=EXPRESSION;/';
|
||||||
$this->assertRegExp($pattern, $result);
|
$this->assertMatchesRegularExpression($pattern, $result);
|
||||||
|
|
||||||
// home.ctp
|
// home.ctp
|
||||||
$pattern = '/msgid "Your tmp directory is writable."\nmsgstr ""\n/';
|
$pattern = '/msgid "Your tmp directory is writable."\nmsgstr ""\n/';
|
||||||
$this->assertRegExp($pattern, $result);
|
$this->assertMatchesRegularExpression($pattern, $result);
|
||||||
|
|
||||||
$pattern = '/msgid "Your tmp directory is NOT writable."\nmsgstr ""\n/';
|
$pattern = '/msgid "Your tmp directory is NOT writable."\nmsgstr ""\n/';
|
||||||
$this->assertRegExp($pattern, $result);
|
$this->assertMatchesRegularExpression($pattern, $result);
|
||||||
|
|
||||||
$pattern = '/msgid "The %s is being used for caching. To change the config edit ';
|
$pattern = '/msgid "The %s is being used for caching. To change the config edit ';
|
||||||
$pattern .= '%s\/core.php "\nmsgstr ""\n/';
|
$pattern .= '%s\/core.php "\nmsgstr ""\n/';
|
||||||
$this->assertRegExp($pattern, $result);
|
$this->assertMatchesRegularExpression($pattern, $result);
|
||||||
|
|
||||||
$pattern = '/msgid "Your cache is NOT working. Please check ';
|
$pattern = '/msgid "Your cache is NOT working. Please check ';
|
||||||
$pattern .= 'the settings in %s\/core.php"\nmsgstr ""\n/';
|
$pattern .= 'the settings in %s\/core.php"\nmsgstr ""\n/';
|
||||||
$this->assertRegExp($pattern, $result);
|
$this->assertMatchesRegularExpression($pattern, $result);
|
||||||
|
|
||||||
$pattern = '/msgid "Your database configuration file is present."\nmsgstr ""\n/';
|
$pattern = '/msgid "Your database configuration file is present."\nmsgstr ""\n/';
|
||||||
$this->assertRegExp($pattern, $result);
|
$this->assertMatchesRegularExpression($pattern, $result);
|
||||||
|
|
||||||
$pattern = '/msgid "Your database configuration file is NOT present."\nmsgstr ""\n/';
|
$pattern = '/msgid "Your database configuration file is NOT present."\nmsgstr ""\n/';
|
||||||
$this->assertRegExp($pattern, $result);
|
$this->assertMatchesRegularExpression($pattern, $result);
|
||||||
|
|
||||||
$pattern = '/msgid "Rename config\/database.php.default to ';
|
$pattern = '/msgid "Rename config\/database.php.default to ';
|
||||||
$pattern .= 'config\/database.php"\nmsgstr ""\n/';
|
$pattern .= 'config\/database.php"\nmsgstr ""\n/';
|
||||||
$this->assertRegExp($pattern, $result);
|
$this->assertMatchesRegularExpression($pattern, $result);
|
||||||
|
|
||||||
$pattern = '/msgid "Cake is able to connect to the database."\nmsgstr ""\n/';
|
$pattern = '/msgid "Cake is able to connect to the database."\nmsgstr ""\n/';
|
||||||
$this->assertRegExp($pattern, $result);
|
$this->assertMatchesRegularExpression($pattern, $result);
|
||||||
|
|
||||||
$pattern = '/msgid "Cake is NOT able to connect to the database."\nmsgstr ""\n/';
|
$pattern = '/msgid "Cake is NOT able to connect to the database."\nmsgstr ""\n/';
|
||||||
$this->assertRegExp($pattern, $result);
|
$this->assertMatchesRegularExpression($pattern, $result);
|
||||||
|
|
||||||
$pattern = '/msgid "Editing this Page"\nmsgstr ""\n/';
|
$pattern = '/msgid "Editing this Page"\nmsgstr ""\n/';
|
||||||
$this->assertRegExp($pattern, $result);
|
$this->assertMatchesRegularExpression($pattern, $result);
|
||||||
|
|
||||||
$pattern = '/msgid "To change the content of this page, create: APP\/views\/pages\/home\.ctp/';
|
$pattern = '/msgid "To change the content of this page, create: APP\/views\/pages\/home\.ctp/';
|
||||||
$this->assertRegExp($pattern, $result);
|
$this->assertMatchesRegularExpression($pattern, $result);
|
||||||
|
|
||||||
$pattern = '/To change its layout, create: APP\/views\/layouts\/default\.ctp\./s';
|
$pattern = '/To change its layout, create: APP\/views\/layouts\/default\.ctp\./s';
|
||||||
$this->assertRegExp($pattern, $result);
|
$this->assertMatchesRegularExpression($pattern, $result);
|
||||||
|
|
||||||
// extract.ctp
|
// extract.ctp
|
||||||
$pattern = '/\#: extract\.ctp:15;6\n';
|
$pattern = '/\#: extract\.ctp:15;6\n';
|
||||||
$pattern .= 'msgid "You have %d new message."\nmsgid_plural "You have %d new messages."/';
|
$pattern .= 'msgid "You have %d new message."\nmsgid_plural "You have %d new messages."/';
|
||||||
$this->assertRegExp($pattern, $result);
|
$this->assertMatchesRegularExpression($pattern, $result);
|
||||||
|
|
||||||
$pattern = '/msgid "You have %d new message."\nmsgstr ""/';
|
$pattern = '/msgid "You have %d new message."\nmsgstr ""/';
|
||||||
$this->assertNotRegExp($pattern, $result, 'No duplicate msgid');
|
$this->assertNotRegExp($pattern, $result, 'No duplicate msgid');
|
||||||
|
|
||||||
$pattern = '/\#: extract\.ctp:7\n';
|
$pattern = '/\#: extract\.ctp:7\n';
|
||||||
$pattern .= 'msgid "You deleted %d message."\nmsgid_plural "You deleted %d messages."/';
|
$pattern .= 'msgid "You deleted %d message."\nmsgid_plural "You deleted %d messages."/';
|
||||||
$this->assertRegExp($pattern, $result);
|
$this->assertMatchesRegularExpression($pattern, $result);
|
||||||
|
|
||||||
$pattern = '/\#: extract\.ctp:14\n';
|
$pattern = '/\#: extract\.ctp:14\n';
|
||||||
$pattern .= '\#: home\.ctp:68\n';
|
$pattern .= '\#: home\.ctp:68\n';
|
||||||
$pattern .= 'msgid "Editing this Page"\nmsgstr ""/';
|
$pattern .= 'msgid "Editing this Page"\nmsgstr ""/';
|
||||||
$this->assertRegExp($pattern, $result);
|
$this->assertMatchesRegularExpression($pattern, $result);
|
||||||
|
|
||||||
$pattern = '/\#: extract\.ctp:22\nmsgid "';
|
$pattern = '/\#: extract\.ctp:22\nmsgid "';
|
||||||
$pattern .= 'Hot features!';
|
$pattern .= 'Hot features!';
|
||||||
|
@ -157,25 +157,25 @@ class ExtractTaskTest extends CakeTestCase {
|
||||||
$pattern .= '\\\n - Extremely Simple: Just look at the name...It\'s Cake';
|
$pattern .= '\\\n - Extremely Simple: Just look at the name...It\'s Cake';
|
||||||
$pattern .= '\\\n - Active, Friendly Community: Join us #cakephp on IRC. We\'d love to help you get started';
|
$pattern .= '\\\n - Active, Friendly Community: Join us #cakephp on IRC. We\'d love to help you get started';
|
||||||
$pattern .= '"\nmsgstr ""/';
|
$pattern .= '"\nmsgstr ""/';
|
||||||
$this->assertRegExp($pattern, $result);
|
$this->assertMatchesRegularExpression($pattern, $result);
|
||||||
|
|
||||||
$this->assertContains('msgid "double \\"quoted\\""', $result, 'Strings with quotes not handled correctly');
|
$this->assertContains('msgid "double \\"quoted\\""', $result, 'Strings with quotes not handled correctly');
|
||||||
$this->assertContains("msgid \"single 'quoted'\"", $result, 'Strings with quotes not handled correctly');
|
$this->assertContains("msgid \"single 'quoted'\"", $result, 'Strings with quotes not handled correctly');
|
||||||
|
|
||||||
$pattern = '/\#: extract\.ctp:36\nmsgid "letter"/';
|
$pattern = '/\#: extract\.ctp:36\nmsgid "letter"/';
|
||||||
$this->assertRegExp($pattern, $result, 'Strings with context should not overwrite strings without context');
|
$this->assertMatchesRegularExpression($pattern, $result, 'Strings with context should not overwrite strings without context');
|
||||||
|
|
||||||
$pattern = '/\#: extract\.ctp:37;39\nmsgctxt "A"\nmsgid "letter"/';
|
$pattern = '/\#: extract\.ctp:37;39\nmsgctxt "A"\nmsgid "letter"/';
|
||||||
$this->assertRegExp($pattern, $result, 'Should contain string with context "A"');
|
$this->assertMatchesRegularExpression($pattern, $result, 'Should contain string with context "A"');
|
||||||
|
|
||||||
$pattern = '/\#: extract\.ctp:38\nmsgctxt "B"\nmsgid "letter"/';
|
$pattern = '/\#: extract\.ctp:38\nmsgctxt "B"\nmsgid "letter"/';
|
||||||
$this->assertRegExp($pattern, $result, 'Should contain string with context "B"');
|
$this->assertMatchesRegularExpression($pattern, $result, 'Should contain string with context "B"');
|
||||||
|
|
||||||
$pattern = '/\#: extract\.ctp:40\nmsgid "%d letter"\nmsgid_plural "%d letters"/';
|
$pattern = '/\#: extract\.ctp:40\nmsgid "%d letter"\nmsgid_plural "%d letters"/';
|
||||||
$this->assertRegExp($pattern, $result, 'Plural strings with context should not overwrite strings without context');
|
$this->assertMatchesRegularExpression($pattern, $result, 'Plural strings with context should not overwrite strings without context');
|
||||||
|
|
||||||
$pattern = '/\#: extract\.ctp:41\nmsgctxt "A"\nmsgid "%d letter"\nmsgid_plural "%d letters"/';
|
$pattern = '/\#: extract\.ctp:41\nmsgctxt "A"\nmsgid "%d letter"\nmsgid_plural "%d letters"/';
|
||||||
$this->assertRegExp($pattern, $result, 'Should contain plural string with context "A"');
|
$this->assertMatchesRegularExpression($pattern, $result, 'Should contain plural string with context "A"');
|
||||||
|
|
||||||
// extract.ctp - reading the domain.pot
|
// extract.ctp - reading the domain.pot
|
||||||
$result = file_get_contents($this->path . DS . 'domain.pot');
|
$result = file_get_contents($this->path . DS . 'domain.pot');
|
||||||
|
@ -186,9 +186,9 @@ class ExtractTaskTest extends CakeTestCase {
|
||||||
$this->assertNotRegExp($pattern, $result);
|
$this->assertNotRegExp($pattern, $result);
|
||||||
|
|
||||||
$pattern = '/msgid "You have %d new message \(domain\)."\nmsgid_plural "You have %d new messages \(domain\)."/';
|
$pattern = '/msgid "You have %d new message \(domain\)."\nmsgid_plural "You have %d new messages \(domain\)."/';
|
||||||
$this->assertRegExp($pattern, $result);
|
$this->assertMatchesRegularExpression($pattern, $result);
|
||||||
$pattern = '/msgid "You deleted %d message \(domain\)."\nmsgid_plural "You deleted %d messages \(domain\)."/';
|
$pattern = '/msgid "You deleted %d message \(domain\)."\nmsgid_plural "You deleted %d messages \(domain\)."/';
|
||||||
$this->assertRegExp($pattern, $result);
|
$this->assertMatchesRegularExpression($pattern, $result);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -297,7 +297,7 @@ class ExtractTaskTest extends CakeTestCase {
|
||||||
$result = file_get_contents($this->path . DS . 'default.pot');
|
$result = file_get_contents($this->path . DS . 'default.pot');
|
||||||
|
|
||||||
$pattern = '/msgid "Add User"/';
|
$pattern = '/msgid "Add User"/';
|
||||||
$this->assertRegExp($pattern, $result);
|
$this->assertMatchesRegularExpression($pattern, $result);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -492,7 +492,7 @@ class ExtractTaskTest extends CakeTestCase {
|
||||||
$result = file_get_contents($this->path . DS . 'cake.pot');
|
$result = file_get_contents($this->path . DS . 'cake.pot');
|
||||||
|
|
||||||
$pattern = '/msgid "Yesterday, %s"\nmsgstr ""\n/';
|
$pattern = '/msgid "Yesterday, %s"\nmsgstr ""\n/';
|
||||||
$this->assertRegExp($pattern, $result);
|
$this->assertMatchesRegularExpression($pattern, $result);
|
||||||
|
|
||||||
$this->assertTrue(file_exists($this->path . DS . 'cake_dev.pot'));
|
$this->assertTrue(file_exists($this->path . DS . 'cake_dev.pot'));
|
||||||
$result = file_get_contents($this->path . DS . 'cake_dev.pot');
|
$result = file_get_contents($this->path . DS . 'cake_dev.pot');
|
||||||
|
|
|
@ -851,8 +851,8 @@ class ModelTaskTest extends CakeTestCase {
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
$result = $this->Task->bake('BakeArticle', compact('validate'));
|
$result = $this->Task->bake('BakeArticle', compact('validate'));
|
||||||
$this->assertRegExp('/class BakeArticle extends AppModel \{/', $result);
|
$this->assertMatchesRegularExpression('/class BakeArticle extends AppModel \{/', $result);
|
||||||
$this->assertRegExp('/\$validate \= array\(/', $result);
|
$this->assertMatchesRegularExpression('/\$validate \= array\(/', $result);
|
||||||
$expected = <<< STRINGEND
|
$expected = <<< STRINGEND
|
||||||
array(
|
array(
|
||||||
'notBlank' => array(
|
'notBlank' => array(
|
||||||
|
@ -864,7 +864,7 @@ array(
|
||||||
//'on' => 'create', // Limit validation to 'create' or 'update' operations
|
//'on' => 'create', // Limit validation to 'create' or 'update' operations
|
||||||
),
|
),
|
||||||
STRINGEND;
|
STRINGEND;
|
||||||
$this->assertRegExp('/' . preg_quote(str_replace("\r\n", "\n", $expected), '/') . '/', $result);
|
$this->assertMatchesRegularExpression('/' . preg_quote(str_replace("\r\n", "\n", $expected), '/') . '/', $result);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -915,14 +915,14 @@ STRINGEND;
|
||||||
$this->assertContains(' * @property OtherModel $OtherModel', $result);
|
$this->assertContains(' * @property OtherModel $OtherModel', $result);
|
||||||
$this->assertContains(' * @property BakeComment $BakeComment', $result);
|
$this->assertContains(' * @property BakeComment $BakeComment', $result);
|
||||||
$this->assertContains(' * @property BakeTag $BakeTag', $result);
|
$this->assertContains(' * @property BakeTag $BakeTag', $result);
|
||||||
$this->assertRegExp('/\$hasAndBelongsToMany \= array\(/', $result);
|
$this->assertMatchesRegularExpression('/\$hasAndBelongsToMany \= array\(/', $result);
|
||||||
$this->assertRegExp('/\$hasMany \= array\(/', $result);
|
$this->assertMatchesRegularExpression('/\$hasMany \= array\(/', $result);
|
||||||
$this->assertRegExp('/\$belongsTo \= array\(/', $result);
|
$this->assertMatchesRegularExpression('/\$belongsTo \= array\(/', $result);
|
||||||
$this->assertRegExp('/\$hasOne \= array\(/', $result);
|
$this->assertMatchesRegularExpression('/\$hasOne \= array\(/', $result);
|
||||||
$this->assertRegExp('/BakeTag/', $result);
|
$this->assertMatchesRegularExpression('/BakeTag/', $result);
|
||||||
$this->assertRegExp('/OtherModel/', $result);
|
$this->assertMatchesRegularExpression('/OtherModel/', $result);
|
||||||
$this->assertRegExp('/SomethingElse/', $result);
|
$this->assertMatchesRegularExpression('/SomethingElse/', $result);
|
||||||
$this->assertRegExp('/BakeComment/', $result);
|
$this->assertMatchesRegularExpression('/BakeComment/', $result);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -142,10 +142,10 @@ class ProjectTaskTest extends CakeTestCase {
|
||||||
$this->assertTrue(is_dir($this->Task->args[0]), 'No project dir');
|
$this->assertTrue(is_dir($this->Task->args[0]), 'No project dir');
|
||||||
$File = new File($path . DS . 'webroot' . DS . 'index.php');
|
$File = new File($path . DS . 'webroot' . DS . 'index.php');
|
||||||
$contents = $File->read();
|
$contents = $File->read();
|
||||||
$this->assertRegExp('/define\(\'CAKE_CORE_INCLUDE_PATH\', .*?DS/', $contents);
|
$this->assertMatchesRegularExpression('/define\(\'CAKE_CORE_INCLUDE_PATH\', .*?DS/', $contents);
|
||||||
$File = new File($path . DS . 'webroot' . DS . 'test.php');
|
$File = new File($path . DS . 'webroot' . DS . 'test.php');
|
||||||
$contents = $File->read();
|
$contents = $File->read();
|
||||||
$this->assertRegExp('/define\(\'CAKE_CORE_INCLUDE_PATH\', .*?DS/', $contents);
|
$this->assertMatchesRegularExpression('/define\(\'CAKE_CORE_INCLUDE_PATH\', .*?DS/', $contents);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -167,10 +167,10 @@ class ProjectTaskTest extends CakeTestCase {
|
||||||
|
|
||||||
$this->assertTrue(is_dir($this->Task->args[0]), 'No project dir');
|
$this->assertTrue(is_dir($this->Task->args[0]), 'No project dir');
|
||||||
$contents = file_get_contents($path . DS . 'webroot' . DS . 'index.php');
|
$contents = file_get_contents($path . DS . 'webroot' . DS . 'index.php');
|
||||||
$this->assertRegExp('#//define\(\'CAKE_CORE_INCLUDE_PATH#', $contents);
|
$this->assertMatchesRegularExpression('#//define\(\'CAKE_CORE_INCLUDE_PATH#', $contents);
|
||||||
|
|
||||||
$contents = file_get_contents($path . DS . 'webroot' . DS . 'test.php');
|
$contents = file_get_contents($path . DS . 'webroot' . DS . 'test.php');
|
||||||
$this->assertRegExp('#//define\(\'CAKE_CORE_INCLUDE_PATH#', $contents);
|
$this->assertMatchesRegularExpression('#//define\(\'CAKE_CORE_INCLUDE_PATH#', $contents);
|
||||||
|
|
||||||
ini_set('include_path', $restore);
|
ini_set('include_path', $restore);
|
||||||
}
|
}
|
||||||
|
@ -261,7 +261,7 @@ class ProjectTaskTest extends CakeTestCase {
|
||||||
|
|
||||||
$File = new File($path . 'Config' . DS . 'core.php');
|
$File = new File($path . 'Config' . DS . 'core.php');
|
||||||
$contents = $File->read();
|
$contents = $File->read();
|
||||||
$this->assertRegExp('/\$prefix = \'.+\';/', $contents, '$prefix is not defined');
|
$this->assertMatchesRegularExpression('/\$prefix = \'.+\';/', $contents, '$prefix is not defined');
|
||||||
$this->assertNotRegExp('/\$prefix = \'myapp_\';/', $contents, 'Default cache prefix left behind. %s');
|
$this->assertNotRegExp('/\$prefix = \'myapp_\';/', $contents, 'Default cache prefix left behind. %s');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -159,6 +159,6 @@ class TemplateTaskTest extends CakeTestCase {
|
||||||
'schema' => ''
|
'schema' => ''
|
||||||
));
|
));
|
||||||
$result = $this->Task->generate('classes', 'fixture');
|
$result = $this->Task->generate('classes', 'fixture');
|
||||||
$this->assertRegExp('/ArticleFixture extends CakeTestFixture/', $result);
|
$this->assertMatchesRegularExpression('/ArticleFixture extends CakeTestFixture/', $result);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -233,14 +233,14 @@ class ViewTaskTest extends CakeTestCase {
|
||||||
);
|
);
|
||||||
$result = $this->Task->getContent('view', $vars);
|
$result = $this->Task->getContent('view', $vars);
|
||||||
|
|
||||||
$this->assertRegExp('/Delete Test View Model/', $result);
|
$this->assertMatchesRegularExpression('/Delete Test View Model/', $result);
|
||||||
$this->assertRegExp('/Edit Test View Model/', $result);
|
$this->assertMatchesRegularExpression('/Edit Test View Model/', $result);
|
||||||
$this->assertRegExp('/List Test View Models/', $result);
|
$this->assertMatchesRegularExpression('/List Test View Models/', $result);
|
||||||
$this->assertRegExp('/New Test View Model/', $result);
|
$this->assertMatchesRegularExpression('/New Test View Model/', $result);
|
||||||
|
|
||||||
$this->assertRegExp('/testViewModel\[\'TestViewModel\'\]\[\'id\'\]/', $result);
|
$this->assertMatchesRegularExpression('/testViewModel\[\'TestViewModel\'\]\[\'id\'\]/', $result);
|
||||||
$this->assertRegExp('/testViewModel\[\'TestViewModel\'\]\[\'name\'\]/', $result);
|
$this->assertMatchesRegularExpression('/testViewModel\[\'TestViewModel\'\]\[\'name\'\]/', $result);
|
||||||
$this->assertRegExp('/testViewModel\[\'TestViewModel\'\]\[\'body\'\]/', $result);
|
$this->assertMatchesRegularExpression('/testViewModel\[\'TestViewModel\'\]\[\'body\'\]/', $result);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -265,19 +265,19 @@ class ViewTaskTest extends CakeTestCase {
|
||||||
);
|
);
|
||||||
$result = $this->Task->getContent('admin_view', $vars);
|
$result = $this->Task->getContent('admin_view', $vars);
|
||||||
|
|
||||||
$this->assertRegExp('/Delete Test View Model/', $result);
|
$this->assertMatchesRegularExpression('/Delete Test View Model/', $result);
|
||||||
$this->assertRegExp('/Edit Test View Model/', $result);
|
$this->assertMatchesRegularExpression('/Edit Test View Model/', $result);
|
||||||
$this->assertRegExp('/List Test View Models/', $result);
|
$this->assertMatchesRegularExpression('/List Test View Models/', $result);
|
||||||
$this->assertRegExp('/New Test View Model/', $result);
|
$this->assertMatchesRegularExpression('/New Test View Model/', $result);
|
||||||
|
|
||||||
$this->assertRegExp('/testViewModel\[\'TestViewModel\'\]\[\'id\'\]/', $result);
|
$this->assertMatchesRegularExpression('/testViewModel\[\'TestViewModel\'\]\[\'id\'\]/', $result);
|
||||||
$this->assertRegExp('/testViewModel\[\'TestViewModel\'\]\[\'name\'\]/', $result);
|
$this->assertMatchesRegularExpression('/testViewModel\[\'TestViewModel\'\]\[\'name\'\]/', $result);
|
||||||
$this->assertRegExp('/testViewModel\[\'TestViewModel\'\]\[\'body\'\]/', $result);
|
$this->assertMatchesRegularExpression('/testViewModel\[\'TestViewModel\'\]\[\'body\'\]/', $result);
|
||||||
|
|
||||||
$result = $this->Task->getContent('admin_add', $vars);
|
$result = $this->Task->getContent('admin_add', $vars);
|
||||||
$this->assertRegExp("/input\('name'\)/", $result);
|
$this->assertMatchesRegularExpression("/input\('name'\)/", $result);
|
||||||
$this->assertRegExp("/input\('body'\)/", $result);
|
$this->assertMatchesRegularExpression("/input\('body'\)/", $result);
|
||||||
$this->assertRegExp('/List Test View Models/', $result);
|
$this->assertMatchesRegularExpression('/List Test View Models/', $result);
|
||||||
|
|
||||||
Configure::write('Routing', $_back);
|
Configure::write('Routing', $_back);
|
||||||
}
|
}
|
||||||
|
|
|
@ -335,8 +335,8 @@ HTMLBLOC;
|
||||||
|
|
||||||
$this->Controller->EmailTest->send();
|
$this->Controller->EmailTest->send();
|
||||||
$result = DebugCompTransport::$lastEmail;
|
$result = DebugCompTransport::$lastEmail;
|
||||||
$this->assertRegExp('/Test/', $result);
|
$this->assertMatchesRegularExpression('/Test/', $result);
|
||||||
$this->assertRegExp('/http\:\/\/example\.com/', $result);
|
$this->assertMatchesRegularExpression('/http\:\/\/example\.com/', $result);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -356,13 +356,13 @@ HTMLBLOC;
|
||||||
$this->assertTrue($this->Controller->EmailTest->send(null));
|
$this->assertTrue($this->Controller->EmailTest->send(null));
|
||||||
$result = DebugCompTransport::$lastEmail;
|
$result = DebugCompTransport::$lastEmail;
|
||||||
|
|
||||||
$this->assertRegExp('/To: test@example.com\n/', $result);
|
$this->assertMatchesRegularExpression('/To: test@example.com\n/', $result);
|
||||||
$this->assertRegExp('/Subject: \n/', $result);
|
$this->assertMatchesRegularExpression('/Subject: \n/', $result);
|
||||||
$this->assertRegExp('/From: test@example.com\n/', $result);
|
$this->assertMatchesRegularExpression('/From: test@example.com\n/', $result);
|
||||||
$this->assertRegExp('/Date: ' . preg_quote(static::$sentDate) . '\n/', $result);
|
$this->assertMatchesRegularExpression('/Date: ' . preg_quote(static::$sentDate) . '\n/', $result);
|
||||||
$this->assertRegExp('/X-Mailer: CakePHP Email Component\n/', $result);
|
$this->assertMatchesRegularExpression('/X-Mailer: CakePHP Email Component\n/', $result);
|
||||||
$this->assertRegExp('/Content-Type: text\/plain; charset=UTF-8\n/', $result);
|
$this->assertMatchesRegularExpression('/Content-Type: text\/plain; charset=UTF-8\n/', $result);
|
||||||
$this->assertRegExp('/Content-Transfer-Encoding: 8bitMessage:\n/', $result);
|
$this->assertMatchesRegularExpression('/Content-Transfer-Encoding: 8bitMessage:\n/', $result);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -383,17 +383,17 @@ HTMLBLOC;
|
||||||
$this->assertTrue($this->Controller->EmailTest->send('This is the body of the message'));
|
$this->assertTrue($this->Controller->EmailTest->send('This is the body of the message'));
|
||||||
$result = DebugCompTransport::$lastEmail;
|
$result = DebugCompTransport::$lastEmail;
|
||||||
|
|
||||||
$this->assertRegExp('/To: postmaster@example.com\n/', $result);
|
$this->assertMatchesRegularExpression('/To: postmaster@example.com\n/', $result);
|
||||||
$this->assertRegExp('/Subject: Cake Debug Test\n/', $result);
|
$this->assertMatchesRegularExpression('/Subject: Cake Debug Test\n/', $result);
|
||||||
$this->assertRegExp('/Reply-To: noreply@example.com\n/', $result);
|
$this->assertMatchesRegularExpression('/Reply-To: noreply@example.com\n/', $result);
|
||||||
$this->assertRegExp('/From: noreply@example.com\n/', $result);
|
$this->assertMatchesRegularExpression('/From: noreply@example.com\n/', $result);
|
||||||
$this->assertRegExp('/Cc: cc@example.com\n/', $result);
|
$this->assertMatchesRegularExpression('/Cc: cc@example.com\n/', $result);
|
||||||
$this->assertRegExp('/Bcc: bcc@example.com\n/', $result);
|
$this->assertMatchesRegularExpression('/Bcc: bcc@example.com\n/', $result);
|
||||||
$this->assertRegExp('/Date: ' . preg_quote(static::$sentDate) . '\n/', $result);
|
$this->assertMatchesRegularExpression('/Date: ' . preg_quote(static::$sentDate) . '\n/', $result);
|
||||||
$this->assertRegExp('/X-Mailer: CakePHP Email Component\n/', $result);
|
$this->assertMatchesRegularExpression('/X-Mailer: CakePHP Email Component\n/', $result);
|
||||||
$this->assertRegExp('/Content-Type: text\/plain; charset=UTF-8\n/', $result);
|
$this->assertMatchesRegularExpression('/Content-Type: text\/plain; charset=UTF-8\n/', $result);
|
||||||
$this->assertRegExp('/Content-Transfer-Encoding: 8bitMessage:\n/', $result);
|
$this->assertMatchesRegularExpression('/Content-Transfer-Encoding: 8bitMessage:\n/', $result);
|
||||||
$this->assertRegExp('/This is the body of the message/', $result);
|
$this->assertMatchesRegularExpression('/This is the body of the message/', $result);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -414,15 +414,15 @@ HTMLBLOC;
|
||||||
$this->Controller->EmailTest->send('This is the body of the message');
|
$this->Controller->EmailTest->send('This is the body of the message');
|
||||||
$result = DebugCompTransport::$lastEmail;
|
$result = DebugCompTransport::$lastEmail;
|
||||||
|
|
||||||
$this->assertRegExp('/To: postmaster@example.com\n/', $result);
|
$this->assertMatchesRegularExpression('/To: postmaster@example.com\n/', $result);
|
||||||
$this->assertRegExp('/Subject: Cake Debug Test\n/', $result);
|
$this->assertMatchesRegularExpression('/Subject: Cake Debug Test\n/', $result);
|
||||||
$this->assertRegExp('/Reply-To: noreply@example.com\n/', $result);
|
$this->assertMatchesRegularExpression('/Reply-To: noreply@example.com\n/', $result);
|
||||||
$this->assertRegExp('/From: noreply@example.com\n/', $result);
|
$this->assertMatchesRegularExpression('/From: noreply@example.com\n/', $result);
|
||||||
$this->assertRegExp('/Date: ' . preg_quote(static::$sentDate) . '\n/', $result);
|
$this->assertMatchesRegularExpression('/Date: ' . preg_quote(static::$sentDate) . '\n/', $result);
|
||||||
$this->assertRegExp('/X-Mailer: CakePHP Email Component\n/', $result);
|
$this->assertMatchesRegularExpression('/X-Mailer: CakePHP Email Component\n/', $result);
|
||||||
$this->assertRegExp('/Content-Type: text\/plain; charset=UTF-8\n/', $result);
|
$this->assertMatchesRegularExpression('/Content-Type: text\/plain; charset=UTF-8\n/', $result);
|
||||||
$this->assertRegExp('/Content-Transfer-Encoding: 8bitMessage:\n/', $result);
|
$this->assertMatchesRegularExpression('/Content-Transfer-Encoding: 8bitMessage:\n/', $result);
|
||||||
$this->assertRegExp('/This is the body of the message/', $result);
|
$this->assertMatchesRegularExpression('/This is the body of the message/', $result);
|
||||||
$this->Controller->Session = $session;
|
$this->Controller->Session = $session;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -568,16 +568,16 @@ HTMLBLOC;
|
||||||
$this->assertTrue($this->Controller->EmailTest->send($content));
|
$this->assertTrue($this->Controller->EmailTest->send($content));
|
||||||
$result = DebugCompTransport::$lastEmail;
|
$result = DebugCompTransport::$lastEmail;
|
||||||
|
|
||||||
$this->assertRegExp('/To: postmaster@example.com\n/', $result);
|
$this->assertMatchesRegularExpression('/To: postmaster@example.com\n/', $result);
|
||||||
$this->assertRegExp('/Subject: Cake Debug Test\n/', $result);
|
$this->assertMatchesRegularExpression('/Subject: Cake Debug Test\n/', $result);
|
||||||
$this->assertRegExp('/Reply-To: noreply@example.com\n/', $result);
|
$this->assertMatchesRegularExpression('/Reply-To: noreply@example.com\n/', $result);
|
||||||
$this->assertRegExp('/From: noreply@example.com\n/', $result);
|
$this->assertMatchesRegularExpression('/From: noreply@example.com\n/', $result);
|
||||||
$this->assertRegExp('/X-Mailer: CakePHP Email Component\n/', $result);
|
$this->assertMatchesRegularExpression('/X-Mailer: CakePHP Email Component\n/', $result);
|
||||||
$this->assertRegExp('/Content-Type: text\/plain; charset=UTF-8\n/', $result);
|
$this->assertMatchesRegularExpression('/Content-Type: text\/plain; charset=UTF-8\n/', $result);
|
||||||
$this->assertRegExp('/Content-Transfer-Encoding: 8bitMessage:\n/', $result);
|
$this->assertMatchesRegularExpression('/Content-Transfer-Encoding: 8bitMessage:\n/', $result);
|
||||||
$this->assertRegExp('/First line\n/', $result);
|
$this->assertMatchesRegularExpression('/First line\n/', $result);
|
||||||
$this->assertRegExp('/Second line\n/', $result);
|
$this->assertMatchesRegularExpression('/Second line\n/', $result);
|
||||||
$this->assertRegExp('/Third line\n/', $result);
|
$this->assertMatchesRegularExpression('/Third line\n/', $result);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -595,7 +595,7 @@ HTMLBLOC;
|
||||||
|
|
||||||
$this->assertTrue($this->Controller->EmailTest->send('test message'));
|
$this->assertTrue($this->Controller->EmailTest->send('test message'));
|
||||||
$result = DebugCompTransport::$lastEmail;
|
$result = DebugCompTransport::$lastEmail;
|
||||||
$this->assertRegExp('/Date: Today!\n/', $result);
|
$this->assertMatchesRegularExpression('/Date: Today!\n/', $result);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -709,8 +709,8 @@ HTMLBLOC;
|
||||||
$this->Controller->EmailTest->sendAs = 'text';
|
$this->Controller->EmailTest->sendAs = 'text';
|
||||||
$this->assertTrue($this->Controller->EmailTest->send($body));
|
$this->assertTrue($this->Controller->EmailTest->send($body));
|
||||||
$msg = DebugCompTransport::$lastEmail;
|
$msg = DebugCompTransport::$lastEmail;
|
||||||
$this->assertRegExp('/' . preg_quote('Content-Disposition: attachment; filename="EmailComponentTest.php"') . '/', $msg);
|
$this->assertMatchesRegularExpression('/' . preg_quote('Content-Disposition: attachment; filename="EmailComponentTest.php"') . '/', $msg);
|
||||||
$this->assertRegExp('/' . preg_quote('Content-Disposition: attachment; filename="some-name.php"') . '/', $msg);
|
$this->assertMatchesRegularExpression('/' . preg_quote('Content-Disposition: attachment; filename="some-name.php"') . '/', $msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -732,21 +732,21 @@ HTMLBLOC;
|
||||||
$this->assertTrue($this->Controller->EmailTest->send($body));
|
$this->assertTrue($this->Controller->EmailTest->send($body));
|
||||||
$msg = DebugCompTransport::$lastEmail;
|
$msg = DebugCompTransport::$lastEmail;
|
||||||
$this->assertNotRegExp('/text\/plain/', $msg);
|
$this->assertNotRegExp('/text\/plain/', $msg);
|
||||||
$this->assertRegExp('/text\/html/', $msg);
|
$this->assertMatchesRegularExpression('/text\/html/', $msg);
|
||||||
|
|
||||||
$this->Controller->EmailTest->sendAs = 'text';
|
$this->Controller->EmailTest->sendAs = 'text';
|
||||||
$this->assertTrue($this->Controller->EmailTest->send($body));
|
$this->assertTrue($this->Controller->EmailTest->send($body));
|
||||||
$msg = DebugCompTransport::$lastEmail;
|
$msg = DebugCompTransport::$lastEmail;
|
||||||
$this->assertRegExp('/text\/plain/', $msg);
|
$this->assertMatchesRegularExpression('/text\/plain/', $msg);
|
||||||
$this->assertNotRegExp('/text\/html/', $msg);
|
$this->assertNotRegExp('/text\/html/', $msg);
|
||||||
|
|
||||||
$this->Controller->EmailTest->sendAs = 'both';
|
$this->Controller->EmailTest->sendAs = 'both';
|
||||||
$this->assertTrue($this->Controller->EmailTest->send($body));
|
$this->assertTrue($this->Controller->EmailTest->send($body));
|
||||||
$msg = DebugCompTransport::$lastEmail;
|
$msg = DebugCompTransport::$lastEmail;
|
||||||
|
|
||||||
$this->assertRegExp('/text\/plain/', $msg);
|
$this->assertMatchesRegularExpression('/text\/plain/', $msg);
|
||||||
$this->assertRegExp('/text\/html/', $msg);
|
$this->assertMatchesRegularExpression('/text\/html/', $msg);
|
||||||
$this->assertRegExp('/multipart\/alternative/', $msg);
|
$this->assertMatchesRegularExpression('/multipart\/alternative/', $msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -768,7 +768,7 @@ HTMLBLOC;
|
||||||
$msg = DebugCompTransport::$lastEmail;
|
$msg = DebugCompTransport::$lastEmail;
|
||||||
|
|
||||||
$this->assertNotRegExp('/\n\nContent-Transfer-Encoding/', $msg);
|
$this->assertNotRegExp('/\n\nContent-Transfer-Encoding/', $msg);
|
||||||
$this->assertRegExp('/\nContent-Transfer-Encoding/', $msg);
|
$this->assertMatchesRegularExpression('/\nContent-Transfer-Encoding/', $msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -838,7 +838,7 @@ HTMLBLOC;
|
||||||
$this->assertTrue($this->Controller->EmailTest->send($body));
|
$this->assertTrue($this->Controller->EmailTest->send($body));
|
||||||
$result = DebugCompTransport::$lastEmail;
|
$result = DebugCompTransport::$lastEmail;
|
||||||
|
|
||||||
$this->assertRegExp('/Body of message/', $result);
|
$this->assertMatchesRegularExpression('/Body of message/', $result);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -867,14 +867,14 @@ HTMLBLOC;
|
||||||
$result = DebugCompTransport::$lastEmail;
|
$result = DebugCompTransport::$lastEmail;
|
||||||
|
|
||||||
$host = env('HTTP_HOST') ? env('HTTP_HOST') : php_uname('n');
|
$host = env('HTTP_HOST') ? env('HTTP_HOST') : php_uname('n');
|
||||||
$this->assertRegExp('/Message-ID: \<[a-f0-9]{8}[a-f0-9]{4}[a-f0-9]{4}[a-f0-9]{4}[a-f0-9]{12}@' . $host . '\>\n/', $result);
|
$this->assertMatchesRegularExpression('/Message-ID: \<[a-f0-9]{8}[a-f0-9]{4}[a-f0-9]{4}[a-f0-9]{4}[a-f0-9]{12}@' . $host . '\>\n/', $result);
|
||||||
|
|
||||||
$this->Controller->EmailTest->messageId = '<22091985.998877@example.com>';
|
$this->Controller->EmailTest->messageId = '<22091985.998877@example.com>';
|
||||||
|
|
||||||
$this->assertTrue($this->Controller->EmailTest->send('This is the body of the message'));
|
$this->assertTrue($this->Controller->EmailTest->send('This is the body of the message'));
|
||||||
$result = DebugCompTransport::$lastEmail;
|
$result = DebugCompTransport::$lastEmail;
|
||||||
|
|
||||||
$this->assertRegExp('/Message-ID: <22091985.998877@example.com>\n/', $result);
|
$this->assertMatchesRegularExpression('/Message-ID: <22091985.998877@example.com>\n/', $result);
|
||||||
|
|
||||||
$this->Controller->EmailTest->messageId = false;
|
$this->Controller->EmailTest->messageId = false;
|
||||||
|
|
||||||
|
|
|
@ -847,7 +847,7 @@ class RequestHandlerComponentTest extends CakeTestCase {
|
||||||
$this->Controller, array('controller' => 'request_handler_test', 'action' => 'destination')
|
$this->Controller, array('controller' => 'request_handler_test', 'action' => 'destination')
|
||||||
);
|
);
|
||||||
$result = ob_get_clean();
|
$result = ob_get_clean();
|
||||||
$this->assertRegExp('/posts index/', $result, 'RequestAction redirect failed.');
|
$this->assertMatchesRegularExpression('/posts index/', $result, 'RequestAction redirect failed.');
|
||||||
|
|
||||||
App::build();
|
App::build();
|
||||||
}
|
}
|
||||||
|
@ -876,8 +876,8 @@ class RequestHandlerComponentTest extends CakeTestCase {
|
||||||
$this->Controller, array('controller' => 'request_handler_test', 'action' => 'ajax2_layout')
|
$this->Controller, array('controller' => 'request_handler_test', 'action' => 'ajax2_layout')
|
||||||
);
|
);
|
||||||
$result = ob_get_clean();
|
$result = ob_get_clean();
|
||||||
$this->assertRegExp('/posts index/', $result, 'RequestAction redirect failed.');
|
$this->assertMatchesRegularExpression('/posts index/', $result, 'RequestAction redirect failed.');
|
||||||
$this->assertRegExp('/Ajax!/', $result, 'Layout was not rendered.');
|
$this->assertMatchesRegularExpression('/Ajax!/', $result, 'Layout was not rendered.');
|
||||||
|
|
||||||
App::build();
|
App::build();
|
||||||
}
|
}
|
||||||
|
|
|
@ -573,7 +573,7 @@ class ControllerTest extends CakeTestCase {
|
||||||
$Controller->response = $this->getMock('CakeResponse', array('_sendHeader'));
|
$Controller->response = $this->getMock('CakeResponse', array('_sendHeader'));
|
||||||
$Controller->flash('this should work', '/flash', 1, 'ajax2');
|
$Controller->flash('this should work', '/flash', 1, 'ajax2');
|
||||||
$result = $Controller->response->body();
|
$result = $Controller->response->body();
|
||||||
$this->assertRegExp('/Ajax!/', $result);
|
$this->assertMatchesRegularExpression('/Ajax!/', $result);
|
||||||
App::build();
|
App::build();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -635,14 +635,14 @@ class ControllerTest extends CakeTestCase {
|
||||||
$Controller->viewPath = 'Posts';
|
$Controller->viewPath = 'Posts';
|
||||||
|
|
||||||
$result = $Controller->render('index');
|
$result = $Controller->render('index');
|
||||||
$this->assertRegExp('/posts index/', (string)$result);
|
$this->assertMatchesRegularExpression('/posts index/', (string)$result);
|
||||||
|
|
||||||
$Controller->view = 'index';
|
$Controller->view = 'index';
|
||||||
$result = $Controller->render();
|
$result = $Controller->render();
|
||||||
$this->assertRegExp('/posts index/', (string)$result);
|
$this->assertMatchesRegularExpression('/posts index/', (string)$result);
|
||||||
|
|
||||||
$result = $Controller->render('/Elements/test_element');
|
$result = $Controller->render('/Elements/test_element');
|
||||||
$this->assertRegExp('/this is the test element/', (string)$result);
|
$this->assertMatchesRegularExpression('/this is the test element/', (string)$result);
|
||||||
$Controller->view = null;
|
$Controller->view = null;
|
||||||
|
|
||||||
$Controller = new TestController($request, new CakeResponse());
|
$Controller = new TestController($request, new CakeResponse());
|
||||||
|
@ -688,7 +688,7 @@ class ControllerTest extends CakeTestCase {
|
||||||
$Controller->viewPath = 'Posts';
|
$Controller->viewPath = 'Posts';
|
||||||
$Controller->theme = 'TestTheme';
|
$Controller->theme = 'TestTheme';
|
||||||
$result = $Controller->render('index');
|
$result = $Controller->render('index');
|
||||||
$this->assertRegExp('/default test_theme layout/', (string)$result);
|
$this->assertMatchesRegularExpression('/default test_theme layout/', (string)$result);
|
||||||
App::build();
|
App::build();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -41,12 +41,12 @@ class PagesControllerTest extends CakeTestCase {
|
||||||
|
|
||||||
$Pages->viewPath = 'Posts';
|
$Pages->viewPath = 'Posts';
|
||||||
$Pages->display('index');
|
$Pages->display('index');
|
||||||
$this->assertRegExp('/posts index/', $Pages->response->body());
|
$this->assertMatchesRegularExpression('/posts index/', $Pages->response->body());
|
||||||
$this->assertEquals('index', $Pages->viewVars['page']);
|
$this->assertEquals('index', $Pages->viewVars['page']);
|
||||||
|
|
||||||
$Pages->viewPath = 'Themed';
|
$Pages->viewPath = 'Themed';
|
||||||
$Pages->display('TestTheme', 'Posts', 'index');
|
$Pages->display('TestTheme', 'Posts', 'index');
|
||||||
$this->assertRegExp('/posts index themed view/', $Pages->response->body());
|
$this->assertMatchesRegularExpression('/posts index themed view/', $Pages->response->body());
|
||||||
$this->assertEquals('TestTheme', $Pages->viewVars['page']);
|
$this->assertEquals('TestTheme', $Pages->viewVars['page']);
|
||||||
$this->assertEquals('Posts', $Pages->viewVars['subpage']);
|
$this->assertEquals('Posts', $Pages->viewVars['subpage']);
|
||||||
}
|
}
|
||||||
|
|
|
@ -303,7 +303,7 @@ class ScaffoldTest extends CakeTestCase {
|
||||||
new Scaffold($this->Controller, $this->Controller->request);
|
new Scaffold($this->Controller, $this->Controller->request);
|
||||||
$this->Controller->response->send();
|
$this->Controller->response->send();
|
||||||
$result = ob_get_clean();
|
$result = ob_get_clean();
|
||||||
$this->assertRegExp('/Scaffold Mock has been updated/', $result);
|
$this->assertMatchesRegularExpression('/Scaffold Mock has been updated/', $result);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -336,7 +336,7 @@ class ScaffoldTest extends CakeTestCase {
|
||||||
$Scaffold = new Scaffold($this->Controller, $this->Controller->request);
|
$Scaffold = new Scaffold($this->Controller, $this->Controller->request);
|
||||||
$this->Controller->response->send();
|
$this->Controller->response->send();
|
||||||
$result = ob_get_clean();
|
$result = ob_get_clean();
|
||||||
$this->assertRegExp('/name="data\[ScaffoldTag\]\[ScaffoldTag\]"/', $result);
|
$this->assertMatchesRegularExpression('/name="data\[ScaffoldTag\]\[ScaffoldTag\]"/', $result);
|
||||||
|
|
||||||
$result = $Scaffold->controller->viewVars;
|
$result = $Scaffold->controller->viewVars;
|
||||||
$this->assertEquals(array('id', 'user_id', 'title', 'body', 'published', 'created', 'updated', 'ScaffoldTag'), $result['scaffoldFields']);
|
$this->assertEquals(array('id', 'user_id', 'title', 'body', 'published', 'created', 'updated', 'ScaffoldTag'), $result['scaffoldFields']);
|
||||||
|
@ -413,6 +413,6 @@ class ScaffoldTest extends CakeTestCase {
|
||||||
$this->Controller->response->send();
|
$this->Controller->response->send();
|
||||||
$result = ob_get_clean();
|
$result = ob_get_clean();
|
||||||
|
|
||||||
$this->assertRegExp('/Scaffold Error/', $result);
|
$this->assertMatchesRegularExpression('/Scaffold Error/', $result);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -321,21 +321,21 @@ class ObjectTest extends CakeTestCase {
|
||||||
$this->assertTrue($this->object->log('Test warning 1'));
|
$this->assertTrue($this->object->log('Test warning 1'));
|
||||||
$this->assertTrue($this->object->log(array('Test' => 'warning 2')));
|
$this->assertTrue($this->object->log(array('Test' => 'warning 2')));
|
||||||
$result = file(LOGS . 'error.log');
|
$result = file(LOGS . 'error.log');
|
||||||
$this->assertRegExp('/^2[0-9]{3}-[0-9]+-[0-9]+ [0-9]+:[0-9]+:[0-9]+ Error: Test warning 1$/', $result[0]);
|
$this->assertMatchesRegularExpression('/^2[0-9]{3}-[0-9]+-[0-9]+ [0-9]+:[0-9]+:[0-9]+ Error: Test warning 1$/', $result[0]);
|
||||||
$this->assertRegExp('/^2[0-9]{3}-[0-9]+-[0-9]+ [0-9]+:[0-9]+:[0-9]+ Error: Array$/', $result[1]);
|
$this->assertMatchesRegularExpression('/^2[0-9]{3}-[0-9]+-[0-9]+ [0-9]+:[0-9]+:[0-9]+ Error: Array$/', $result[1]);
|
||||||
$this->assertRegExp('/^\($/', $result[2]);
|
$this->assertMatchesRegularExpression('/^\($/', $result[2]);
|
||||||
$this->assertRegExp('/\[Test\] => warning 2$/', $result[3]);
|
$this->assertMatchesRegularExpression('/\[Test\] => warning 2$/', $result[3]);
|
||||||
$this->assertRegExp('/^\)$/', $result[4]);
|
$this->assertMatchesRegularExpression('/^\)$/', $result[4]);
|
||||||
unlink(LOGS . 'error.log');
|
unlink(LOGS . 'error.log');
|
||||||
|
|
||||||
$this->assertTrue($this->object->log('Test warning 1', LOG_WARNING));
|
$this->assertTrue($this->object->log('Test warning 1', LOG_WARNING));
|
||||||
$this->assertTrue($this->object->log(array('Test' => 'warning 2'), LOG_WARNING));
|
$this->assertTrue($this->object->log(array('Test' => 'warning 2'), LOG_WARNING));
|
||||||
$result = file(LOGS . 'error.log');
|
$result = file(LOGS . 'error.log');
|
||||||
$this->assertRegExp('/^2[0-9]{3}-[0-9]+-[0-9]+ [0-9]+:[0-9]+:[0-9]+ Warning: Test warning 1$/', $result[0]);
|
$this->assertMatchesRegularExpression('/^2[0-9]{3}-[0-9]+-[0-9]+ [0-9]+:[0-9]+:[0-9]+ Warning: Test warning 1$/', $result[0]);
|
||||||
$this->assertRegExp('/^2[0-9]{3}-[0-9]+-[0-9]+ [0-9]+:[0-9]+:[0-9]+ Warning: Array$/', $result[1]);
|
$this->assertMatchesRegularExpression('/^2[0-9]{3}-[0-9]+-[0-9]+ [0-9]+:[0-9]+:[0-9]+ Warning: Array$/', $result[1]);
|
||||||
$this->assertRegExp('/^\($/', $result[2]);
|
$this->assertMatchesRegularExpression('/^\($/', $result[2]);
|
||||||
$this->assertRegExp('/\[Test\] => warning 2$/', $result[3]);
|
$this->assertMatchesRegularExpression('/\[Test\] => warning 2$/', $result[3]);
|
||||||
$this->assertRegExp('/^\)$/', $result[4]);
|
$this->assertMatchesRegularExpression('/^\)$/', $result[4]);
|
||||||
unlink(LOGS . 'error.log');
|
unlink(LOGS . 'error.log');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -99,9 +99,9 @@ class ErrorHandlerTest extends CakeTestCase {
|
||||||
$wrong .= '';
|
$wrong .= '';
|
||||||
$result = ob_get_clean();
|
$result = ob_get_clean();
|
||||||
|
|
||||||
$this->assertRegExp('/<pre class="cake-error">/', $result);
|
$this->assertMatchesRegularExpression('/<pre class="cake-error">/', $result);
|
||||||
$this->assertRegExp('/<b>Notice<\/b>/', $result);
|
$this->assertMatchesRegularExpression('/<b>Notice<\/b>/', $result);
|
||||||
$this->assertRegExp('/variable:\s+wrong/', $result);
|
$this->assertMatchesRegularExpression('/variable:\s+wrong/', $result);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -132,7 +132,7 @@ class ErrorHandlerTest extends CakeTestCase {
|
||||||
trigger_error('Test error', $error);
|
trigger_error('Test error', $error);
|
||||||
|
|
||||||
$result = ob_get_clean();
|
$result = ob_get_clean();
|
||||||
$this->assertRegExp('/<b>' . $expected . '<\/b>/', $result);
|
$this->assertMatchesRegularExpression('/<b>' . $expected . '<\/b>/', $result);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -171,7 +171,7 @@ class ErrorHandlerTest extends CakeTestCase {
|
||||||
|
|
||||||
$result = file(LOGS . 'debug.log');
|
$result = file(LOGS . 'debug.log');
|
||||||
$this->assertEquals(1, count($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+\]$/',
|
'/^\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]
|
$result[0]
|
||||||
);
|
);
|
||||||
|
@ -198,12 +198,12 @@ class ErrorHandlerTest extends CakeTestCase {
|
||||||
$out .= '';
|
$out .= '';
|
||||||
|
|
||||||
$result = file(LOGS . 'debug.log');
|
$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+\]$/',
|
'/^\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]
|
$result[0]
|
||||||
);
|
);
|
||||||
$this->assertRegExp('/^Trace:/', $result[1]);
|
$this->assertMatchesRegularExpression('/^Trace:/', $result[1]);
|
||||||
$this->assertRegExp('/^ErrorHandlerTest\:\:testHandleErrorLoggingTrace\(\)/', $result[3]);
|
$this->assertMatchesRegularExpression('/^ErrorHandlerTest\:\:testHandleErrorLoggingTrace\(\)/', $result[3]);
|
||||||
if (file_exists(LOGS . 'debug.log')) {
|
if (file_exists(LOGS . 'debug.log')) {
|
||||||
unlink(LOGS . 'debug.log');
|
unlink(LOGS . 'debug.log');
|
||||||
}
|
}
|
||||||
|
@ -219,7 +219,7 @@ class ErrorHandlerTest extends CakeTestCase {
|
||||||
ob_start();
|
ob_start();
|
||||||
ErrorHandler::handleException($error);
|
ErrorHandler::handleException($error);
|
||||||
$result = ob_get_clean();
|
$result = ob_get_clean();
|
||||||
$this->assertRegExp('/Kaboom!/', $result, 'message missing.');
|
$this->assertMatchesRegularExpression('/Kaboom!/', $result, 'message missing.');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -237,7 +237,7 @@ class ErrorHandlerTest extends CakeTestCase {
|
||||||
ob_start();
|
ob_start();
|
||||||
ErrorHandler::handleException($error);
|
ErrorHandler::handleException($error);
|
||||||
$result = ob_get_clean();
|
$result = ob_get_clean();
|
||||||
$this->assertRegExp('/Kaboom!/', $result, 'message missing.');
|
$this->assertMatchesRegularExpression('/Kaboom!/', $result, 'message missing.');
|
||||||
|
|
||||||
$log = file(LOGS . 'error.log');
|
$log = file(LOGS . 'error.log');
|
||||||
$this->assertContains('[NotFoundException] Kaboom!', $log[0], 'message missing.');
|
$this->assertContains('[NotFoundException] Kaboom!', $log[0], 'message missing.');
|
||||||
|
@ -261,12 +261,12 @@ class ErrorHandlerTest extends CakeTestCase {
|
||||||
ob_start();
|
ob_start();
|
||||||
ErrorHandler::handleException($notFound);
|
ErrorHandler::handleException($notFound);
|
||||||
$result = ob_get_clean();
|
$result = ob_get_clean();
|
||||||
$this->assertRegExp('/Kaboom!/', $result, 'message missing.');
|
$this->assertMatchesRegularExpression('/Kaboom!/', $result, 'message missing.');
|
||||||
|
|
||||||
ob_start();
|
ob_start();
|
||||||
ErrorHandler::handleException($forbidden);
|
ErrorHandler::handleException($forbidden);
|
||||||
$result = ob_get_clean();
|
$result = ob_get_clean();
|
||||||
$this->assertRegExp('/Fooled you!/', $result, 'message missing.');
|
$this->assertMatchesRegularExpression('/Fooled you!/', $result, 'message missing.');
|
||||||
|
|
||||||
$log = file(LOGS . 'error.log');
|
$log = file(LOGS . 'error.log');
|
||||||
$this->assertNotContains('[NotFoundException] Kaboom!', $log[0], 'message should not be logged.');
|
$this->assertNotContains('[NotFoundException] Kaboom!', $log[0], 'message should not be logged.');
|
||||||
|
|
|
@ -237,7 +237,7 @@ class ExceptionRendererTest extends CakeTestCase {
|
||||||
$ExceptionRenderer->render();
|
$ExceptionRenderer->render();
|
||||||
$result = ob_get_clean();
|
$result = ob_get_clean();
|
||||||
|
|
||||||
$this->assertRegExp('/Not Found/', $result, 'Method declared in error handler not converted to error400. %s');
|
$this->assertMatchesRegularExpression('/Not Found/', $result, 'Method declared in error handler not converted to error400. %s');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -405,8 +405,8 @@ class ExceptionRendererTest extends CakeTestCase {
|
||||||
$ExceptionRenderer->render();
|
$ExceptionRenderer->render();
|
||||||
$result = ob_get_clean();
|
$result = ob_get_clean();
|
||||||
|
|
||||||
$this->assertRegExp('/<h2>Custom message<\/h2>/', $result);
|
$this->assertMatchesRegularExpression('/<h2>Custom message<\/h2>/', $result);
|
||||||
$this->assertRegExp("/<strong>'.*?\/posts\/view\/1000'<\/strong>/", $result);
|
$this->assertMatchesRegularExpression("/<strong>'.*?\/posts\/view\/1000'<\/strong>/", $result);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -471,7 +471,7 @@ class ExceptionRendererTest extends CakeTestCase {
|
||||||
$ExceptionRenderer->render();
|
$ExceptionRenderer->render();
|
||||||
$result = ob_get_clean();
|
$result = ob_get_clean();
|
||||||
|
|
||||||
$this->assertRegExp('/<h2>An Internal Error Has Occurred<\/h2>/', $result);
|
$this->assertMatchesRegularExpression('/<h2>An Internal Error Has Occurred<\/h2>/', $result);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -508,8 +508,8 @@ class ExceptionRendererTest extends CakeTestCase {
|
||||||
$ExceptionRenderer->render();
|
$ExceptionRenderer->render();
|
||||||
$result = ob_get_clean();
|
$result = ob_get_clean();
|
||||||
|
|
||||||
$this->assertRegExp('/<h2>Missing Controller<\/h2>/', $result);
|
$this->assertMatchesRegularExpression('/<h2>Missing Controller<\/h2>/', $result);
|
||||||
$this->assertRegExp('/<em>PostsController<\/em>/', $result);
|
$this->assertMatchesRegularExpression('/<em>PostsController<\/em>/', $result);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -672,7 +672,7 @@ class ExceptionRendererTest extends CakeTestCase {
|
||||||
$result = ob_get_clean();
|
$result = ob_get_clean();
|
||||||
|
|
||||||
foreach ($patterns as $pattern) {
|
foreach ($patterns as $pattern) {
|
||||||
$this->assertRegExp($pattern, $result);
|
$this->assertMatchesRegularExpression($pattern, $result);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -160,7 +160,7 @@ class CakeLogTest extends CakeTestCase {
|
||||||
$this->assertTrue(file_exists(LOGS . 'error.log'));
|
$this->assertTrue(file_exists(LOGS . 'error.log'));
|
||||||
|
|
||||||
$result = file_get_contents(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');
|
unlink(LOGS . 'error.log');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -203,8 +203,8 @@ class CakeLogTest extends CakeTestCase {
|
||||||
CakeLog::write(LOG_WARNING, 'Test warning 1');
|
CakeLog::write(LOG_WARNING, 'Test warning 1');
|
||||||
CakeLog::write(LOG_WARNING, 'Test warning 2');
|
CakeLog::write(LOG_WARNING, 'Test warning 2');
|
||||||
$result = file_get_contents(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 1/', $result);
|
$this->assertMatchesRegularExpression('/^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 2$/', $result);
|
||||||
unlink(LOGS . 'error.log');
|
unlink(LOGS . 'error.log');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -607,14 +607,14 @@ class CakeLogTest extends CakeTestCase {
|
||||||
$testMessage = 'emergency message';
|
$testMessage = 'emergency message';
|
||||||
CakeLog::emergency($testMessage);
|
CakeLog::emergency($testMessage);
|
||||||
$contents = file_get_contents(LOGS . 'error.log');
|
$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->assertFalse(file_exists(LOGS . 'debug.log'));
|
||||||
$this->_deleteLogs();
|
$this->_deleteLogs();
|
||||||
|
|
||||||
$testMessage = 'alert message';
|
$testMessage = 'alert message';
|
||||||
CakeLog::alert($testMessage);
|
CakeLog::alert($testMessage);
|
||||||
$contents = file_get_contents(LOGS . 'error.log');
|
$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->assertFalse(file_exists(LOGS . 'debug.log'));
|
||||||
$this->_deleteLogs();
|
$this->_deleteLogs();
|
||||||
|
|
||||||
|
@ -642,14 +642,14 @@ class CakeLogTest extends CakeTestCase {
|
||||||
$testMessage = 'notice message';
|
$testMessage = 'notice message';
|
||||||
CakeLog::notice($testMessage);
|
CakeLog::notice($testMessage);
|
||||||
$contents = file_get_contents(LOGS . 'debug.log');
|
$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->assertFalse(file_exists(LOGS . 'error.log'));
|
||||||
$this->_deleteLogs();
|
$this->_deleteLogs();
|
||||||
|
|
||||||
$testMessage = 'info message';
|
$testMessage = 'info message';
|
||||||
CakeLog::info($testMessage);
|
CakeLog::info($testMessage);
|
||||||
$contents = file_get_contents(LOGS . 'debug.log');
|
$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->assertFalse(file_exists(LOGS . 'error.log'));
|
||||||
$this->_deleteLogs();
|
$this->_deleteLogs();
|
||||||
|
|
||||||
|
|
|
@ -38,19 +38,19 @@ class FileLogTest extends CakeTestCase {
|
||||||
$this->assertTrue(file_exists(LOGS . 'error.log'));
|
$this->assertTrue(file_exists(LOGS . 'error.log'));
|
||||||
|
|
||||||
$result = file_get_contents(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');
|
$log->write('debug', 'Test warning');
|
||||||
$this->assertTrue(file_exists(LOGS . 'debug.log'));
|
$this->assertTrue(file_exists(LOGS . 'debug.log'));
|
||||||
|
|
||||||
$result = file_get_contents(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');
|
$log->write('random', 'Test warning');
|
||||||
$this->assertTrue(file_exists(LOGS . 'random.log'));
|
$this->assertTrue(file_exists(LOGS . 'random.log'));
|
||||||
|
|
||||||
$result = file_get_contents(LOGS . 'random.log');
|
$result = file_get_contents(LOGS . 'random.log');
|
||||||
$this->assertRegExp('/^2[0-9]{3}-[0-9]+-[0-9]+ [0-9]+:[0-9]+:[0-9]+ Random: Test warning/', $result);
|
$this->assertMatchesRegularExpression('/^2[0-9]{3}-[0-9]+-[0-9]+ [0-9]+:[0-9]+:[0-9]+ Random: Test warning/', $result);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -86,7 +86,7 @@ class FileLogTest extends CakeTestCase {
|
||||||
$this->assertTrue(file_exists($path . 'error.log'));
|
$this->assertTrue(file_exists($path . 'error.log'));
|
||||||
|
|
||||||
$result = file_get_contents($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.*')));
|
$this->assertEquals(0, count(glob($path . 'error.log.*')));
|
||||||
|
|
||||||
clearstatcache();
|
clearstatcache();
|
||||||
|
@ -96,24 +96,24 @@ class FileLogTest extends CakeTestCase {
|
||||||
$this->assertEquals(1, count($files));
|
$this->assertEquals(1, count($files));
|
||||||
|
|
||||||
$result = file_get_contents($files[0]);
|
$result = file_get_contents($files[0]);
|
||||||
$this->assertRegExp('/this text is under 35 bytes/', $result);
|
$this->assertMatchesRegularExpression('/this text is under 35 bytes/', $result);
|
||||||
$this->assertRegExp('/Warning: Test warning one/', $result);
|
$this->assertMatchesRegularExpression('/Warning: Test warning one/', $result);
|
||||||
|
|
||||||
sleep(1);
|
sleep(1);
|
||||||
clearstatcache();
|
clearstatcache();
|
||||||
$log->write('warning', 'Test warning third');
|
$log->write('warning', 'Test warning third');
|
||||||
|
|
||||||
$result = file_get_contents($path . 'error.log');
|
$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.*');
|
$files = glob($path . 'error.log.*');
|
||||||
$this->assertEquals(2, count($files));
|
$this->assertEquals(2, count($files));
|
||||||
|
|
||||||
$result = file_get_contents($files[0]);
|
$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]);
|
$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");
|
file_put_contents($path . 'error.log.0000000000', "The oldest log file with over 35 bytes.\n");
|
||||||
|
|
||||||
|
@ -126,13 +126,13 @@ class FileLogTest extends CakeTestCase {
|
||||||
$this->assertEquals(2, count($files));
|
$this->assertEquals(2, count($files));
|
||||||
|
|
||||||
$result = file_get_contents($path . 'error.log');
|
$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));
|
$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));
|
$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");
|
file_put_contents($path . 'debug.log', "this text is just greater than 35 bytes\n");
|
||||||
$log = new FileLog(array(
|
$log = new FileLog(array(
|
||||||
|
@ -145,7 +145,7 @@ class FileLogTest extends CakeTestCase {
|
||||||
$this->assertTrue(file_exists($path . 'debug.log'));
|
$this->assertTrue(file_exists($path . 'debug.log'));
|
||||||
|
|
||||||
$result = file_get_contents($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->assertFalse(strstr($result, 'greater than 5 bytes'));
|
||||||
$this->assertEquals(0, count(glob($path . 'debug.log.*')));
|
$this->assertEquals(0, count(glob($path . 'debug.log.*')));
|
||||||
}
|
}
|
||||||
|
|
|
@ -736,7 +736,7 @@ class CakeSchemaTest extends CakeTestCase {
|
||||||
'indexes' => array('PRIMARY' => array('column' => 'id', 'unique' => true)),
|
'indexes' => array('PRIMARY' => array('column' => 'id', 'unique' => true)),
|
||||||
);
|
);
|
||||||
$result = $this->Schema->generateTable('posts', $posts);
|
$result = $this->Schema->generateTable('posts', $posts);
|
||||||
$this->assertRegExp('/public \$posts/', $result);
|
$this->assertMatchesRegularExpression('/public \$posts/', $result);
|
||||||
|
|
||||||
$posts = array(
|
$posts = array(
|
||||||
'id' => array('type' => 'integer', 'null' => false, 'default' => 0, 'key' => 'primary'),
|
'id' => array('type' => 'integer', 'null' => false, 'default' => 0, 'key' => 'primary'),
|
||||||
|
@ -752,8 +752,8 @@ class CakeSchemaTest extends CakeTestCase {
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
$result = $this->Schema->generateTable('fields', $posts);
|
$result = $this->Schema->generateTable('fields', $posts);
|
||||||
$this->assertRegExp('/public \$fields/', $result);
|
$this->assertMatchesRegularExpression('/public \$fields/', $result);
|
||||||
$this->assertRegExp('/\'type\' \=\> \'fulltext\'/', $result);
|
$this->assertMatchesRegularExpression('/\'type\' \=\> \'fulltext\'/', $result);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1154,11 +1154,11 @@ class CakeSchemaTest extends CakeTestCase {
|
||||||
$col = $Schema->tables['testdescribes']['int_null'];
|
$col = $Schema->tables['testdescribes']['int_null'];
|
||||||
$col['name'] = 'int_null';
|
$col['name'] = 'int_null';
|
||||||
$column = $this->db->buildColumn($col);
|
$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 = $Schema->tables['testdescribes']['int_not_null'];
|
||||||
$col['name'] = 'int_not_null';
|
$col['name'] = 'int_not_null';
|
||||||
$column = $this->db->buildColumn($col);
|
$column = $this->db->buildColumn($col);
|
||||||
$this->assertRegExp('/' . preg_quote($column, '/') . '/', $sql);
|
$this->assertMatchesRegularExpression('/' . preg_quote($column, '/') . '/', $sql);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1211,7 +1211,7 @@ SQL;
|
||||||
}
|
}
|
||||||
|
|
||||||
$query = $this->Dbo->buildAssociationQuery($this->Model->Category2, $queryData);
|
$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 = new TestModel4();
|
||||||
$this->Model->schema();
|
$this->Model->schema();
|
||||||
|
@ -1258,10 +1258,10 @@ SQL;
|
||||||
$this->assertEquals($expected, $queryData);
|
$this->assertEquals($expected, $queryData);
|
||||||
|
|
||||||
$result = $this->Dbo->buildAssociationQuery($this->Model, $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->assertMatchesRegularExpression('/^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->assertMatchesRegularExpression('/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->assertMatchesRegularExpression('/\s+ON\s+\(`TestModel4`.`parent_id` = `TestModel4Parent`.`id`\)\s+WHERE/', $result);
|
||||||
$this->assertRegExp('/\s+WHERE\s+1 = 1$/', $result);
|
$this->assertMatchesRegularExpression('/\s+WHERE\s+1 = 1$/', $result);
|
||||||
|
|
||||||
$params['assocData']['type'] = 'INNER';
|
$params['assocData']['type'] = 'INNER';
|
||||||
$this->Model->belongsTo['TestModel4Parent']['type'] = 'INNER';
|
$this->Model->belongsTo['TestModel4Parent']['type'] = 'INNER';
|
||||||
|
@ -1421,10 +1421,10 @@ SQL;
|
||||||
$this->assertTrue($result);
|
$this->assertTrue($result);
|
||||||
|
|
||||||
$result = $this->Dbo->buildAssociationQuery($this->Model, $queryData);
|
$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->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->assertRegExp('/FROM\s+\S+`test_model8` AS `TestModel8`\s+LEFT JOIN\s+\S+`test_model9` AS `TestModel9`/', $result);
|
$this->assertMatchesRegularExpression('/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->assertMatchesRegularExpression('/\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('/\s+WHERE\s+(?:\()?1\s+=\s+1(?:\))?\s*$/', $result);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1445,10 +1445,10 @@ SQL;
|
||||||
$this->assertTrue($result);
|
$this->assertTrue($result);
|
||||||
|
|
||||||
$result = $this->Dbo->buildAssociationQuery($this->Model, $queryData);
|
$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->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->assertRegExp('/FROM\s+\S+`test_model9` AS `TestModel9`\s+LEFT JOIN\s+\S+`test_model8` AS `TestModel8`/', $result);
|
$this->assertMatchesRegularExpression('/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->assertMatchesRegularExpression('/\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('/\s+WHERE\s+(?:\()?1\s+=\s+1(?:\))?\s*$/', $result);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1470,10 +1470,10 @@ SQL;
|
||||||
$this->assertTrue($result);
|
$this->assertTrue($result);
|
||||||
|
|
||||||
$result = $this->Dbo->buildAssociationQuery($this->Model, $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->assertMatchesRegularExpression('/^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->assertMatchesRegularExpression('/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->assertMatchesRegularExpression('/\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('/\s+WHERE\s+(?:\()?`TestModel4Parent`.`name`\s+!=\s+\'mariano\'(?:\))?\s*$/', $result);
|
||||||
|
|
||||||
$this->Featured2 = new Featured2();
|
$this->Featured2 = new Featured2();
|
||||||
$this->Featured2->schema();
|
$this->Featured2->schema();
|
||||||
|
@ -1498,7 +1498,7 @@ SQL;
|
||||||
$this->assertTrue($result);
|
$this->assertTrue($result);
|
||||||
$result = $this->Dbo->buildAssociationQuery($this->Featured2, $queryData);
|
$result = $this->Dbo->buildAssociationQuery($this->Featured2, $queryData);
|
||||||
|
|
||||||
$this->assertRegExp(
|
$this->assertMatchesRegularExpression(
|
||||||
'/^SELECT\s+`Featured2`\.`id`, `Featured2`\.`article_id`, `Featured2`\.`category_id`, `Featured2`\.`name`,\s+' .
|
'/^SELECT\s+`Featured2`\.`id`, `Featured2`\.`article_id`, `Featured2`\.`category_id`, `Featured2`\.`name`,\s+' .
|
||||||
'`ArticleFeatured2`\.`id`, `ArticleFeatured2`\.`title`, `ArticleFeatured2`\.`user_id`, `ArticleFeatured2`\.`published`\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`' .
|
'FROM\s+\S+`featured2` AS `Featured2`\s+LEFT JOIN\s+\S+`article_featured` AS `ArticleFeatured2`' .
|
||||||
|
@ -1533,10 +1533,10 @@ SQL;
|
||||||
$this->assertEquals(trim($expected), trim($result));
|
$this->assertEquals(trim($expected), trim($result));
|
||||||
|
|
||||||
$result = $this->Dbo->buildAssociationQuery($this->Model, $queryData);
|
$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->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->assertRegExp('/\s+FROM\s+\S+`test_model4` AS `TestModel4`\s+LEFT JOIN\s+/', $result);
|
$this->assertMatchesRegularExpression('/\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->assertMatchesRegularExpression('/`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('/\s+WHERE\s+(?:\()?\s*1 = 1\s*(?:\))?\s*$/', $result);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1560,10 +1560,10 @@ SQL;
|
||||||
|
|
||||||
$result = $this->Dbo->buildAssociationQuery($this->Model, $queryData);
|
$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->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->assertRegExp('/\s+FROM\s+\S+`test_model4` AS `TestModel4`\s+LEFT JOIN\s+\S+`test_model5` AS `TestModel5`/', $result);
|
$this->assertMatchesRegularExpression('/\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->assertMatchesRegularExpression('/\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('/\s+WHERE\s+(?:\()?\s*`TestModel5`.`name`\s+!=\s+\'mariano\'\s*(?:\))?\s*$/', $result);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1590,10 +1590,10 @@ SQL;
|
||||||
$this->assertEquals(trim($expected), trim($result));
|
$this->assertEquals(trim($expected), trim($result));
|
||||||
|
|
||||||
$result = $this->Dbo->buildAssociationQuery($this->Model, $queryData);
|
$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->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->assertRegExp('/\s+FROM\s+\S+`test_model5` AS `TestModel5`\s+LEFT JOIN\s+\S+`test_model4` AS `TestModel4`/', $result);
|
$this->assertMatchesRegularExpression('/\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->assertMatchesRegularExpression('/\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('/\s+WHERE\s+(?:\()?\s*1 = 1\s*(?:\))?\s*$/', $result);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1620,10 +1620,10 @@ SQL;
|
||||||
$this->assertEquals(trim($expected), trim($result));
|
$this->assertEquals(trim($expected), trim($result));
|
||||||
|
|
||||||
$result = $this->Dbo->buildAssociationQuery($this->Model, $queryData);
|
$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->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->assertRegExp('/\s+FROM\s+\S+`test_model5` AS `TestModel5`\s+LEFT JOIN\s+\S+`test_model4` AS `TestModel4`/', $result);
|
$this->assertMatchesRegularExpression('/\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->assertMatchesRegularExpression('/\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('/\s+WHERE\s+`TestModel5`.`name` != \'mariano\'\s*$/', $result);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1643,14 +1643,14 @@ SQL;
|
||||||
|
|
||||||
$result = $this->Dbo->generateAssociationQuery($this->Model, $params['linkModel'], $params['type'], $params['assoc'], $params['assocData'], $queryData, $params['external']);
|
$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->assertMatchesRegularExpression('/^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->assertMatchesRegularExpression('/\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('/\s+WHERE\s+`TestModel6`.`test_model5_id`\s+=\s+\({\$__cakeID__\$}\)/', $result);
|
||||||
|
|
||||||
$result = $this->Dbo->buildAssociationQuery($this->Model, $queryData);
|
$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->assertMatchesRegularExpression('/^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->assertMatchesRegularExpression('/\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('/\s+WHERE\s+(?:\()?\s*1 = 1\s*(?:\))?\s*$/', $result);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1671,7 +1671,7 @@ SQL;
|
||||||
$params = &$this->_prepareAssociationQuery($this->Model, $queryData, $binding);
|
$params = &$this->_prepareAssociationQuery($this->Model, $queryData, $binding);
|
||||||
|
|
||||||
$result = $this->Dbo->generateAssociationQuery($this->Model, $params['linkModel'], $params['type'], $params['assoc'], $params['assocData'], $queryData, $params['external']);
|
$result = $this->Dbo->generateAssociationQuery($this->Model, $params['linkModel'], $params['type'], $params['assoc'], $params['assocData'], $queryData, $params['external']);
|
||||||
$this->assertRegExp(
|
$this->assertMatchesRegularExpression(
|
||||||
'/^SELECT\s+' .
|
'/^SELECT\s+' .
|
||||||
'`TestModel6`\.`id`, `TestModel6`\.`test_model5_id`, `TestModel6`\.`name`, `TestModel6`\.`created`, `TestModel6`\.`updated`\s+' .
|
'`TestModel6`\.`id`, `TestModel6`\.`test_model5_id`, `TestModel6`\.`name`, `TestModel6`\.`created`, `TestModel6`\.`updated`\s+' .
|
||||||
'FROM\s+\S+`test_model6` AS `TestModel6`\s+WHERE\s+' .
|
'FROM\s+\S+`test_model6` AS `TestModel6`\s+WHERE\s+' .
|
||||||
|
@ -1681,7 +1681,7 @@ SQL;
|
||||||
);
|
);
|
||||||
|
|
||||||
$result = $this->Dbo->buildAssociationQuery($this->Model, $queryData);
|
$result = $this->Dbo->buildAssociationQuery($this->Model, $queryData);
|
||||||
$this->assertRegExp(
|
$this->assertMatchesRegularExpression(
|
||||||
'/^SELECT\s+' .
|
'/^SELECT\s+' .
|
||||||
'`TestModel5`\.`id`, `TestModel5`\.`test_model4_id`, `TestModel5`\.`name`, `TestModel5`\.`created`, `TestModel5`\.`updated`\s+' .
|
'`TestModel5`\.`id`, `TestModel5`\.`test_model4_id`, `TestModel5`\.`name`, `TestModel5`\.`created`, `TestModel5`\.`updated`\s+' .
|
||||||
'FROM\s+\S+`test_model5` AS `TestModel5`\s+WHERE\s+' .
|
'FROM\s+\S+`test_model5` AS `TestModel5`\s+WHERE\s+' .
|
||||||
|
@ -1706,14 +1706,14 @@ SQL;
|
||||||
$params = &$this->_prepareAssociationQuery($this->Model, $queryData, $binding);
|
$params = &$this->_prepareAssociationQuery($this->Model, $queryData, $binding);
|
||||||
|
|
||||||
$result = $this->Dbo->generateAssociationQuery($this->Model, $params['linkModel'], $params['type'], $params['assoc'], $params['assocData'], $queryData, $params['external']);
|
$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->assertMatchesRegularExpression('/^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->assertMatchesRegularExpression('/\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('/WHERE\s+(?:\()?`TestModel6`\.`test_model5_id`\s+=\s+\({\$__cakeID__\$}\)(?:\))?/', $result);
|
||||||
|
|
||||||
$result = $this->Dbo->buildAssociationQuery($this->Model, $queryData);
|
$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->assertMatchesRegularExpression('/^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->assertMatchesRegularExpression('/\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('/\s+WHERE\s+(?:\()?`TestModel5`.`name`\s+!=\s+\'mariano\'(?:\))?\s*$/', $result);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1738,15 +1738,15 @@ SQL;
|
||||||
|
|
||||||
$result = $this->Dbo->generateAssociationQuery($this->Model, $params['linkModel'], $params['type'], $params['assoc'], $params['assocData'], $queryData, $params['external']);
|
$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->assertMatchesRegularExpression('/^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->assertMatchesRegularExpression('/\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('/WHERE\s+(?:\()?`TestModel6`\.`test_model5_id`\s+=\s+\({\$__cakeID__\$}\)(?:\))?/', $result);
|
||||||
$this->assertRegExp('/\s+LIMIT 2,\s*5\s*$/', $result);
|
$this->assertMatchesRegularExpression('/\s+LIMIT 2,\s*5\s*$/', $result);
|
||||||
|
|
||||||
$result = $this->Dbo->buildAssociationQuery($this->Model, $queryData);
|
$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->assertMatchesRegularExpression('/^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->assertMatchesRegularExpression('/\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('/\s+WHERE\s+(?:\()?1\s+=\s+1(?:\))?\s*$/', $result);
|
||||||
|
|
||||||
$this->Model->hasMany['TestModel6'] = $backup;
|
$this->Model->hasMany['TestModel6'] = $backup;
|
||||||
}
|
}
|
||||||
|
@ -1771,15 +1771,15 @@ SQL;
|
||||||
$params = &$this->_prepareAssociationQuery($this->Model, $queryData, $binding);
|
$params = &$this->_prepareAssociationQuery($this->Model, $queryData, $binding);
|
||||||
|
|
||||||
$result = $this->Dbo->generateAssociationQuery($this->Model, $params['linkModel'], $params['type'], $params['assoc'], $params['assocData'], $queryData, $params['external']);
|
$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->assertMatchesRegularExpression('/^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->assertMatchesRegularExpression('/\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('/WHERE\s+(?:\()?`TestModel6`\.`test_model5_id`\s+=\s+\({\$__cakeID__\$}\)(?:\))?/', $result);
|
||||||
$this->assertRegExp('/\s+LIMIT 5,\s*5\s*$/', $result);
|
$this->assertMatchesRegularExpression('/\s+LIMIT 5,\s*5\s*$/', $result);
|
||||||
|
|
||||||
$result = $this->Dbo->buildAssociationQuery($this->Model, $queryData);
|
$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->assertMatchesRegularExpression('/^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->assertMatchesRegularExpression('/\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('/\s+WHERE\s+(?:\()?1\s+=\s+1(?:\))?\s*$/', $result);
|
||||||
|
|
||||||
$this->Model->hasMany['TestModel6'] = $backup;
|
$this->Model->hasMany['TestModel6'] = $backup;
|
||||||
}
|
}
|
||||||
|
@ -1800,14 +1800,14 @@ SQL;
|
||||||
$params = &$this->_prepareAssociationQuery($this->Model, $queryData, $binding);
|
$params = &$this->_prepareAssociationQuery($this->Model, $queryData, $binding);
|
||||||
|
|
||||||
$result = $this->Dbo->generateAssociationQuery($this->Model, $params['linkModel'], $params['type'], $params['assoc'], $params['assocData'], $queryData, $params['external']);
|
$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->assertMatchesRegularExpression('/^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->assertMatchesRegularExpression('/\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('/WHERE\s+(?:\()?`TestModel6`\.`test_model5_id`\s+=\s+\({\$__cakeID__\$}\)(?:\))?/', $result);
|
||||||
|
|
||||||
$result = $this->Dbo->buildAssociationQuery($this->Model, $queryData);
|
$result = $this->Dbo->buildAssociationQuery($this->Model, $queryData);
|
||||||
$this->assertRegExp('/^SELECT\s+`TestModel5`\.`name`, `TestModel5`\.`id`\s+/', $result);
|
$this->assertMatchesRegularExpression('/^SELECT\s+`TestModel5`\.`name`, `TestModel5`\.`id`\s+/', $result);
|
||||||
$this->assertRegExp('/\s+FROM\s+\S+`test_model5` AS `TestModel5`\s+WHERE\s+/', $result);
|
$this->assertMatchesRegularExpression('/\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('/\s+WHERE\s+(?:\()?1\s+=\s+1(?:\))?\s*$/', $result);
|
||||||
|
|
||||||
$binding = array('type' => 'hasMany', 'model' => 'TestModel6');
|
$binding = array('type' => 'hasMany', 'model' => 'TestModel6');
|
||||||
$queryData = array('fields' => array('`TestModel5`.`id`, `TestModel5`.`name`'));
|
$queryData = array('fields' => array('`TestModel5`.`id`, `TestModel5`.`name`'));
|
||||||
|
@ -1815,14 +1815,14 @@ SQL;
|
||||||
$params = &$this->_prepareAssociationQuery($this->Model, $queryData, $binding);
|
$params = &$this->_prepareAssociationQuery($this->Model, $queryData, $binding);
|
||||||
|
|
||||||
$result = $this->Dbo->generateAssociationQuery($this->Model, $params['linkModel'], $params['type'], $params['assoc'], $params['assocData'], $queryData, $params['external']);
|
$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->assertMatchesRegularExpression('/^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->assertMatchesRegularExpression('/\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('/WHERE\s+(?:\()?`TestModel6`\.`test_model5_id`\s+=\s+\({\$__cakeID__\$}\)(?:\))?/', $result);
|
||||||
|
|
||||||
$result = $this->Dbo->buildAssociationQuery($this->Model, $queryData);
|
$result = $this->Dbo->buildAssociationQuery($this->Model, $queryData);
|
||||||
$this->assertRegExp('/^SELECT\s+`TestModel5`\.`id`, `TestModel5`\.`name`\s+/', $result);
|
$this->assertMatchesRegularExpression('/^SELECT\s+`TestModel5`\.`id`, `TestModel5`\.`name`\s+/', $result);
|
||||||
$this->assertRegExp('/\s+FROM\s+\S+`test_model5` AS `TestModel5`\s+WHERE\s+/', $result);
|
$this->assertMatchesRegularExpression('/\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('/\s+WHERE\s+(?:\()?1\s+=\s+1(?:\))?\s*$/', $result);
|
||||||
|
|
||||||
$binding = array('type' => 'hasMany', 'model' => 'TestModel6');
|
$binding = array('type' => 'hasMany', 'model' => 'TestModel6');
|
||||||
$queryData = array('fields' => array('`TestModel5`.`name`', '`TestModel5`.`created`'));
|
$queryData = array('fields' => array('`TestModel5`.`name`', '`TestModel5`.`created`'));
|
||||||
|
@ -1830,14 +1830,14 @@ SQL;
|
||||||
$params = &$this->_prepareAssociationQuery($this->Model, $queryData, $binding);
|
$params = &$this->_prepareAssociationQuery($this->Model, $queryData, $binding);
|
||||||
|
|
||||||
$result = $this->Dbo->generateAssociationQuery($this->Model, $params['linkModel'], $params['type'], $params['assoc'], $params['assocData'], $queryData, $params['external']);
|
$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->assertMatchesRegularExpression('/^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->assertMatchesRegularExpression('/\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('/WHERE\s+(?:\()?`TestModel6`\.`test_model5_id`\s+=\s+\({\$__cakeID__\$}\)(?:\))?/', $result);
|
||||||
|
|
||||||
$result = $this->Dbo->buildAssociationQuery($this->Model, $queryData);
|
$result = $this->Dbo->buildAssociationQuery($this->Model, $queryData);
|
||||||
$this->assertRegExp('/^SELECT\s+`TestModel5`\.`name`, `TestModel5`\.`created`, `TestModel5`\.`id`\s+/', $result);
|
$this->assertMatchesRegularExpression('/^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->assertMatchesRegularExpression('/\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('/\s+WHERE\s+(?:\()?1\s+=\s+1(?:\))?\s*$/', $result);
|
||||||
|
|
||||||
$this->Model->hasMany['TestModel6']['fields'] = array('name');
|
$this->Model->hasMany['TestModel6']['fields'] = array('name');
|
||||||
|
|
||||||
|
@ -1847,14 +1847,14 @@ SQL;
|
||||||
$params = &$this->_prepareAssociationQuery($this->Model, $queryData, $binding);
|
$params = &$this->_prepareAssociationQuery($this->Model, $queryData, $binding);
|
||||||
|
|
||||||
$result = $this->Dbo->generateAssociationQuery($this->Model, $params['linkModel'], $params['type'], $params['assoc'], $params['assocData'], $queryData, $params['external']);
|
$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->assertMatchesRegularExpression('/^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->assertMatchesRegularExpression('/\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('/WHERE\s+(?:\()?`TestModel6`\.`test_model5_id`\s+=\s+\({\$__cakeID__\$}\)(?:\))?/', $result);
|
||||||
|
|
||||||
$result = $this->Dbo->buildAssociationQuery($this->Model, $queryData);
|
$result = $this->Dbo->buildAssociationQuery($this->Model, $queryData);
|
||||||
$this->assertRegExp('/^SELECT\s+`TestModel5`\.`id`, `TestModel5`\.`name`\s+/', $result);
|
$this->assertMatchesRegularExpression('/^SELECT\s+`TestModel5`\.`id`, `TestModel5`\.`name`\s+/', $result);
|
||||||
$this->assertRegExp('/\s+FROM\s+\S+`test_model5` AS `TestModel5`\s+WHERE\s+/', $result);
|
$this->assertMatchesRegularExpression('/\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('/\s+WHERE\s+(?:\()?1\s+=\s+1(?:\))?\s*$/', $result);
|
||||||
|
|
||||||
unset($this->Model->hasMany['TestModel6']['fields']);
|
unset($this->Model->hasMany['TestModel6']['fields']);
|
||||||
|
|
||||||
|
@ -1866,14 +1866,14 @@ SQL;
|
||||||
$params = &$this->_prepareAssociationQuery($this->Model, $queryData, $binding);
|
$params = &$this->_prepareAssociationQuery($this->Model, $queryData, $binding);
|
||||||
|
|
||||||
$result = $this->Dbo->generateAssociationQuery($this->Model, $params['linkModel'], $params['type'], $params['assoc'], $params['assocData'], $queryData, $params['external']);
|
$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->assertMatchesRegularExpression('/^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->assertMatchesRegularExpression('/\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('/WHERE\s+(?:\()?`TestModel6`\.`test_model5_id`\s+=\s+\({\$__cakeID__\$}\)(?:\))?/', $result);
|
||||||
|
|
||||||
$result = $this->Dbo->buildAssociationQuery($this->Model, $queryData);
|
$result = $this->Dbo->buildAssociationQuery($this->Model, $queryData);
|
||||||
$this->assertRegExp('/^SELECT\s+`TestModel5`\.`id`, `TestModel5`\.`name`\s+/', $result);
|
$this->assertMatchesRegularExpression('/^SELECT\s+`TestModel5`\.`id`, `TestModel5`\.`name`\s+/', $result);
|
||||||
$this->assertRegExp('/\s+FROM\s+\S+`test_model5` AS `TestModel5`\s+WHERE\s+/', $result);
|
$this->assertMatchesRegularExpression('/\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('/\s+WHERE\s+(?:\()?1\s+=\s+1(?:\))?\s*$/', $result);
|
||||||
|
|
||||||
unset($this->Model->hasMany['TestModel6']['fields']);
|
unset($this->Model->hasMany['TestModel6']['fields']);
|
||||||
|
|
||||||
|
@ -1885,14 +1885,14 @@ SQL;
|
||||||
$params = &$this->_prepareAssociationQuery($this->Model, $queryData, $binding);
|
$params = &$this->_prepareAssociationQuery($this->Model, $queryData, $binding);
|
||||||
|
|
||||||
$result = $this->Dbo->generateAssociationQuery($this->Model, $params['linkModel'], $params['type'], $params['assoc'], $params['assocData'], $queryData, $params['external']);
|
$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->assertMatchesRegularExpression('/^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->assertMatchesRegularExpression('/\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('/WHERE\s+(?:\()?`TestModel6`\.`test_model5_id`\s+=\s+\({\$__cakeID__\$}\)(?:\))?/', $result);
|
||||||
|
|
||||||
$result = $this->Dbo->buildAssociationQuery($this->Model, $queryData);
|
$result = $this->Dbo->buildAssociationQuery($this->Model, $queryData);
|
||||||
$this->assertRegExp('/^SELECT\s+`TestModel5`\.`id`, `TestModel5`\.`name`\s+/', $result);
|
$this->assertMatchesRegularExpression('/^SELECT\s+`TestModel5`\.`id`, `TestModel5`\.`name`\s+/', $result);
|
||||||
$this->assertRegExp('/\s+FROM\s+\S+`test_model5` AS `TestModel5`\s+WHERE\s+/', $result);
|
$this->assertMatchesRegularExpression('/\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('/\s+WHERE\s+(?:\()?1\s+=\s+1(?:\))?\s*$/', $result);
|
||||||
|
|
||||||
unset($this->Model->hasMany['TestModel6']['fields']);
|
unset($this->Model->hasMany['TestModel6']['fields']);
|
||||||
}
|
}
|
||||||
|
@ -1913,7 +1913,7 @@ SQL;
|
||||||
$this->Model->recursive = 0;
|
$this->Model->recursive = 0;
|
||||||
|
|
||||||
$result = $this->Dbo->buildAssociationQuery($this->Model, $queryData);
|
$result = $this->Dbo->buildAssociationQuery($this->Model, $queryData);
|
||||||
$this->assertRegExp('/^SELECT\s+MIN\(`TestModel5`\.`test_model4_id`\)\s+FROM/', $result);
|
$this->assertMatchesRegularExpression('/^SELECT\s+MIN\(`TestModel5`\.`test_model4_id`\)\s+FROM/', $result);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1933,16 +1933,16 @@ SQL;
|
||||||
|
|
||||||
$result = $this->Dbo->generateAssociationQuery($this->Model, $params['linkModel'], $params['type'], $params['assoc'], $params['assocData'], $queryData, $params['external']);
|
$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);
|
$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->assertMatchesRegularExpression('/^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->assertMatchesRegularExpression('/\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->assertMatchesRegularExpression('/\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->assertMatchesRegularExpression('/\s+AND\s+`TestModel4TestModel7`\.`test_model7_id`\s+=\s+`TestModel7`\.`id`\)/', $result);
|
||||||
$this->assertRegExp('/WHERE\s+(?:\()?1 = 1(?:\))?\s*$/', $result);
|
$this->assertMatchesRegularExpression('/WHERE\s+(?:\()?1 = 1(?:\))?\s*$/', $result);
|
||||||
|
|
||||||
$result = $this->Dbo->buildAssociationQuery($this->Model, $queryData);
|
$result = $this->Dbo->buildAssociationQuery($this->Model, $queryData);
|
||||||
$this->assertRegExp('/^SELECT\s+`TestModel4`\.`id`, `TestModel4`\.`name`, `TestModel4`\.`created`, `TestModel4`\.`updated`\s+/', $result);
|
$this->assertMatchesRegularExpression('/^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->assertMatchesRegularExpression('/\s+FROM\s+\S+`test_model4` AS `TestModel4`\s+WHERE/', $result);
|
||||||
$this->assertRegExp('/\s+WHERE\s+(?:\()?1 = 1(?:\))?\s*$/', $result);
|
$this->assertMatchesRegularExpression('/\s+WHERE\s+(?:\()?1 = 1(?:\))?\s*$/', $result);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1961,14 +1961,14 @@ SQL;
|
||||||
$params = $this->_prepareAssociationQuery($this->Model, $queryData, $binding);
|
$params = $this->_prepareAssociationQuery($this->Model, $queryData, $binding);
|
||||||
|
|
||||||
$result = $this->Dbo->generateAssociationQuery($this->Model, $params['linkModel'], $params['type'], $params['assoc'], $params['assocData'], $queryData, $params['external']);
|
$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->assertMatchesRegularExpression('/^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->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->assertRegExp('/\s+ON\s+\(`TestModel4TestModel7`\.`test_model4_id`\s+=\s+{\$__cakeID__\$}/', $result);
|
$this->assertMatchesRegularExpression('/\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('/\s+AND\s+`TestModel4TestModel7`\.`test_model7_id`\s+=\s+`TestModel7`\.`id`\)\s+WHERE\s+/', $result);
|
||||||
|
|
||||||
$result = $this->Dbo->buildAssociationQuery($this->Model, $queryData);
|
$result = $this->Dbo->buildAssociationQuery($this->Model, $queryData);
|
||||||
$this->assertRegExp('/^SELECT\s+`TestModel4`\.`id`, `TestModel4`\.`name`, `TestModel4`\.`created`, `TestModel4`\.`updated`\s+/', $result);
|
$this->assertMatchesRegularExpression('/^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('/\s+FROM\s+\S+`test_model4` AS `TestModel4`\s+WHERE\s+(?:\()?`TestModel4`.`name`\s+!=\s+\'mariano\'(?:\))?\s*$/', $result);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1992,15 +1992,15 @@ SQL;
|
||||||
$params = &$this->_prepareAssociationQuery($this->Model, $queryData, $binding);
|
$params = &$this->_prepareAssociationQuery($this->Model, $queryData, $binding);
|
||||||
|
|
||||||
$result = $this->Dbo->generateAssociationQuery($this->Model, $params['linkModel'], $params['type'], $params['assoc'], $params['assocData'], $queryData, $params['external']);
|
$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->assertMatchesRegularExpression('/^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->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->assertRegExp('/\s+ON\s+\(`TestModel4TestModel7`\.`test_model4_id`\s+=\s+{\$__cakeID__\$}\s+/', $result);
|
$this->assertMatchesRegularExpression('/\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->assertMatchesRegularExpression('/\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('/\s+(?:\()?1\s+=\s+1(?:\))?\s*\s+LIMIT 2,\s*5\s*$/', $result);
|
||||||
|
|
||||||
$result = $this->Dbo->buildAssociationQuery($this->Model, $queryData);
|
$result = $this->Dbo->buildAssociationQuery($this->Model, $queryData);
|
||||||
$this->assertRegExp('/^SELECT\s+`TestModel4`\.`id`, `TestModel4`\.`name`, `TestModel4`\.`created`, `TestModel4`\.`updated`\s+/', $result);
|
$this->assertMatchesRegularExpression('/^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('/\s+FROM\s+\S+`test_model4` AS `TestModel4`\s+WHERE\s+(?:\()?1\s+=\s+1(?:\))?\s*$/', $result);
|
||||||
|
|
||||||
$this->Model->hasAndBelongsToMany['TestModel7'] = $backup;
|
$this->Model->hasAndBelongsToMany['TestModel7'] = $backup;
|
||||||
}
|
}
|
||||||
|
@ -2026,15 +2026,15 @@ SQL;
|
||||||
$params = &$this->_prepareAssociationQuery($this->Model, $queryData, $binding);
|
$params = &$this->_prepareAssociationQuery($this->Model, $queryData, $binding);
|
||||||
|
|
||||||
$result = $this->Dbo->generateAssociationQuery($this->Model, $params['linkModel'], $params['type'], $params['assoc'], $params['assocData'], $queryData, $params['external']);
|
$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->assertMatchesRegularExpression('/^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->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->assertRegExp('/\s+ON\s+\(`TestModel4TestModel7`\.`test_model4_id`\s+=\s+{\$__cakeID__\$}/', $result);
|
$this->assertMatchesRegularExpression('/\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('/\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('/\s+(?:\()?1\s+=\s+1(?:\))?\s*\s+LIMIT 5,\s*5\s*$/', $result);
|
||||||
|
|
||||||
$result = $this->Dbo->buildAssociationQuery($this->Model, $queryData);
|
$result = $this->Dbo->buildAssociationQuery($this->Model, $queryData);
|
||||||
$this->assertRegExp('/^SELECT\s+`TestModel4`\.`id`, `TestModel4`\.`name`, `TestModel4`\.`created`, `TestModel4`\.`updated`\s+/', $result);
|
$this->assertMatchesRegularExpression('/^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('/\s+FROM\s+\S+`test_model4` AS `TestModel4`\s+WHERE\s+(?:\()?1\s+=\s+1(?:\))?\s*$/', $result);
|
||||||
|
|
||||||
$this->Model->hasAndBelongsToMany['TestModel7'] = $backup;
|
$this->Model->hasAndBelongsToMany['TestModel7'] = $backup;
|
||||||
}
|
}
|
||||||
|
@ -2105,7 +2105,7 @@ SQL;
|
||||||
|
|
||||||
$result = $this->Dbo->conditions('Sportstaette.sportstaette LIKE "%ru%" AND Sportstaette.sportstaettenart_id = 2');
|
$result = $this->Dbo->conditions('Sportstaette.sportstaette LIKE "%ru%" AND Sportstaette.sportstaettenart_id = 2');
|
||||||
$expected = ' WHERE `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);
|
$this->assertEquals($expected, $result);
|
||||||
|
|
||||||
$result = $this->Dbo->conditions('Sportstaette.sportstaettenart_id = 2 AND Sportstaette.sportstaette LIKE "%ru%"');
|
$result = $this->Dbo->conditions('Sportstaette.sportstaettenart_id = 2 AND Sportstaette.sportstaette LIKE "%ru%"');
|
||||||
|
@ -2223,46 +2223,46 @@ SQL;
|
||||||
*/
|
*/
|
||||||
public function testParenthesisInStringConditions() {
|
public function testParenthesisInStringConditions() {
|
||||||
$result = $this->Dbo->conditions('Member.name = \'(lu\'');
|
$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\'');
|
$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\'');
|
$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\'');
|
$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)\'');
|
$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\'');
|
$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)\'');
|
$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\'');
|
$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\'');
|
$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\'');
|
$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)\'');
|
$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)\'');
|
$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\'');
|
$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\'');
|
$result = $this->Dbo->conditions('Member.name = \'(mariano.iglesias) CakePHP\'');
|
||||||
$this->assertRegExp('/^\s+WHERE\s+`Member`.`name`\s+=\s+\'\(mariano.iglesias\) CakePHP\'$/', $result);
|
$this->assertMatchesRegularExpression('/^\s+WHERE\s+`Member`.`name`\s+=\s+\'\(mariano.iglesias\) CakePHP\'$/', $result);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -2272,46 +2272,46 @@ SQL;
|
||||||
*/
|
*/
|
||||||
public function testParenthesisInArrayConditions() {
|
public function testParenthesisInArrayConditions() {
|
||||||
$result = $this->Dbo->conditions(array('Member.name' => '(lu'));
|
$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'));
|
$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'));
|
$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'));
|
$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)'));
|
$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'));
|
$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)'));
|
$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'));
|
$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'));
|
$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'));
|
$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)'));
|
$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)'));
|
$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'));
|
$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'));
|
$result = $this->Dbo->conditions(array('Member.name' => '(mariano.iglesias) CakePHP'));
|
||||||
$this->assertRegExp('/^\s+WHERE\s+`Member`.`name`\s+=\s+\'\(mariano.iglesias\) CakePHP\'$/', $result);
|
$this->assertMatchesRegularExpression('/^\s+WHERE\s+`Member`.`name`\s+=\s+\'\(mariano.iglesias\) CakePHP\'$/', $result);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -2322,10 +2322,10 @@ SQL;
|
||||||
public function testArrayConditionsParsing() {
|
public function testArrayConditionsParsing() {
|
||||||
$this->loadFixtures('Post', 'Author');
|
$this->loadFixtures('Post', 'Author');
|
||||||
$result = $this->Dbo->conditions(array('Stereo.type' => 'in dash speakers'));
|
$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'));
|
$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'));
|
$result = $this->Dbo->conditions(array('HardCandy.name LIKE' => 'a', 'Candy.name LIKE' => 'c'));
|
||||||
$expected = " WHERE `HardCandy`.`name` LIKE 'a' AND `Candy`.`name` LIKE 'c'";
|
$expected = " WHERE `HardCandy`.`name` LIKE 'a' AND `Candy`.`name` LIKE 'c'";
|
||||||
|
@ -2473,10 +2473,10 @@ SQL;
|
||||||
'NOT' => array('Course.id' => null, 'Course.vet' => 'N', 'level_of_education_id' => array(912, 999)),
|
'NOT' => array('Course.id' => null, 'Course.vet' => 'N', 'level_of_education_id' => array(912, 999)),
|
||||||
'Enrollment.yearcompleted >' => '0')
|
'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'));
|
$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'));
|
$result = $this->Dbo->conditions(array('TestModel.field =' => 'gribe$@()lu'));
|
||||||
$expected = " WHERE `TestModel`.`field` = 'gribe$@()lu'";
|
$expected = " WHERE `TestModel`.`field` = 'gribe$@()lu'";
|
||||||
|
@ -2649,7 +2649,7 @@ SQL;
|
||||||
'1=1 GROUP BY Thread.project_id'
|
'1=1 GROUP BY Thread.project_id'
|
||||||
);
|
);
|
||||||
$result = $this->Dbo->conditions($conditions);
|
$result = $this->Dbo->conditions($conditions);
|
||||||
$this->assertRegExp('/^\s*WHERE\s+`Thread`.`project_id`\s*=\s*5\s+AND\s+`Thread`.`buyer_id`\s*=\s*14\s+AND\s+1\s*=\s*1\s+GROUP BY `Thread`.`project_id`$/', $result);
|
$this->assertMatchesRegularExpression('/^\s*WHERE\s+`Thread`.`project_id`\s*=\s*5\s+AND\s+`Thread`.`buyer_id`\s*=\s*14\s+AND\s+1\s*=\s*1\s+GROUP BY `Thread`.`project_id`$/', $result);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -2659,10 +2659,10 @@ SQL;
|
||||||
*/
|
*/
|
||||||
public function testConditionsOptionalArguments() {
|
public function testConditionsOptionalArguments() {
|
||||||
$result = $this->Dbo->conditions(array('Member.name' => 'Mariano'), true, false);
|
$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);
|
$result = $this->Dbo->conditions(array(), true, false);
|
||||||
$this->assertRegExp('/^\s*1\s*=\s*1\s*$/', $result);
|
$this->assertMatchesRegularExpression('/^\s*1\s*=\s*1\s*$/', $result);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -2849,19 +2849,19 @@ SQL;
|
||||||
'fields' => 'id', 'table' => 'table', 'conditions' => 'WHERE 1=1',
|
'fields' => 'id', 'table' => 'table', 'conditions' => 'WHERE 1=1',
|
||||||
'alias' => '', 'joins' => '', 'order' => '', 'limit' => '', 'group' => ''
|
'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' => ''));
|
$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' => ''));
|
$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' => ''));
|
$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' => ''));
|
$result = $this->Dbo->renderStatement('delete', array('fields' => 'value=2', 'table' => 'table', 'conditions' => 'WHERE 1=1', 'alias' => 'alias', 'joins' => ''));
|
||||||
$this->assertRegExp('/^\s*DELETE\s+alias\s+FROM\s+table\s+AS\s+alias\s+WHERE\s+1=1\s*$/', $result);
|
$this->assertMatchesRegularExpression('/^\s*DELETE\s+alias\s+FROM\s+table\s+AS\s+alias\s+WHERE\s+1=1\s*$/', $result);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -2877,7 +2877,7 @@ SQL;
|
||||||
$this->assertTrue(empty($result));
|
$this->assertTrue(empty($result));
|
||||||
|
|
||||||
$result = $this->Dbo->dropSchema($Schema, 'table');
|
$result = $this->Dbo->dropSchema($Schema, 'table');
|
||||||
$this->assertRegExp('/^\s*DROP TABLE IF EXISTS\s+' . $this->Dbo->fullTableName('table') . ';\s*$/s', $result);
|
$this->assertMatchesRegularExpression('/^\s*DROP TABLE IF EXISTS\s+' . $this->Dbo->fullTableName('table') . ';\s*$/s', $result);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -2907,56 +2907,56 @@ SQL;
|
||||||
$this->assertEquals($expected, $result);
|
$this->assertEquals($expected, $result);
|
||||||
|
|
||||||
$result = $this->Dbo->order("title, id");
|
$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");
|
$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"));
|
$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"));
|
$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')));
|
$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'));
|
$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')));
|
$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"));
|
$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")));
|
$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");
|
$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";
|
$expected = " ORDER BY `Dealer`.`id` = 7 desc, `Dealer`.`id` = 3 desc, `Dealer`.`title` asc";
|
||||||
$this->assertEquals($expected, $result);
|
$this->assertEquals($expected, $result);
|
||||||
|
|
||||||
$result = $this->Dbo->order(array("Page.name" => "='test' DESC"));
|
$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");
|
$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)");
|
$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");
|
$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");
|
$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");
|
$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");
|
$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");
|
$result = $this->Dbo->order("Anuncio.destaque & 2 DESC");
|
||||||
$expected = ' ORDER BY `Anuncio`.`destaque` & 2 DESC';
|
$expected = ' ORDER BY `Anuncio`.`destaque` & 2 DESC';
|
||||||
|
@ -2978,7 +2978,7 @@ SQL;
|
||||||
*/
|
*/
|
||||||
public function testComplexSortExpression() {
|
public function testComplexSortExpression() {
|
||||||
$result = $this->Dbo->order(array('(Model.field > 100) DESC', 'Model.field ASC'));
|
$result = $this->Dbo->order(array('(Model.field > 100) DESC', 'Model.field ASC'));
|
||||||
$this->assertRegExp("/^\s*ORDER BY\s+\(`Model`\.`field`\s+>\s+100\)\s+DESC,\s+`Model`\.`field`\s+ASC\s*$/", $result);
|
$this->assertMatchesRegularExpression("/^\s*ORDER BY\s+\(`Model`\.`field`\s+>\s+100\)\s+DESC,\s+`Model`\.`field`\s+ASC\s*$/", $result);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -3581,9 +3581,9 @@ SQL;
|
||||||
$conditions = array('distance >=' => 20);
|
$conditions = array('distance >=' => 20);
|
||||||
$result = $this->Dbo->conditions($conditions, true, true, $Article);
|
$result = $this->Dbo->conditions($conditions, true, true, $Article);
|
||||||
|
|
||||||
$this->assertRegExp('/\) >= 20/', $result);
|
$this->assertMatchesRegularExpression('/\) >= 20/', $result);
|
||||||
$this->assertRegExp('/[`\'"]Article[`\'"].[`\'"]latitude[`\'"]/', $result);
|
$this->assertMatchesRegularExpression('/[`\'"]Article[`\'"].[`\'"]latitude[`\'"]/', $result);
|
||||||
$this->assertRegExp('/[`\'"]Article[`\'"].[`\'"]longitude[`\'"]/', $result);
|
$this->assertMatchesRegularExpression('/[`\'"]Article[`\'"].[`\'"]longitude[`\'"]/', $result);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -3625,7 +3625,7 @@ SQL;
|
||||||
);
|
);
|
||||||
$result = $this->Dbo->fields($Article, null, array());
|
$result = $this->Dbo->fields($Article, null, array());
|
||||||
$result = $this->Dbo->fields($Article, $Article->alias, $result);
|
$result = $this->Dbo->fields($Article, $Article->alias, $result);
|
||||||
$this->assertRegExp('/[`\"]User[`\"]\.[`\"]id[`\"] \+ [`\"]User[`\"]\.[`\"]id[`\"]/', $result[7]);
|
$this->assertMatchesRegularExpression('/[`\"]User[`\"]\.[`\"]id[`\"] \+ [`\"]User[`\"]\.[`\"]id[`\"]/', $result[7]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -3667,9 +3667,9 @@ SQL;
|
||||||
$qe = $this->Dbo->endQuote;
|
$qe = $this->Dbo->endQuote;
|
||||||
|
|
||||||
$this->assertEquals("{$qs}Article{$qe}.{$qs}id{$qe}", $result[0]);
|
$this->assertEquals("{$qs}Article{$qe}.{$qs}id{$qe}", $result[0]);
|
||||||
$this->assertRegExp('/Article__distance/', $result[1]);
|
$this->assertMatchesRegularExpression('/Article__distance/', $result[1]);
|
||||||
$this->assertRegExp('/[`\'"]Article[`\'"].[`\'"]latitude[`\'"]/', $result[1]);
|
$this->assertMatchesRegularExpression('/[`\'"]Article[`\'"].[`\'"]latitude[`\'"]/', $result[1]);
|
||||||
$this->assertRegExp('/[`\'"]Article[`\'"].[`\'"]longitude[`\'"]/', $result[1]);
|
$this->assertMatchesRegularExpression('/[`\'"]Article[`\'"].[`\'"]longitude[`\'"]/', $result[1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -567,7 +567,7 @@ class PostgresTest extends CakeTestCase {
|
||||||
$result = $db1->createSchema($schema, 'datatype_tests');
|
$result = $db1->createSchema($schema, 'datatype_tests');
|
||||||
|
|
||||||
$this->assertNotRegExp('/timestamp DEFAULT/', $result);
|
$this->assertNotRegExp('/timestamp DEFAULT/', $result);
|
||||||
$this->assertRegExp('/\"full_length\"\s*text\s.*,/', $result);
|
$this->assertMatchesRegularExpression('/\"full_length\"\s*text\s.*,/', $result);
|
||||||
$this->assertContains('timestamp ,', $result);
|
$this->assertContains('timestamp ,', $result);
|
||||||
$this->assertContains('"huge_int" bigint NOT NULL,', $result);
|
$this->assertContains('"huge_int" bigint NOT NULL,', $result);
|
||||||
|
|
||||||
|
|
|
@ -400,14 +400,14 @@ class SqlserverTest extends CakeTestCase {
|
||||||
'limit' => 5
|
'limit' => 5
|
||||||
));
|
));
|
||||||
$result = $this->db->getLastQuery();
|
$result = $this->db->getLastQuery();
|
||||||
$this->assertRegExp('/^SELECT DISTINCT TOP 5/', $result);
|
$this->assertMatchesRegularExpression('/^SELECT DISTINCT TOP 5/', $result);
|
||||||
|
|
||||||
$this->db->read($this->model, array(
|
$this->db->read($this->model, array(
|
||||||
'fields' => array('DISTINCT SqlserverTestModel.city', 'SqlserverTestModel.country'),
|
'fields' => array('DISTINCT SqlserverTestModel.city', 'SqlserverTestModel.country'),
|
||||||
'limit' => '5'
|
'limit' => '5'
|
||||||
));
|
));
|
||||||
$result = $this->db->getLastQuery();
|
$result = $this->db->getLastQuery();
|
||||||
$this->assertRegExp('/^SELECT DISTINCT TOP 5/', $result);
|
$this->assertMatchesRegularExpression('/^SELECT DISTINCT TOP 5/', $result);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -646,8 +646,8 @@ class SqlserverTest extends CakeTestCase {
|
||||||
|
|
||||||
$result = $this->db->getLastQuery();
|
$result = $this->db->getLastQuery();
|
||||||
$this->assertNotRegExp('/SqlserverTestModel/', $result);
|
$this->assertNotRegExp('/SqlserverTestModel/', $result);
|
||||||
$this->assertRegExp('/^UPDATE \[sqlserver_test_models\]/', $result);
|
$this->assertMatchesRegularExpression('/^UPDATE \[sqlserver_test_models\]/', $result);
|
||||||
$this->assertRegExp('/SET \[client_id\] = \[client_id\] \+ 1/', $result);
|
$this->assertMatchesRegularExpression('/SET \[client_id\] = \[client_id\] \+ 1/', $result);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -955,15 +955,15 @@ class DboSourceTest extends CakeTestCase {
|
||||||
$this->testDb->showLog();
|
$this->testDb->showLog();
|
||||||
$contents = ob_get_clean();
|
$contents = ob_get_clean();
|
||||||
|
|
||||||
$this->assertRegExp('/Query 1/s', $contents);
|
$this->assertMatchesRegularExpression('/Query 1/s', $contents);
|
||||||
$this->assertRegExp('/Query 2/s', $contents);
|
$this->assertMatchesRegularExpression('/Query 2/s', $contents);
|
||||||
|
|
||||||
ob_start();
|
ob_start();
|
||||||
$this->testDb->showLog(true);
|
$this->testDb->showLog(true);
|
||||||
$contents = ob_get_clean();
|
$contents = ob_get_clean();
|
||||||
|
|
||||||
$this->assertRegExp('/Query 1/s', $contents);
|
$this->assertMatchesRegularExpression('/Query 1/s', $contents);
|
||||||
$this->assertRegExp('/Query 2/s', $contents);
|
$this->assertMatchesRegularExpression('/Query 2/s', $contents);
|
||||||
|
|
||||||
Configure::write('debug', $oldDebug);
|
Configure::write('debug', $oldDebug);
|
||||||
}
|
}
|
||||||
|
|
|
@ -121,7 +121,7 @@ class DigestAuthenticationTest extends CakeTestCase {
|
||||||
$auth = array('user' => 'admin', 'pass' => '1234');
|
$auth = array('user' => 'admin', 'pass' => '1234');
|
||||||
DigestAuthentication::authentication($this->HttpSocket, $auth);
|
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]+"@';
|
$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('auth', $auth['qop']);
|
||||||
$this->assertEquals(2, $auth['nc']);
|
$this->assertEquals(2, $auth['nc']);
|
||||||
}
|
}
|
||||||
|
|
|
@ -635,7 +635,7 @@ class DispatcherTest extends CakeTestCase {
|
||||||
$this->assertSame($test['controller'], 'testcontroller');
|
$this->assertSame($test['controller'], 'testcontroller');
|
||||||
$this->assertSame($test['action'], 'testaction');
|
$this->assertSame($test['action'], 'testaction');
|
||||||
$this->assertSame($test['pass'][0], '1');
|
$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');
|
$this->assertSame($test['pass'][2], '23');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -651,12 +651,12 @@ class DispatcherTest extends CakeTestCase {
|
||||||
$event = new CakeEvent('DispatcherTest', $Dispatcher, array('request' => $test));
|
$event = new CakeEvent('DispatcherTest', $Dispatcher, array('request' => $test));
|
||||||
$Dispatcher->parseParams($event);
|
$Dispatcher->parseParams($event);
|
||||||
|
|
||||||
$this->assertRegExp('/\\A(?:0)\\z/', $test['pass'][0]);
|
$this->assertMatchesRegularExpression('/\\A(?:0)\\z/', $test['pass'][0]);
|
||||||
$this->assertRegExp('/\\A(?:0)\\z/', $test['pass'][1]);
|
$this->assertMatchesRegularExpression('/\\A(?:0)\\z/', $test['pass'][1]);
|
||||||
$this->assertRegExp('/\\A(?:0)\\z/', $test['pass'][2]);
|
$this->assertMatchesRegularExpression('/\\A(?:0)\\z/', $test['pass'][2]);
|
||||||
$this->assertRegExp('/\\A(?:0)\\z/', $test['pass'][3]);
|
$this->assertMatchesRegularExpression('/\\A(?:0)\\z/', $test['pass'][3]);
|
||||||
$this->assertRegExp('/\\A(?:0)\\z/', $test['pass'][4]);
|
$this->assertMatchesRegularExpression('/\\A(?:0)\\z/', $test['pass'][4]);
|
||||||
$this->assertRegExp('/\\A(?:0)\\z/', $test['pass'][5]);
|
$this->assertMatchesRegularExpression('/\\A(?:0)\\z/', $test['pass'][5]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -671,12 +671,12 @@ class DispatcherTest extends CakeTestCase {
|
||||||
$event = new CakeEvent('DispatcherTest', $Dispatcher, array('request' => $test));
|
$event = new CakeEvent('DispatcherTest', $Dispatcher, array('request' => $test));
|
||||||
$Dispatcher->parseParams($event);
|
$Dispatcher->parseParams($event);
|
||||||
|
|
||||||
$this->assertRegExp('/\\A(?:000)\\z/', $test['pass'][0]);
|
$this->assertMatchesRegularExpression('/\\A(?:000)\\z/', $test['pass'][0]);
|
||||||
$this->assertRegExp('/\\A(?:0000)\\z/', $test['pass'][1]);
|
$this->assertMatchesRegularExpression('/\\A(?:0000)\\z/', $test['pass'][1]);
|
||||||
$this->assertRegExp('/\\A(?:00000)\\z/', $test['pass'][2]);
|
$this->assertMatchesRegularExpression('/\\A(?:00000)\\z/', $test['pass'][2]);
|
||||||
$this->assertRegExp('/\\A(?:000000)\\z/', $test['pass'][3]);
|
$this->assertMatchesRegularExpression('/\\A(?:000000)\\z/', $test['pass'][3]);
|
||||||
$this->assertRegExp('/\\A(?:000000)\\z/', $test['pass'][4]);
|
$this->assertMatchesRegularExpression('/\\A(?:000000)\\z/', $test['pass'][4]);
|
||||||
$this->assertRegExp('/\\A(?:0000000)\\z/', $test['pass'][5]);
|
$this->assertMatchesRegularExpression('/\\A(?:0000000)\\z/', $test['pass'][5]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -691,12 +691,12 @@ class DispatcherTest extends CakeTestCase {
|
||||||
$event = new CakeEvent('DispatcherTest', $Dispatcher, array('request' => $test));
|
$event = new CakeEvent('DispatcherTest', $Dispatcher, array('request' => $test));
|
||||||
$Dispatcher->parseParams($event);
|
$Dispatcher->parseParams($event);
|
||||||
|
|
||||||
$this->assertRegExp('/\\A(?:01)\\z/', $test['pass'][0]);
|
$this->assertMatchesRegularExpression('/\\A(?:01)\\z/', $test['pass'][0]);
|
||||||
$this->assertRegExp('/\\A(?:0403)\\z/', $test['pass'][1]);
|
$this->assertMatchesRegularExpression('/\\A(?:0403)\\z/', $test['pass'][1]);
|
||||||
$this->assertRegExp('/\\A(?:04010)\\z/', $test['pass'][2]);
|
$this->assertMatchesRegularExpression('/\\A(?:04010)\\z/', $test['pass'][2]);
|
||||||
$this->assertRegExp('/\\A(?:000002)\\z/', $test['pass'][3]);
|
$this->assertMatchesRegularExpression('/\\A(?:000002)\\z/', $test['pass'][3]);
|
||||||
$this->assertRegExp('/\\A(?:000030)\\z/', $test['pass'][4]);
|
$this->assertMatchesRegularExpression('/\\A(?:000030)\\z/', $test['pass'][4]);
|
||||||
$this->assertRegExp('/\\A(?:0000400)\\z/', $test['pass'][5]);
|
$this->assertMatchesRegularExpression('/\\A(?:0000400)\\z/', $test['pass'][5]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -718,8 +718,8 @@ class DispatcherTest extends CakeTestCase {
|
||||||
$event = new CakeEvent('DispatcherTest', $Dispatcher, array('request' => $request));
|
$event = new CakeEvent('DispatcherTest', $Dispatcher, array('request' => $request));
|
||||||
$Dispatcher->parseParams($event);
|
$Dispatcher->parseParams($event);
|
||||||
|
|
||||||
$this->assertRegExp('/posts/', $request['controller']);
|
$this->assertMatchesRegularExpression('/posts/', $request['controller']);
|
||||||
$this->assertRegExp('/home/', $request['action']);
|
$this->assertMatchesRegularExpression('/home/', $request['action']);
|
||||||
$this->assertTrue(isset($request['url']['sleep']));
|
$this->assertTrue(isset($request['url']['sleep']));
|
||||||
$this->assertTrue(isset($request['url']['coffee']));
|
$this->assertTrue(isset($request['url']['coffee']));
|
||||||
|
|
||||||
|
@ -728,8 +728,8 @@ class DispatcherTest extends CakeTestCase {
|
||||||
|
|
||||||
$event = new CakeEvent('DispatcherTest', $Dispatcher, array('request' => $request));
|
$event = new CakeEvent('DispatcherTest', $Dispatcher, array('request' => $request));
|
||||||
$Dispatcher->parseParams($event);
|
$Dispatcher->parseParams($event);
|
||||||
$this->assertRegExp('/pages/', $request['controller']);
|
$this->assertMatchesRegularExpression('/pages/', $request['controller']);
|
||||||
$this->assertRegExp('/display/', $request['action']);
|
$this->assertMatchesRegularExpression('/display/', $request['action']);
|
||||||
$this->assertTrue(isset($request['url']['sleep']));
|
$this->assertTrue(isset($request['url']['sleep']));
|
||||||
$this->assertTrue(isset($request['url']['coffee']));
|
$this->assertTrue(isset($request['url']['coffee']));
|
||||||
$this->assertEquals('life', $request['url']['coffee']);
|
$this->assertEquals('life', $request['url']['coffee']);
|
||||||
|
|
|
@ -65,16 +65,16 @@ class CakeRouteTest extends CakeTestCase {
|
||||||
$route = new CakeRoute('/:controller/:action', array('controller' => 'posts'));
|
$route = new CakeRoute('/:controller/:action', array('controller' => 'posts'));
|
||||||
$result = $route->compile();
|
$result = $route->compile();
|
||||||
|
|
||||||
$this->assertRegExp($result, '/posts/edit');
|
$this->assertMatchesRegularExpression($result, '/posts/edit');
|
||||||
$this->assertRegExp($result, '/posts/super_delete');
|
$this->assertMatchesRegularExpression($result, '/posts/super_delete');
|
||||||
$this->assertNotRegExp($result, '/posts');
|
$this->assertNotRegExp($result, '/posts');
|
||||||
$this->assertNotRegExp($result, '/posts/super_delete/1');
|
$this->assertNotRegExp($result, '/posts/super_delete/1');
|
||||||
|
|
||||||
$route = new CakeRoute('/posts/foo:id', array('controller' => 'posts', 'action' => 'view'));
|
$route = new CakeRoute('/posts/foo:id', array('controller' => 'posts', 'action' => 'view'));
|
||||||
$result = $route->compile();
|
$result = $route->compile();
|
||||||
|
|
||||||
$this->assertRegExp($result, '/posts/foo:1');
|
$this->assertMatchesRegularExpression($result, '/posts/foo:1');
|
||||||
$this->assertRegExp($result, '/posts/foo:param');
|
$this->assertMatchesRegularExpression($result, '/posts/foo:param');
|
||||||
$this->assertNotRegExp($result, '/posts');
|
$this->assertNotRegExp($result, '/posts');
|
||||||
$this->assertNotRegExp($result, '/posts/');
|
$this->assertNotRegExp($result, '/posts/');
|
||||||
|
|
||||||
|
@ -82,9 +82,9 @@ class CakeRouteTest extends CakeTestCase {
|
||||||
|
|
||||||
$route = new CakeRoute('/:plugin/:controller/:action/*', array('plugin' => 'test_plugin', 'action' => 'index'));
|
$route = new CakeRoute('/:plugin/:controller/:action/*', array('plugin' => 'test_plugin', 'action' => 'index'));
|
||||||
$result = $route->compile();
|
$result = $route->compile();
|
||||||
$this->assertRegExp($result, '/test_plugin/posts/index');
|
$this->assertMatchesRegularExpression($result, '/test_plugin/posts/index');
|
||||||
$this->assertRegExp($result, '/test_plugin/posts/edit/5');
|
$this->assertMatchesRegularExpression($result, '/test_plugin/posts/edit/5');
|
||||||
$this->assertRegExp($result, '/test_plugin/posts/edit/5/name:value/nick:name');
|
$this->assertMatchesRegularExpression($result, '/test_plugin/posts/edit/5/name:value/nick:name');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -95,11 +95,11 @@ class CakeRouteTest extends CakeTestCase {
|
||||||
public function testRouteParameterOverlap() {
|
public function testRouteParameterOverlap() {
|
||||||
$route = new CakeRoute('/invoices/add/:idd/:id', array('controller' => 'invoices', 'action' => 'add'));
|
$route = new CakeRoute('/invoices/add/:idd/:id', array('controller' => 'invoices', 'action' => 'add'));
|
||||||
$result = $route->compile();
|
$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'));
|
$route = new CakeRoute('/invoices/add/:id/:idd', array('controller' => 'invoices', 'action' => 'add'));
|
||||||
$result = $route->compile();
|
$result = $route->compile();
|
||||||
$this->assertRegExp($result, '/invoices/add/1/3');
|
$this->assertMatchesRegularExpression($result, '/invoices/add/1/3');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -114,8 +114,8 @@ class CakeRouteTest extends CakeTestCase {
|
||||||
array('id' => Router::ID)
|
array('id' => Router::ID)
|
||||||
);
|
);
|
||||||
$result = $route->compile();
|
$result = $route->compile();
|
||||||
$this->assertRegExp($result, '/posts/edit/1');
|
$this->assertMatchesRegularExpression($result, '/posts/edit/1');
|
||||||
$this->assertRegExp($result, '/posts/view/518098');
|
$this->assertMatchesRegularExpression($result, '/posts/view/518098');
|
||||||
$this->assertNotRegExp($result, '/posts/edit/name-of-post');
|
$this->assertNotRegExp($result, '/posts/edit/name-of-post');
|
||||||
$this->assertNotRegExp($result, '/posts/edit/4/other:param');
|
$this->assertNotRegExp($result, '/posts/edit/4/other:param');
|
||||||
$this->assertEquals(array('id', 'controller', 'action'), $route->keys);
|
$this->assertEquals(array('id', 'controller', 'action'), $route->keys);
|
||||||
|
@ -126,8 +126,8 @@ class CakeRouteTest extends CakeTestCase {
|
||||||
array('id' => Router::ID, 'lang' => '[a-z]{3}')
|
array('id' => Router::ID, 'lang' => '[a-z]{3}')
|
||||||
);
|
);
|
||||||
$result = $route->compile();
|
$result = $route->compile();
|
||||||
$this->assertRegExp($result, '/eng/posts/edit/1');
|
$this->assertMatchesRegularExpression($result, '/eng/posts/edit/1');
|
||||||
$this->assertRegExp($result, '/cze/articles/view/1');
|
$this->assertMatchesRegularExpression($result, '/cze/articles/view/1');
|
||||||
$this->assertNotRegExp($result, '/language/articles/view/2');
|
$this->assertNotRegExp($result, '/language/articles/view/2');
|
||||||
$this->assertNotRegExp($result, '/eng/articles/view/name-of-article');
|
$this->assertNotRegExp($result, '/eng/articles/view/name-of-article');
|
||||||
$this->assertEquals(array('lang', 'id', 'controller', 'action'), $route->keys);
|
$this->assertEquals(array('lang', 'id', 'controller', 'action'), $route->keys);
|
||||||
|
@ -136,8 +136,8 @@ class CakeRouteTest extends CakeTestCase {
|
||||||
$route = new CakeRoute('/posts/:id' . $delim . ':title');
|
$route = new CakeRoute('/posts/:id' . $delim . ':title');
|
||||||
$result = $route->compile();
|
$result = $route->compile();
|
||||||
|
|
||||||
$this->assertRegExp($result, '/posts/1' . $delim . 'name-of-article');
|
$this->assertMatchesRegularExpression($result, '/posts/1' . $delim . 'name-of-article');
|
||||||
$this->assertRegExp($result, '/posts/13244' . $delim . 'name-of_Article[]');
|
$this->assertMatchesRegularExpression($result, '/posts/13244' . $delim . 'name-of_Article[]');
|
||||||
$this->assertNotRegExp($result, '/posts/11!nameofarticle');
|
$this->assertNotRegExp($result, '/posts/11!nameofarticle');
|
||||||
$this->assertNotRegExp($result, '/posts/11');
|
$this->assertNotRegExp($result, '/posts/11');
|
||||||
|
|
||||||
|
@ -150,8 +150,8 @@ class CakeRouteTest extends CakeTestCase {
|
||||||
array('id' => Router::ID, 'year' => Router::YEAR, 'title' => '[a-z-_]+')
|
array('id' => Router::ID, 'year' => Router::YEAR, 'title' => '[a-z-_]+')
|
||||||
);
|
);
|
||||||
$result = $route->compile();
|
$result = $route->compile();
|
||||||
$this->assertRegExp($result, '/posts/1:name-of-article/2009/');
|
$this->assertMatchesRegularExpression($result, '/posts/1:name-of-article/2009/');
|
||||||
$this->assertRegExp($result, '/posts/13244:name-of-article/1999');
|
$this->assertMatchesRegularExpression($result, '/posts/13244:name-of-article/1999');
|
||||||
$this->assertNotRegExp($result, '/posts/hey_now:nameofarticle');
|
$this->assertNotRegExp($result, '/posts/hey_now:nameofarticle');
|
||||||
$this->assertNotRegExp($result, '/posts/:nameofarticle/2009');
|
$this->assertNotRegExp($result, '/posts/:nameofarticle/2009');
|
||||||
$this->assertNotRegExp($result, '/posts/:nameofarticle/01');
|
$this->assertNotRegExp($result, '/posts/:nameofarticle/01');
|
||||||
|
@ -163,8 +163,8 @@ class CakeRouteTest extends CakeTestCase {
|
||||||
array('pass' => array('id', 'url_title'), 'id' => Router::ID)
|
array('pass' => array('id', 'url_title'), 'id' => Router::ID)
|
||||||
);
|
);
|
||||||
$result = $route->compile();
|
$result = $route->compile();
|
||||||
$this->assertRegExp($result, '/posts/some_title_for_article-(uuid:12534)/');
|
$this->assertMatchesRegularExpression($result, '/posts/some_title_for_article-(uuid:12534)/');
|
||||||
$this->assertRegExp($result, '/posts/some_title_for_article-(uuid:12534)');
|
$this->assertMatchesRegularExpression($result, '/posts/some_title_for_article-(uuid:12534)');
|
||||||
$this->assertNotRegExp($result, '/posts/');
|
$this->assertNotRegExp($result, '/posts/');
|
||||||
$this->assertNotRegExp($result, '/posts/nameofarticle');
|
$this->assertNotRegExp($result, '/posts/nameofarticle');
|
||||||
$this->assertNotRegExp($result, '/posts/nameofarticle-12347');
|
$this->assertNotRegExp($result, '/posts/nameofarticle-12347');
|
||||||
|
@ -184,7 +184,7 @@ class CakeRouteTest extends CakeTestCase {
|
||||||
array('year' => Router::YEAR, 'month' => Router::MONTH, 'day' => Router::DAY)
|
array('year' => Router::YEAR, 'month' => Router::MONTH, 'day' => Router::DAY)
|
||||||
);
|
);
|
||||||
$result = $route->compile();
|
$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');
|
$result = $route->parse('/posts/08/01/2007/title-of-post');
|
||||||
|
|
||||||
$this->assertEquals(7, count($result));
|
$this->assertEquals(7, count($result));
|
||||||
|
@ -202,8 +202,8 @@ class CakeRouteTest extends CakeTestCase {
|
||||||
);
|
);
|
||||||
$result = $route->compile();
|
$result = $route->compile();
|
||||||
|
|
||||||
$this->assertRegExp($result, '/some_extra/page/this_is_the_slug');
|
$this->assertMatchesRegularExpression($result, '/some_extra/page/this_is_the_slug');
|
||||||
$this->assertRegExp($result, '/page/this_is_the_slug');
|
$this->assertMatchesRegularExpression($result, '/page/this_is_the_slug');
|
||||||
$this->assertEquals(array('slug', 'extra'), $route->keys);
|
$this->assertEquals(array('slug', 'extra'), $route->keys);
|
||||||
$this->assertEquals(array('extra' => '[a-z1-9_]*', 'slug' => '[a-z1-9_]+', 'action' => 'view'), $route->options);
|
$this->assertEquals(array('extra' => '[a-z1-9_]*', 'slug' => '[a-z1-9_]+', 'action' => 'view'), $route->options);
|
||||||
$expected = array(
|
$expected = array(
|
||||||
|
@ -224,8 +224,8 @@ class CakeRouteTest extends CakeTestCase {
|
||||||
|
|
||||||
$result = $route->compile();
|
$result = $route->compile();
|
||||||
$this->assertNotRegExp($result, '/some_project/source');
|
$this->assertNotRegExp($result, '/some_project/source');
|
||||||
$this->assertRegExp($result, '/source/view');
|
$this->assertMatchesRegularExpression($result, '/source/view');
|
||||||
$this->assertRegExp($result, '/source/view/other/params');
|
$this->assertMatchesRegularExpression($result, '/source/view/other/params');
|
||||||
$this->assertNotRegExp($result, '/chaw_test/wiki');
|
$this->assertNotRegExp($result, '/chaw_test/wiki');
|
||||||
$this->assertNotRegExp($result, '/source/wierd_action');
|
$this->assertNotRegExp($result, '/source/wierd_action');
|
||||||
}
|
}
|
||||||
|
|
|
@ -58,9 +58,9 @@ class RouterTest extends CakeTestCase {
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function testFullBaseUrl() {
|
public function testFullBaseUrl() {
|
||||||
$this->assertRegExp('/^http(s)?:\/\//', Router::url('/', true));
|
$this->assertMatchesRegularExpression('/^http(s)?:\/\//', Router::url('/', true));
|
||||||
$this->assertRegExp('/^http(s)?:\/\//', Router::url(null, true));
|
$this->assertMatchesRegularExpression('/^http(s)?:\/\//', Router::url(null, true));
|
||||||
$this->assertRegExp('/^http(s)?:\/\//', Router::url(array('full_base' => true)));
|
$this->assertMatchesRegularExpression('/^http(s)?:\/\//', Router::url(array('full_base' => true)));
|
||||||
$this->assertSame(FULL_BASE_URL . '/', Router::url(array('full_base' => true)));
|
$this->assertSame(FULL_BASE_URL . '/', Router::url(array('full_base' => true)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2551,7 +2551,7 @@ class RouterTest extends CakeTestCase {
|
||||||
'url' => array('url' => 'eng/posts/view/1'),
|
'url' => array('url' => 'eng/posts/view/1'),
|
||||||
);
|
);
|
||||||
$result = Router::reverse($params, true);
|
$result = Router::reverse($params, true);
|
||||||
$this->assertRegExp('/^http(s)?:\/\//', $result);
|
$this->assertMatchesRegularExpression('/^http(s)?:\/\//', $result);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testReverseToArrayNamed() {
|
public function testReverseToArrayNamed() {
|
||||||
|
|
|
@ -332,7 +332,7 @@ class ControllerTestCaseTest extends CakeTestCase {
|
||||||
$this->assertEquals($expected, $results);
|
$this->assertEquals($expected, $results);
|
||||||
|
|
||||||
$result = $this->Case->controller->response->body();
|
$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');
|
$Controller = $this->Case->generate('TestsApps');
|
||||||
$this->Case->testAction('/tests_apps/redirect_to');
|
$this->Case->testAction('/tests_apps/redirect_to');
|
||||||
|
@ -439,9 +439,9 @@ class ControllerTestCaseTest extends CakeTestCase {
|
||||||
$result = $this->Case->testAction('/tests_apps/set_action', array(
|
$result = $this->Case->testAction('/tests_apps/set_action', array(
|
||||||
'return' => 'contents'
|
'return' => 'contents'
|
||||||
));
|
));
|
||||||
$this->assertRegExp('/<html/', $result);
|
$this->assertMatchesRegularExpression('/<html/', $result);
|
||||||
$this->assertRegExp('/This is the TestsAppsController index view/', $result);
|
$this->assertMatchesRegularExpression('/This is the TestsAppsController index view/', $result);
|
||||||
$this->assertRegExp('/<\/html>/', $result);
|
$this->assertMatchesRegularExpression('/<\/html>/', $result);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -585,9 +585,9 @@ class ControllerTestCaseTest extends CakeTestCase {
|
||||||
$result = $this->Case->testAction('/tests_apps/set_action', array(
|
$result = $this->Case->testAction('/tests_apps/set_action', array(
|
||||||
'return' => 'contents'
|
'return' => 'contents'
|
||||||
));
|
));
|
||||||
$this->assertRegExp('/<html/', $result);
|
$this->assertMatchesRegularExpression('/<html/', $result);
|
||||||
$this->assertRegExp('/This is the TestsAppsController index view/', $result);
|
$this->assertMatchesRegularExpression('/This is the TestsAppsController index view/', $result);
|
||||||
$this->assertRegExp('/<\/html>/', $result);
|
$this->assertMatchesRegularExpression('/<\/html>/', $result);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -118,9 +118,9 @@ class HtmlCoverageReportTest extends CakeTestCase {
|
||||||
10 => array(array('id' => 'HtmlCoverageReportTest::testGenerateDiff'))
|
10 => array(array('id' => 'HtmlCoverageReportTest::testGenerateDiff'))
|
||||||
);
|
);
|
||||||
$result = $this->Coverage->generateDiff('myfile.php', $file, $coverage);
|
$result = $this->Coverage->generateDiff('myfile.php', $file, $coverage);
|
||||||
$this->assertRegExp('/myfile\.php Code coverage\: \d+\.?\d*\%/', $result);
|
$this->assertMatchesRegularExpression('/myfile\.php Code coverage\: \d+\.?\d*\%/', $result);
|
||||||
$this->assertRegExp('/<div class="code-coverage-results" id\="coverage\-myfile\.php-' . md5('myfile.php') . '"/', $result);
|
$this->assertMatchesRegularExpression('/<div class="code-coverage-results" id\="coverage\-myfile\.php-' . md5('myfile.php') . '"/', $result);
|
||||||
$this->assertRegExp('/<pre>/', $result);
|
$this->assertMatchesRegularExpression('/<pre>/', $result);
|
||||||
foreach ($file as $i => $line) {
|
foreach ($file as $i => $line) {
|
||||||
$this->assertTrue(strpos($line, $result) !== 0, 'Content is missing ' . $i);
|
$this->assertTrue(strpos($line, $result) !== 0, 'Content is missing ' . $i);
|
||||||
$class = 'covered';
|
$class = 'covered';
|
||||||
|
@ -166,9 +166,9 @@ class HtmlCoverageReportTest extends CakeTestCase {
|
||||||
);
|
);
|
||||||
|
|
||||||
$result = $this->Coverage->generateDiff('myfile.php', $file, $coverage);
|
$result = $this->Coverage->generateDiff('myfile.php', $file, $coverage);
|
||||||
$this->assertRegExp('/myfile\.php Code coverage\: \d+\.?\d*\%/', $result);
|
$this->assertMatchesRegularExpression('/myfile\.php Code coverage\: \d+\.?\d*\%/', $result);
|
||||||
$this->assertRegExp('/<div class="code-coverage-results" id\="coverage\-myfile\.php-' . md5('myfile.php') . '"/', $result);
|
$this->assertMatchesRegularExpression('/<div class="code-coverage-results" id\="coverage\-myfile\.php-' . md5('myfile.php') . '"/', $result);
|
||||||
$this->assertRegExp('/<pre>/', $result);
|
$this->assertMatchesRegularExpression('/<pre>/', $result);
|
||||||
foreach ($file as $i => $line) {
|
foreach ($file as $i => $line) {
|
||||||
$this->assertTrue(strpos($line, $result) !== 0, 'Content is missing ' . $i);
|
$this->assertTrue(strpos($line, $result) !== 0, 'Content is missing ' . $i);
|
||||||
$class = 'covered';
|
$class = 'covered';
|
||||||
|
|
|
@ -285,13 +285,13 @@ class CakeTimeTest extends CakeTestCase {
|
||||||
strtotime('+2 weeks +2 days'),
|
strtotime('+2 weeks +2 days'),
|
||||||
'Y-m-d'
|
'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(
|
$result = $this->Time->timeAgoInWords(
|
||||||
strtotime('+2 weeks +2 days'),
|
strtotime('+2 weeks +2 days'),
|
||||||
'%x'
|
'%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(
|
$result = $this->Time->timeAgoInWords(
|
||||||
strtotime('+2 months +2 days'),
|
strtotime('+2 months +2 days'),
|
||||||
|
|
|
@ -80,20 +80,20 @@ class DebuggerTest extends CakeTestCase {
|
||||||
$result = Debugger::excerpt(__FILE__, __LINE__, 2);
|
$result = Debugger::excerpt(__FILE__, __LINE__, 2);
|
||||||
$this->assertTrue(is_array($result));
|
$this->assertTrue(is_array($result));
|
||||||
$this->assertEquals(5, count($result));
|
$this->assertEquals(5, count($result));
|
||||||
$this->assertRegExp('/function(.+)testExcerpt/', $result[1]);
|
$this->assertMatchesRegularExpression('/function(.+)testExcerpt/', $result[1]);
|
||||||
|
|
||||||
$result = Debugger::excerpt(__FILE__, 2, 2);
|
$result = Debugger::excerpt(__FILE__, 2, 2);
|
||||||
$this->assertTrue(is_array($result));
|
$this->assertTrue(is_array($result));
|
||||||
$this->assertEquals(4, count($result));
|
$this->assertEquals(4, count($result));
|
||||||
|
|
||||||
$pattern = '/<code>.*?<span style\="color\: \#\d+">.*?<\?php/';
|
$pattern = '/<code>.*?<span style\="color\: \#\d+">.*?<\?php/';
|
||||||
$this->assertRegExp($pattern, $result[0]);
|
$this->assertMatchesRegularExpression($pattern, $result[0]);
|
||||||
|
|
||||||
$result = Debugger::excerpt(__FILE__, 11, 2);
|
$result = Debugger::excerpt(__FILE__, 11, 2);
|
||||||
$this->assertEquals(5, count($result));
|
$this->assertEquals(5, count($result));
|
||||||
|
|
||||||
$pattern = '/<span style\="color\: \#\d{6}">\*<\/span>/';
|
$pattern = '/<span style\="color\: \#\d{6}">\*<\/span>/';
|
||||||
$this->assertRegExp($pattern, $result[0]);
|
$this->assertMatchesRegularExpression($pattern, $result[0]);
|
||||||
|
|
||||||
$return = Debugger::excerpt('[internal]', 2, 2);
|
$return = Debugger::excerpt('[internal]', 2, 2);
|
||||||
$this->assertTrue(empty($return));
|
$this->assertTrue(empty($return));
|
||||||
|
@ -114,25 +114,25 @@ class DebuggerTest extends CakeTestCase {
|
||||||
$result = Debugger::output(true);
|
$result = Debugger::output(true);
|
||||||
|
|
||||||
$this->assertEquals('Notice', $result[0]['error']);
|
$this->assertEquals('Notice', $result[0]['error']);
|
||||||
$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();
|
ob_start();
|
||||||
Debugger::output('txt');
|
Debugger::output('txt');
|
||||||
$other .= '';
|
$other .= '';
|
||||||
$result = ob_get_clean();
|
$result = ob_get_clean();
|
||||||
|
|
||||||
$this->assertRegExp('/Undefined variable:\s+other/', $result);
|
$this->assertMatchesRegularExpression('/Undefined variable:\s+other/', $result);
|
||||||
$this->assertRegExp('/Context:/', $result);
|
$this->assertMatchesRegularExpression('/Context:/', $result);
|
||||||
$this->assertRegExp('/DebuggerTest::testOutput/i', $result);
|
$this->assertMatchesRegularExpression('/DebuggerTest::testOutput/i', $result);
|
||||||
|
|
||||||
ob_start();
|
ob_start();
|
||||||
Debugger::output('html');
|
Debugger::output('html');
|
||||||
$wrong .= '';
|
$wrong .= '';
|
||||||
$result = ob_get_clean();
|
$result = ob_get_clean();
|
||||||
$this->assertRegExp('/<pre class="cake-error">.+<\/pre>/', $result);
|
$this->assertMatchesRegularExpression('/<pre class="cake-error">.+<\/pre>/', $result);
|
||||||
$this->assertRegExp('/<b>Notice<\/b>/', $result);
|
$this->assertMatchesRegularExpression('/<b>Notice<\/b>/', $result);
|
||||||
$this->assertRegExp('/variable:\s+wrong/', $result);
|
$this->assertMatchesRegularExpression('/variable:\s+wrong/', $result);
|
||||||
|
|
||||||
ob_start();
|
ob_start();
|
||||||
Debugger::output('js');
|
Debugger::output('js');
|
||||||
|
@ -149,9 +149,9 @@ class DebuggerTest extends CakeTestCase {
|
||||||
'b' => array(), 'Notice', '/b', ' (8)',
|
'b' => array(), 'Notice', '/b', ' (8)',
|
||||||
));
|
));
|
||||||
|
|
||||||
$this->assertRegExp('/Undefined variable:\s+buzz/', $result[1]);
|
$this->assertMatchesRegularExpression('/Undefined variable:\s+buzz/', $result[1]);
|
||||||
$this->assertRegExp('/<a[^>]+>Code/', $result[1]);
|
$this->assertMatchesRegularExpression('/<a[^>]+>Code/', $result[1]);
|
||||||
$this->assertRegExp('/<a[^>]+>Context/', $result[2]);
|
$this->assertMatchesRegularExpression('/<a[^>]+>Context/', $result[2]);
|
||||||
$this->assertContains('$wrong = ''', $result[3], 'Context should be HTML escaped.');
|
$this->assertContains('$wrong = ''', $result[3], 'Context should be HTML escaped.');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -187,7 +187,7 @@ class DebuggerTest extends CakeTestCase {
|
||||||
'&line={:line}">{:path}</a>, line {:line}'
|
'&line={:line}">{:path}</a>, line {:line}'
|
||||||
));
|
));
|
||||||
$result = Debugger::trace();
|
$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(
|
Debugger::output('xml', array(
|
||||||
'error' => '<error><code>{:code}</code><file>{:file}</file><line>{:line}</line>' .
|
'error' => '<error><code>{:code}</code><file>{:file}</file><line>{:line}</line>' .
|
||||||
|
@ -248,7 +248,7 @@ class DebuggerTest extends CakeTestCase {
|
||||||
Debugger::outputAs('js');
|
Debugger::outputAs('js');
|
||||||
|
|
||||||
$result = Debugger::trace();
|
$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(
|
Debugger::addFormat('xml', array(
|
||||||
'error' => '<error><code>{:code}</code><file>{:file}</file><line>{:line}</line>' .
|
'error' => '<error><code>{:code}</code><file>{:file}</file><line>{:line}</line>' .
|
||||||
|
@ -641,7 +641,7 @@ TEXT;
|
||||||
*/
|
*/
|
||||||
public function testTraceExclude() {
|
public function testTraceExclude() {
|
||||||
$result = Debugger::trace();
|
$result = Debugger::trace();
|
||||||
$this->assertRegExp('/^DebuggerTest::testTraceExclude/', $result);
|
$this->assertMatchesRegularExpression('/^DebuggerTest::testTraceExclude/', $result);
|
||||||
|
|
||||||
$result = Debugger::trace(array(
|
$result = Debugger::trace(array(
|
||||||
'exclude' => array('DebuggerTest::testTraceExclude')
|
'exclude' => array('DebuggerTest::testTraceExclude')
|
||||||
|
|
|
@ -125,9 +125,9 @@ class CacheHelperTest extends CakeTestCase {
|
||||||
$this->assertTrue(file_exists($filename));
|
$this->assertTrue(file_exists($filename));
|
||||||
|
|
||||||
$contents = file_get_contents($filename);
|
$contents = file_get_contents($filename);
|
||||||
$this->assertRegExp('/php echo \$variable/', $contents);
|
$this->assertMatchesRegularExpression('/php echo \$variable/', $contents);
|
||||||
$this->assertRegExp('/php echo microtime()/', $contents);
|
$this->assertMatchesRegularExpression('/php echo microtime()/', $contents);
|
||||||
$this->assertRegExp('/clark kent/', $result);
|
$this->assertMatchesRegularExpression('/clark kent/', $result);
|
||||||
|
|
||||||
unlink($filename);
|
unlink($filename);
|
||||||
}
|
}
|
||||||
|
@ -184,9 +184,9 @@ class CacheHelperTest extends CakeTestCase {
|
||||||
$this->assertTrue(file_exists($filename));
|
$this->assertTrue(file_exists($filename));
|
||||||
|
|
||||||
$contents = file_get_contents($filename);
|
$contents = file_get_contents($filename);
|
||||||
$this->assertRegExp('/if \(is_writable\(TMP\)\)\:/', $contents);
|
$this->assertMatchesRegularExpression('/if \(is_writable\(TMP\)\)\:/', $contents);
|
||||||
$this->assertRegExp('/php echo \$variable/', $contents);
|
$this->assertMatchesRegularExpression('/php echo \$variable/', $contents);
|
||||||
$this->assertRegExp('/php echo microtime()/', $contents);
|
$this->assertMatchesRegularExpression('/php echo microtime()/', $contents);
|
||||||
$this->assertNotRegExp('/cake:nocache/', $contents);
|
$this->assertNotRegExp('/cake:nocache/', $contents);
|
||||||
|
|
||||||
unlink($filename);
|
unlink($filename);
|
||||||
|
@ -247,13 +247,13 @@ class CacheHelperTest extends CakeTestCase {
|
||||||
|
|
||||||
$this->assertNotRegExp('/cake:nocache/', $result);
|
$this->assertNotRegExp('/cake:nocache/', $result);
|
||||||
$this->assertNotRegExp('/php echo/', $result);
|
$this->assertNotRegExp('/php echo/', $result);
|
||||||
$this->assertRegExp('/A\. Layout Before Content/', $result);
|
$this->assertMatchesRegularExpression('/A\. Layout Before Content/', $result);
|
||||||
$this->assertRegExp('/B\. In Plain Element/', $result);
|
$this->assertMatchesRegularExpression('/B\. In Plain Element/', $result);
|
||||||
$this->assertRegExp('/C\. Layout After Test Element/', $result);
|
$this->assertMatchesRegularExpression('/C\. Layout After Test Element/', $result);
|
||||||
$this->assertRegExp('/D\. In View File/', $result);
|
$this->assertMatchesRegularExpression('/D\. In View File/', $result);
|
||||||
$this->assertRegExp('/E\. Layout After Content/', $result);
|
$this->assertMatchesRegularExpression('/E\. Layout After Content/', $result);
|
||||||
$this->assertRegExp('/F\. In Element With No Cache Tags/', $result);
|
$this->assertMatchesRegularExpression('/F\. In Element With No Cache Tags/', $result);
|
||||||
$this->assertRegExp('/G\. Layout After Content And After Element With No Cache Tags/', $result);
|
$this->assertMatchesRegularExpression('/G\. Layout After Content And After Element With No Cache Tags/', $result);
|
||||||
$this->assertNotRegExp('/1\. layout before content/', $result);
|
$this->assertNotRegExp('/1\. layout before content/', $result);
|
||||||
$this->assertNotRegExp('/2\. in plain element/', $result);
|
$this->assertNotRegExp('/2\. in plain element/', $result);
|
||||||
$this->assertNotRegExp('/3\. layout after test element/', $result);
|
$this->assertNotRegExp('/3\. layout after test element/', $result);
|
||||||
|
@ -267,20 +267,20 @@ class CacheHelperTest extends CakeTestCase {
|
||||||
$contents = file_get_contents($filename);
|
$contents = file_get_contents($filename);
|
||||||
unlink($filename);
|
unlink($filename);
|
||||||
|
|
||||||
$this->assertRegExp('/A\. Layout Before Content/', $contents);
|
$this->assertMatchesRegularExpression('/A\. Layout Before Content/', $contents);
|
||||||
$this->assertNotRegExp('/B\. In Plain Element/', $contents);
|
$this->assertNotRegExp('/B\. In Plain Element/', $contents);
|
||||||
$this->assertRegExp('/C\. Layout After Test Element/', $contents);
|
$this->assertMatchesRegularExpression('/C\. Layout After Test Element/', $contents);
|
||||||
$this->assertRegExp('/D\. In View File/', $contents);
|
$this->assertMatchesRegularExpression('/D\. In View File/', $contents);
|
||||||
$this->assertRegExp('/E\. Layout After Content/', $contents);
|
$this->assertMatchesRegularExpression('/E\. Layout After Content/', $contents);
|
||||||
$this->assertRegExp('/F\. In Element With No Cache Tags/', $contents);
|
$this->assertMatchesRegularExpression('/F\. In Element With No Cache Tags/', $contents);
|
||||||
$this->assertRegExp('/G\. Layout After Content And After Element With No Cache Tags/', $contents);
|
$this->assertMatchesRegularExpression('/G\. Layout After Content And After Element With No Cache Tags/', $contents);
|
||||||
$this->assertRegExp('/1\. layout before content/', $contents);
|
$this->assertMatchesRegularExpression('/1\. layout before content/', $contents);
|
||||||
$this->assertNotRegExp('/2\. in plain element/', $contents);
|
$this->assertNotRegExp('/2\. in plain element/', $contents);
|
||||||
$this->assertRegExp('/3\. layout after test element/', $contents);
|
$this->assertMatchesRegularExpression('/3\. layout after test element/', $contents);
|
||||||
$this->assertRegExp('/4\. in view file/', $contents);
|
$this->assertMatchesRegularExpression('/4\. in view file/', $contents);
|
||||||
$this->assertRegExp('/5\. layout after content/', $contents);
|
$this->assertMatchesRegularExpression('/5\. layout after content/', $contents);
|
||||||
$this->assertRegExp('/6\. in element with no cache tags/', $contents);
|
$this->assertMatchesRegularExpression('/6\. in element with no cache tags/', $contents);
|
||||||
$this->assertRegExp('/7\. layout after content and after element with no cache tags/', $contents);
|
$this->assertMatchesRegularExpression('/7\. layout after content and after element with no cache tags/', $contents);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -308,9 +308,9 @@ class CacheHelperTest extends CakeTestCase {
|
||||||
$this->assertTrue(file_exists($filename));
|
$this->assertTrue(file_exists($filename));
|
||||||
|
|
||||||
$contents = file_get_contents($filename);
|
$contents = file_get_contents($filename);
|
||||||
$this->assertRegExp('/\$this\-\>viewVars/', $contents);
|
$this->assertMatchesRegularExpression('/\$this\-\>viewVars/', $contents);
|
||||||
$this->assertRegExp('/extract\(\$this\-\>viewVars, EXTR_SKIP\);/', $contents);
|
$this->assertMatchesRegularExpression('/extract\(\$this\-\>viewVars, EXTR_SKIP\);/', $contents);
|
||||||
$this->assertRegExp('/php echo \$variable/', $contents);
|
$this->assertMatchesRegularExpression('/php echo \$variable/', $contents);
|
||||||
|
|
||||||
unlink($filename);
|
unlink($filename);
|
||||||
}
|
}
|
||||||
|
@ -344,7 +344,7 @@ class CacheHelperTest extends CakeTestCase {
|
||||||
|
|
||||||
$contents = file_get_contents($filename);
|
$contents = file_get_contents($filename);
|
||||||
|
|
||||||
$this->assertRegExp('/\$controller->startupProcess\(\);/', $contents);
|
$this->assertMatchesRegularExpression('/\$controller->startupProcess\(\);/', $contents);
|
||||||
|
|
||||||
unlink($filename);
|
unlink($filename);
|
||||||
}
|
}
|
||||||
|
@ -622,7 +622,7 @@ class CacheHelperTest extends CakeTestCase {
|
||||||
$result = $View->render('cache_empty_sections');
|
$result = $View->render('cache_empty_sections');
|
||||||
$this->assertNotRegExp('/nocache/', $result);
|
$this->assertNotRegExp('/nocache/', $result);
|
||||||
$this->assertNotRegExp('/php echo/', $result);
|
$this->assertNotRegExp('/php echo/', $result);
|
||||||
$this->assertRegExp(
|
$this->assertMatchesRegularExpression(
|
||||||
'@</title>\s*</head>\s*' .
|
'@</title>\s*</head>\s*' .
|
||||||
'<body>\s*' .
|
'<body>\s*' .
|
||||||
'View Content\s*' .
|
'View Content\s*' .
|
||||||
|
@ -633,7 +633,7 @@ class CacheHelperTest extends CakeTestCase {
|
||||||
$this->assertTrue(file_exists($filename));
|
$this->assertTrue(file_exists($filename));
|
||||||
$contents = file_get_contents($filename);
|
$contents = file_get_contents($filename);
|
||||||
$this->assertNotRegExp('/nocache/', $contents);
|
$this->assertNotRegExp('/nocache/', $contents);
|
||||||
$this->assertRegExp(
|
$this->assertMatchesRegularExpression(
|
||||||
'@<head>\s*<title>Posts</title>\s*' .
|
'@<head>\s*<title>Posts</title>\s*' .
|
||||||
'<\?php \$x \= 1; \?>\s*' .
|
'<\?php \$x \= 1; \?>\s*' .
|
||||||
'</head>\s*' .
|
'</head>\s*' .
|
||||||
|
|
|
@ -639,7 +639,7 @@ class FormHelperTest extends CakeTestCase {
|
||||||
public function testValidateHashNoModel() {
|
public function testValidateHashNoModel() {
|
||||||
$this->Form->request['_Token'] = array('key' => 'foo');
|
$this->Form->request['_Token'] = array('key' => 'foo');
|
||||||
$result = $this->Form->secure(array('anything'));
|
$result = $this->Form->secure(array('anything'));
|
||||||
$this->assertRegExp('/540ac9c60d323c22bafe997b72c0790f39a8bdef/', $result);
|
$this->assertMatchesRegularExpression('/540ac9c60d323c22bafe997b72c0790f39a8bdef/', $result);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -656,18 +656,18 @@ class FormHelperTest extends CakeTestCase {
|
||||||
|
|
||||||
$result = $this->Form->input('ValidateUser.name');
|
$result = $this->Form->input('ValidateUser.name');
|
||||||
$this->assertEquals(array('ValidateUser', 'name'), $this->Form->entity());
|
$this->assertEquals(array('ValidateUser', 'name'), $this->Form->entity());
|
||||||
$this->assertRegExp('/name="data\[ValidateUser\]\[name\]"/', $result);
|
$this->assertMatchesRegularExpression('/name="data\[ValidateUser\]\[name\]"/', $result);
|
||||||
$this->assertRegExp('/type="text"/', $result);
|
$this->assertMatchesRegularExpression('/type="text"/', $result);
|
||||||
|
|
||||||
$result = $this->Form->input('ValidateItem.name');
|
$result = $this->Form->input('ValidateItem.name');
|
||||||
$this->assertEquals(array('ValidateItem', 'name'), $this->Form->entity());
|
$this->assertEquals(array('ValidateItem', 'name'), $this->Form->entity());
|
||||||
$this->assertRegExp('/name="data\[ValidateItem\]\[name\]"/', $result);
|
$this->assertMatchesRegularExpression('/name="data\[ValidateItem\]\[name\]"/', $result);
|
||||||
$this->assertRegExp('/<textarea/', $result);
|
$this->assertMatchesRegularExpression('/<textarea/', $result);
|
||||||
|
|
||||||
$result = $this->Form->input('name');
|
$result = $this->Form->input('name');
|
||||||
$this->assertEquals(array('ValidateUser', 'name'), $this->Form->entity());
|
$this->assertEquals(array('ValidateUser', 'name'), $this->Form->entity());
|
||||||
$this->assertRegExp('/name="data\[ValidateUser\]\[name\]"/', $result);
|
$this->assertMatchesRegularExpression('/name="data\[ValidateUser\]\[name\]"/', $result);
|
||||||
$this->assertRegExp('/type="text"/', $result);
|
$this->assertMatchesRegularExpression('/type="text"/', $result);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -2908,12 +2908,12 @@ class FormHelperTest extends CakeTestCase {
|
||||||
extract($this->dateRegex);
|
extract($this->dateRegex);
|
||||||
$result = $this->Form->input('Contact.created', array('type' => 'time', 'timeFormat' => 24));
|
$result = $this->Form->input('Contact.created', array('type' => 'time', 'timeFormat' => 24));
|
||||||
$result = explode(':', $result);
|
$result = explode(':', $result);
|
||||||
$this->assertRegExp('/option value="23"/', $result[0]);
|
$this->assertMatchesRegularExpression('/option value="23"/', $result[0]);
|
||||||
$this->assertNotRegExp('/option value="24"/', $result[0]);
|
$this->assertNotRegExp('/option value="24"/', $result[0]);
|
||||||
|
|
||||||
$result = $this->Form->input('Contact.created', array('type' => 'time', 'timeFormat' => 24));
|
$result = $this->Form->input('Contact.created', array('type' => 'time', 'timeFormat' => 24));
|
||||||
$result = explode(':', $result);
|
$result = explode(':', $result);
|
||||||
$this->assertRegExp('/option value="23"/', $result[0]);
|
$this->assertMatchesRegularExpression('/option value="23"/', $result[0]);
|
||||||
$this->assertNotRegExp('/option value="24"/', $result[0]);
|
$this->assertNotRegExp('/option value="24"/', $result[0]);
|
||||||
|
|
||||||
$result = $this->Form->input('Model.field', array(
|
$result = $this->Form->input('Model.field', array(
|
||||||
|
@ -2922,7 +2922,7 @@ class FormHelperTest extends CakeTestCase {
|
||||||
$result = explode(':', $result);
|
$result = explode(':', $result);
|
||||||
$this->assertNotRegExp('#<option value="12"[^>]*>12</option>#', $result[1]);
|
$this->assertNotRegExp('#<option value="12"[^>]*>12</option>#', $result[1]);
|
||||||
$this->assertNotRegExp('#<option value="50"[^>]*>50</option>#', $result[1]);
|
$this->assertNotRegExp('#<option value="50"[^>]*>50</option>#', $result[1]);
|
||||||
$this->assertRegExp('#<option value="15"[^>]*>15</option>#', $result[1]);
|
$this->assertMatchesRegularExpression('#<option value="15"[^>]*>15</option>#', $result[1]);
|
||||||
|
|
||||||
$result = $this->Form->input('Model.field', array(
|
$result = $this->Form->input('Model.field', array(
|
||||||
'type' => 'time', 'timeFormat' => 12, 'interval' => 15
|
'type' => 'time', 'timeFormat' => 12, 'interval' => 15
|
||||||
|
@ -2930,7 +2930,7 @@ class FormHelperTest extends CakeTestCase {
|
||||||
$result = explode(':', $result);
|
$result = explode(':', $result);
|
||||||
$this->assertNotRegExp('#<option value="12"[^>]*>12</option>#', $result[1]);
|
$this->assertNotRegExp('#<option value="12"[^>]*>12</option>#', $result[1]);
|
||||||
$this->assertNotRegExp('#<option value="50"[^>]*>50</option>#', $result[1]);
|
$this->assertNotRegExp('#<option value="50"[^>]*>50</option>#', $result[1]);
|
||||||
$this->assertRegExp('#<option value="15"[^>]*>15</option>#', $result[1]);
|
$this->assertMatchesRegularExpression('#<option value="15"[^>]*>15</option>#', $result[1]);
|
||||||
|
|
||||||
$result = $this->Form->input('prueba', array(
|
$result = $this->Form->input('prueba', array(
|
||||||
'type' => 'time', 'timeFormat' => 24, 'dateFormat' => 'DMY', 'minYear' => 2008,
|
'type' => 'time', 'timeFormat' => 24, 'dateFormat' => 'DMY', 'minYear' => 2008,
|
||||||
|
@ -2939,8 +2939,8 @@ class FormHelperTest extends CakeTestCase {
|
||||||
$result = explode(':', $result);
|
$result = explode(':', $result);
|
||||||
$this->assertNotRegExp('#<option value="12"[^>]*>12</option>#', $result[1]);
|
$this->assertNotRegExp('#<option value="12"[^>]*>12</option>#', $result[1]);
|
||||||
$this->assertNotRegExp('#<option value="50"[^>]*>50</option>#', $result[1]);
|
$this->assertNotRegExp('#<option value="50"[^>]*>50</option>#', $result[1]);
|
||||||
$this->assertRegExp('#<option value="15"[^>]*>15</option>#', $result[1]);
|
$this->assertMatchesRegularExpression('#<option value="15"[^>]*>15</option>#', $result[1]);
|
||||||
$this->assertRegExp('#<option value="30"[^>]*>30</option>#', $result[1]);
|
$this->assertMatchesRegularExpression('#<option value="30"[^>]*>30</option>#', $result[1]);
|
||||||
|
|
||||||
$result = $this->Form->input('Random.start_time', array(
|
$result = $this->Form->input('Random.start_time', array(
|
||||||
'type' => 'time',
|
'type' => 'time',
|
||||||
|
@ -3215,31 +3215,31 @@ class FormHelperTest extends CakeTestCase {
|
||||||
$result = explode(':', $result);
|
$result = explode(':', $result);
|
||||||
$this->assertNotRegExp('#<option value="12"[^>]*>12</option>#', $result[1]);
|
$this->assertNotRegExp('#<option value="12"[^>]*>12</option>#', $result[1]);
|
||||||
$this->assertNotRegExp('#<option value="50"[^>]*>50</option>#', $result[1]);
|
$this->assertNotRegExp('#<option value="50"[^>]*>50</option>#', $result[1]);
|
||||||
$this->assertRegExp('#<option value="15"[^>]*>15</option>#', $result[1]);
|
$this->assertMatchesRegularExpression('#<option value="15"[^>]*>15</option>#', $result[1]);
|
||||||
$this->assertRegExp('#<option value="30"[^>]*>30</option>#', $result[1]);
|
$this->assertMatchesRegularExpression('#<option value="30"[^>]*>30</option>#', $result[1]);
|
||||||
|
|
||||||
//related to ticket #5013
|
//related to ticket #5013
|
||||||
$result = $this->Form->input('Contact.date', array(
|
$result = $this->Form->input('Contact.date', array(
|
||||||
'type' => 'date', 'class' => 'customClass', 'onChange' => 'function(){}'
|
'type' => 'date', 'class' => 'customClass', 'onChange' => 'function(){}'
|
||||||
));
|
));
|
||||||
$this->assertRegExp('/class="customClass"/', $result);
|
$this->assertMatchesRegularExpression('/class="customClass"/', $result);
|
||||||
$this->assertRegExp('/onChange="function\(\)\{\}"/', $result);
|
$this->assertMatchesRegularExpression('/onChange="function\(\)\{\}"/', $result);
|
||||||
|
|
||||||
$result = $this->Form->input('Contact.date', array(
|
$result = $this->Form->input('Contact.date', array(
|
||||||
'type' => 'date', 'id' => 'customId', 'onChange' => 'function(){}'
|
'type' => 'date', 'id' => 'customId', 'onChange' => 'function(){}'
|
||||||
));
|
));
|
||||||
$this->assertRegExp('/id="customIdDay"/', $result);
|
$this->assertMatchesRegularExpression('/id="customIdDay"/', $result);
|
||||||
$this->assertRegExp('/id="customIdMonth"/', $result);
|
$this->assertMatchesRegularExpression('/id="customIdMonth"/', $result);
|
||||||
$this->assertRegExp('/onChange="function\(\)\{\}"/', $result);
|
$this->assertMatchesRegularExpression('/onChange="function\(\)\{\}"/', $result);
|
||||||
|
|
||||||
$result = $this->Form->input('Model.field', array(
|
$result = $this->Form->input('Model.field', array(
|
||||||
'type' => 'datetime', 'timeFormat' => 24, 'id' => 'customID'
|
'type' => 'datetime', 'timeFormat' => 24, 'id' => 'customID'
|
||||||
));
|
));
|
||||||
$this->assertRegExp('/id="customIDDay"/', $result);
|
$this->assertMatchesRegularExpression('/id="customIDDay"/', $result);
|
||||||
$this->assertRegExp('/id="customIDHour"/', $result);
|
$this->assertMatchesRegularExpression('/id="customIDHour"/', $result);
|
||||||
$result = explode('</select><select', $result);
|
$result = explode('</select><select', $result);
|
||||||
$result = explode(':', $result[1]);
|
$result = explode(':', $result[1]);
|
||||||
$this->assertRegExp('/option value="23"/', $result[0]);
|
$this->assertMatchesRegularExpression('/option value="23"/', $result[0]);
|
||||||
$this->assertNotRegExp('/option value="24"/', $result[0]);
|
$this->assertNotRegExp('/option value="24"/', $result[0]);
|
||||||
|
|
||||||
$result = $this->Form->input('Model.field', array(
|
$result = $this->Form->input('Model.field', array(
|
||||||
|
@ -3247,7 +3247,7 @@ class FormHelperTest extends CakeTestCase {
|
||||||
));
|
));
|
||||||
$result = explode('</select><select', $result);
|
$result = explode('</select><select', $result);
|
||||||
$result = explode(':', $result[1]);
|
$result = explode(':', $result[1]);
|
||||||
$this->assertRegExp('/option value="12"/', $result[0]);
|
$this->assertMatchesRegularExpression('/option value="12"/', $result[0]);
|
||||||
$this->assertNotRegExp('/option value="13"/', $result[0]);
|
$this->assertNotRegExp('/option value="13"/', $result[0]);
|
||||||
|
|
||||||
$this->Form->request->data = array('Contact' => array('created' => null));
|
$this->Form->request->data = array('Contact' => array('created' => null));
|
||||||
|
@ -3275,18 +3275,18 @@ class FormHelperTest extends CakeTestCase {
|
||||||
|
|
||||||
$this->Form->request->data = array('Contact' => array('created' => null));
|
$this->Form->request->data = array('Contact' => array('created' => null));
|
||||||
$result = $this->Form->input('Contact.created', array('type' => 'datetime', 'dateFormat' => 'NONE'));
|
$result = $this->Form->input('Contact.created', array('type' => 'datetime', 'dateFormat' => 'NONE'));
|
||||||
$this->assertRegExp('/for\="ContactCreatedHour"/', $result);
|
$this->assertMatchesRegularExpression('/for\="ContactCreatedHour"/', $result);
|
||||||
|
|
||||||
$this->Form->request->data = array('Contact' => array('created' => null));
|
$this->Form->request->data = array('Contact' => array('created' => null));
|
||||||
$result = $this->Form->input('Contact.created', array('type' => 'datetime', 'timeFormat' => 'NONE'));
|
$result = $this->Form->input('Contact.created', array('type' => 'datetime', 'timeFormat' => 'NONE'));
|
||||||
$this->assertRegExp('/for\="ContactCreatedMonth"/', $result);
|
$this->assertMatchesRegularExpression('/for\="ContactCreatedMonth"/', $result);
|
||||||
|
|
||||||
$result = $this->Form->input('Contact.created', array(
|
$result = $this->Form->input('Contact.created', array(
|
||||||
'type' => 'date',
|
'type' => 'date',
|
||||||
'id' => array('day' => 'created-day', 'month' => 'created-month', 'year' => 'created-year'),
|
'id' => array('day' => 'created-day', 'month' => 'created-month', 'year' => 'created-year'),
|
||||||
'timeFormat' => 'NONE'
|
'timeFormat' => 'NONE'
|
||||||
));
|
));
|
||||||
$this->assertRegExp('/for\="created-month"/', $result);
|
$this->assertMatchesRegularExpression('/for\="created-month"/', $result);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -3714,7 +3714,7 @@ class FormHelperTest extends CakeTestCase {
|
||||||
public function testInputMagicSelectChangeToRadio() {
|
public function testInputMagicSelectChangeToRadio() {
|
||||||
$this->View->viewVars['users'] = array('value' => 'good', 'other' => 'bad');
|
$this->View->viewVars['users'] = array('value' => 'good', 'other' => 'bad');
|
||||||
$result = $this->Form->input('Model.user_id', array('type' => 'radio'));
|
$result = $this->Form->input('Model.user_id', array('type' => 'radio'));
|
||||||
$this->assertRegExp('/input type="radio"/', $result);
|
$this->assertMatchesRegularExpression('/input type="radio"/', $result);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -4307,10 +4307,10 @@ class FormHelperTest extends CakeTestCase {
|
||||||
$ValidateProfile = ClassRegistry::getObject('ValidateProfile');
|
$ValidateProfile = ClassRegistry::getObject('ValidateProfile');
|
||||||
$ValidateProfile->validationErrors['city'] = array('required<br>');
|
$ValidateProfile->validationErrors['city'] = array('required<br>');
|
||||||
$result = $this->Form->input('city', array('error' => array('attributes' => array('escape' => true))));
|
$result = $this->Form->input('city', array('error' => array('attributes' => array('escape' => true))));
|
||||||
$this->assertRegExp('/required<br>/', $result);
|
$this->assertMatchesRegularExpression('/required<br>/', $result);
|
||||||
|
|
||||||
$result = $this->Form->input('city', array('error' => array('attributes' => array('escape' => false))));
|
$result = $this->Form->input('city', array('error' => array('attributes' => array('escape' => false))));
|
||||||
$this->assertRegExp('/required<br>/', $result);
|
$this->assertMatchesRegularExpression('/required<br>/', $result);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -6357,7 +6357,7 @@ class FormHelperTest extends CakeTestCase {
|
||||||
|
|
||||||
$result = $this->Form->secure($this->Form->fields);
|
$result = $this->Form->secure($this->Form->fields);
|
||||||
$key = 'f7d573650a295b94e0938d32b323fde775e5f32b%3A';
|
$key = 'f7d573650a295b94e0938d32b323fde775e5f32b%3A';
|
||||||
$this->assertRegExp('/"' . $key . '"/', $result);
|
$this->assertMatchesRegularExpression('/"' . $key . '"/', $result);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -7128,12 +7128,12 @@ class FormHelperTest extends CakeTestCase {
|
||||||
|
|
||||||
$selected = strtotime('2008-10-26 12:33:00');
|
$selected = strtotime('2008-10-26 12:33:00');
|
||||||
$result = $this->Form->dateTime('Model.field', 'DMY', '12', array('value' => $selected));
|
$result = $this->Form->dateTime('Model.field', 'DMY', '12', array('value' => $selected));
|
||||||
$this->assertRegExp('/<option[^<>]+value="2008"[^<>]+selected="selected"[^>]*>2008<\/option>/', $result);
|
$this->assertMatchesRegularExpression('/<option[^<>]+value="2008"[^<>]+selected="selected"[^>]*>2008<\/option>/', $result);
|
||||||
$this->assertRegExp('/<option[^<>]+value="10"[^<>]+selected="selected"[^>]*>October<\/option>/', $result);
|
$this->assertMatchesRegularExpression('/<option[^<>]+value="10"[^<>]+selected="selected"[^>]*>October<\/option>/', $result);
|
||||||
$this->assertRegExp('/<option[^<>]+value="26"[^<>]+selected="selected"[^>]*>26<\/option>/', $result);
|
$this->assertMatchesRegularExpression('/<option[^<>]+value="26"[^<>]+selected="selected"[^>]*>26<\/option>/', $result);
|
||||||
$this->assertRegExp('/<option[^<>]+value="12"[^<>]+selected="selected"[^>]*>12<\/option>/', $result);
|
$this->assertMatchesRegularExpression('/<option[^<>]+value="12"[^<>]+selected="selected"[^>]*>12<\/option>/', $result);
|
||||||
$this->assertRegExp('/<option[^<>]+value="33"[^<>]+selected="selected"[^>]*>33<\/option>/', $result);
|
$this->assertMatchesRegularExpression('/<option[^<>]+value="33"[^<>]+selected="selected"[^>]*>33<\/option>/', $result);
|
||||||
$this->assertRegExp('/<option[^<>]+value="pm"[^<>]+selected="selected"[^>]*>pm<\/option>/', $result);
|
$this->assertMatchesRegularExpression('/<option[^<>]+value="pm"[^<>]+selected="selected"[^>]*>pm<\/option>/', $result);
|
||||||
|
|
||||||
$this->Form->create('Contact');
|
$this->Form->create('Contact');
|
||||||
$result = $this->Form->input('published');
|
$result = $this->Form->input('published');
|
||||||
|
@ -7236,11 +7236,11 @@ class FormHelperTest extends CakeTestCase {
|
||||||
'selected' => strtotime('2009-09-03 13:37:00'),
|
'selected' => strtotime('2009-09-03 13:37:00'),
|
||||||
'type' => 'datetime'
|
'type' => 'datetime'
|
||||||
));
|
));
|
||||||
$this->assertRegExp('/<option[^<>]+value="2009"[^<>]+selected="selected"[^>]*>2009<\/option>/', $result);
|
$this->assertMatchesRegularExpression('/<option[^<>]+value="2009"[^<>]+selected="selected"[^>]*>2009<\/option>/', $result);
|
||||||
$this->assertRegExp('/<option[^<>]+value="09"[^<>]+selected="selected"[^>]*>September<\/option>/', $result);
|
$this->assertMatchesRegularExpression('/<option[^<>]+value="09"[^<>]+selected="selected"[^>]*>September<\/option>/', $result);
|
||||||
$this->assertRegExp('/<option[^<>]+value="03"[^<>]+selected="selected"[^>]*>3<\/option>/', $result);
|
$this->assertMatchesRegularExpression('/<option[^<>]+value="03"[^<>]+selected="selected"[^>]*>3<\/option>/', $result);
|
||||||
$this->assertRegExp('/<option[^<>]+value="13"[^<>]+selected="selected"[^>]*>13<\/option>/', $result);
|
$this->assertMatchesRegularExpression('/<option[^<>]+value="13"[^<>]+selected="selected"[^>]*>13<\/option>/', $result);
|
||||||
$this->assertRegExp('/<option[^<>]+value="35"[^<>]+selected="selected"[^>]*>35<\/option>/', $result);
|
$this->assertMatchesRegularExpression('/<option[^<>]+value="35"[^<>]+selected="selected"[^>]*>35<\/option>/', $result);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -7297,16 +7297,16 @@ class FormHelperTest extends CakeTestCase {
|
||||||
*/
|
*/
|
||||||
public function testDatetimeWithDefault() {
|
public function testDatetimeWithDefault() {
|
||||||
$result = $this->Form->dateTime('Contact.updated', 'DMY', '12', array('value' => '2009-06-01 11:15:30'));
|
$result = $this->Form->dateTime('Contact.updated', 'DMY', '12', array('value' => '2009-06-01 11:15:30'));
|
||||||
$this->assertRegExp('/<option[^<>]+value="2009"[^<>]+selected="selected"[^>]*>2009<\/option>/', $result);
|
$this->assertMatchesRegularExpression('/<option[^<>]+value="2009"[^<>]+selected="selected"[^>]*>2009<\/option>/', $result);
|
||||||
$this->assertRegExp('/<option[^<>]+value="01"[^<>]+selected="selected"[^>]*>1<\/option>/', $result);
|
$this->assertMatchesRegularExpression('/<option[^<>]+value="01"[^<>]+selected="selected"[^>]*>1<\/option>/', $result);
|
||||||
$this->assertRegExp('/<option[^<>]+value="06"[^<>]+selected="selected"[^>]*>June<\/option>/', $result);
|
$this->assertMatchesRegularExpression('/<option[^<>]+value="06"[^<>]+selected="selected"[^>]*>June<\/option>/', $result);
|
||||||
|
|
||||||
$result = $this->Form->dateTime('Contact.updated', 'DMY', '12', array(
|
$result = $this->Form->dateTime('Contact.updated', 'DMY', '12', array(
|
||||||
'default' => '2009-06-01 11:15:30'
|
'default' => '2009-06-01 11:15:30'
|
||||||
));
|
));
|
||||||
$this->assertRegExp('/<option[^<>]+value="2009"[^<>]+selected="selected"[^>]*>2009<\/option>/', $result);
|
$this->assertMatchesRegularExpression('/<option[^<>]+value="2009"[^<>]+selected="selected"[^>]*>2009<\/option>/', $result);
|
||||||
$this->assertRegExp('/<option[^<>]+value="01"[^<>]+selected="selected"[^>]*>1<\/option>/', $result);
|
$this->assertMatchesRegularExpression('/<option[^<>]+value="01"[^<>]+selected="selected"[^>]*>1<\/option>/', $result);
|
||||||
$this->assertRegExp('/<option[^<>]+value="06"[^<>]+selected="selected"[^>]*>June<\/option>/', $result);
|
$this->assertMatchesRegularExpression('/<option[^<>]+value="06"[^<>]+selected="selected"[^>]*>June<\/option>/', $result);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -7334,7 +7334,7 @@ class FormHelperTest extends CakeTestCase {
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->assertRegExp('/<option value="">-<\/option>/', $result);
|
$this->assertMatchesRegularExpression('/<option value="">-<\/option>/', $result);
|
||||||
$this->assertNotRegExp('/<option value="0" selected="selected">0<\/option>/', $result);
|
$this->assertNotRegExp('/<option value="0" selected="selected">0<\/option>/', $result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -7354,11 +7354,11 @@ class FormHelperTest extends CakeTestCase {
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->assertRegExp('/<option value="">DAY<\/option>/', $result);
|
$this->assertMatchesRegularExpression('/<option value="">DAY<\/option>/', $result);
|
||||||
$this->assertRegExp('/<option value="">MONTH<\/option>/', $result);
|
$this->assertMatchesRegularExpression('/<option value="">MONTH<\/option>/', $result);
|
||||||
$this->assertRegExp('/<option value="">YEAR<\/option>/', $result);
|
$this->assertMatchesRegularExpression('/<option value="">YEAR<\/option>/', $result);
|
||||||
$this->assertRegExp('/<option value="">HOUR<\/option>/', $result);
|
$this->assertMatchesRegularExpression('/<option value="">HOUR<\/option>/', $result);
|
||||||
$this->assertRegExp('/<option value="">MINUTE<\/option>/', $result);
|
$this->assertMatchesRegularExpression('/<option value="">MINUTE<\/option>/', $result);
|
||||||
$this->assertNotRegExp('/<option value=""><\/option>/', $result);
|
$this->assertNotRegExp('/<option value=""><\/option>/', $result);
|
||||||
|
|
||||||
$result = $this->Form->dateTime('Contact.date',
|
$result = $this->Form->dateTime('Contact.date',
|
||||||
|
@ -7369,12 +7369,12 @@ class FormHelperTest extends CakeTestCase {
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->assertRegExp('/<option value="">DAY<\/option>/', $result);
|
$this->assertMatchesRegularExpression('/<option value="">DAY<\/option>/', $result);
|
||||||
$this->assertRegExp('/<option value="">MONTH<\/option>/', $result);
|
$this->assertMatchesRegularExpression('/<option value="">MONTH<\/option>/', $result);
|
||||||
$this->assertRegExp('/<option value="">YEAR<\/option>/', $result);
|
$this->assertMatchesRegularExpression('/<option value="">YEAR<\/option>/', $result);
|
||||||
$this->assertRegExp('/<select[^<>]+id="ContactDateHour">\s<option value=""><\/option>/', $result);
|
$this->assertMatchesRegularExpression('/<select[^<>]+id="ContactDateHour">\s<option value=""><\/option>/', $result);
|
||||||
$this->assertRegExp('/<select[^<>]+id="ContactDateMin">\s<option value=""><\/option>/', $result);
|
$this->assertMatchesRegularExpression('/<select[^<>]+id="ContactDateMin">\s<option value=""><\/option>/', $result);
|
||||||
$this->assertRegExp('/<select[^<>]+id="ContactDateMeridian">\s<option value=""><\/option>/', $result);
|
$this->assertMatchesRegularExpression('/<select[^<>]+id="ContactDateMeridian">\s<option value=""><\/option>/', $result);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -7899,7 +7899,7 @@ class FormHelperTest extends CakeTestCase {
|
||||||
$result = $this->Form->hour('Model.field', true, array('value' => 'now'));
|
$result = $this->Form->hour('Model.field', true, array('value' => 'now'));
|
||||||
$thisHour = date('H');
|
$thisHour = date('H');
|
||||||
$optValue = date('G');
|
$optValue = date('G');
|
||||||
$this->assertRegExp('/<option value="' . $thisHour . '" selected="selected">' . $optValue . '<\/option>/', $result);
|
$this->assertMatchesRegularExpression('/<option value="' . $thisHour . '" selected="selected">' . $optValue . '<\/option>/', $result);
|
||||||
|
|
||||||
$this->Form->request->data['Model']['field'] = '2050-10-10 01:12:32';
|
$this->Form->request->data['Model']['field'] = '2050-10-10 01:12:32';
|
||||||
$result = $this->Form->hour('Model.field', true);
|
$result = $this->Form->hour('Model.field', true);
|
||||||
|
@ -9763,12 +9763,12 @@ class FormHelperTest extends CakeTestCase {
|
||||||
$this->Form->create('Contact', array('type' => 'get'));
|
$this->Form->create('Contact', array('type' => 'get'));
|
||||||
$result = $this->Form->datetime('created');
|
$result = $this->Form->datetime('created');
|
||||||
|
|
||||||
$this->assertRegExp('/name="created\[year\]"/', $result, 'year name attribute is wrong.');
|
$this->assertMatchesRegularExpression('/name="created\[year\]"/', $result, 'year name attribute is wrong.');
|
||||||
$this->assertRegExp('/name="created\[month\]"/', $result, 'month name attribute is wrong.');
|
$this->assertMatchesRegularExpression('/name="created\[month\]"/', $result, 'month name attribute is wrong.');
|
||||||
$this->assertRegExp('/name="created\[day\]"/', $result, 'day name attribute is wrong.');
|
$this->assertMatchesRegularExpression('/name="created\[day\]"/', $result, 'day name attribute is wrong.');
|
||||||
$this->assertRegExp('/name="created\[hour\]"/', $result, 'hour name attribute is wrong.');
|
$this->assertMatchesRegularExpression('/name="created\[hour\]"/', $result, 'hour name attribute is wrong.');
|
||||||
$this->assertRegExp('/name="created\[min\]"/', $result, 'min name attribute is wrong.');
|
$this->assertMatchesRegularExpression('/name="created\[min\]"/', $result, 'min name attribute is wrong.');
|
||||||
$this->assertRegExp('/name="created\[meridian\]"/', $result, 'meridian name attribute is wrong.');
|
$this->assertMatchesRegularExpression('/name="created\[meridian\]"/', $result, 'meridian name attribute is wrong.');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -627,12 +627,12 @@ class HtmlHelperTest extends CakeTestCase {
|
||||||
|
|
||||||
$result = $this->Html->style(array('display' => 'none', 'margin' => '10px'));
|
$result = $this->Html->style(array('display' => 'none', 'margin' => '10px'));
|
||||||
$expected = 'display:none; margin:10px;';
|
$expected = 'display:none; margin:10px;';
|
||||||
$this->assertRegExp('/^display\s*:\s*none\s*;\s*margin\s*:\s*10px\s*;?$/', $expected);
|
$this->assertMatchesRegularExpression('/^display\s*:\s*none\s*;\s*margin\s*:\s*10px\s*;?$/', $expected);
|
||||||
|
|
||||||
$result = $this->Html->style(array('display' => 'none', 'margin' => '10px'), false);
|
$result = $this->Html->style(array('display' => 'none', 'margin' => '10px'), false);
|
||||||
$lines = explode("\n", $result);
|
$lines = explode("\n", $result);
|
||||||
$this->assertRegExp('/^\s*display\s*:\s*none\s*;\s*$/', $lines[0]);
|
$this->assertMatchesRegularExpression('/^\s*display\s*:\s*none\s*;\s*$/', $lines[0]);
|
||||||
$this->assertRegExp('/^\s*margin\s*:\s*10px\s*;?$/', $lines[1]);
|
$this->assertMatchesRegularExpression('/^\s*margin\s*:\s*10px\s*;?$/', $lines[1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -964,12 +964,12 @@ class HtmlHelperTest extends CakeTestCase {
|
||||||
$timestamp = substr(strtotime('now'), 0, 8);
|
$timestamp = substr(strtotime('now'), 0, 8);
|
||||||
|
|
||||||
$result = $this->Html->script('__cake_js_test', array('inline' => true, 'once' => false));
|
$result = $this->Html->script('__cake_js_test', array('inline' => true, 'once' => false));
|
||||||
$this->assertRegExp('/__cake_js_test.js\?' . $timestamp . '[0-9]{2}"/', $result, 'Timestamp value not found %s');
|
$this->assertMatchesRegularExpression('/__cake_js_test.js\?' . $timestamp . '[0-9]{2}"/', $result, 'Timestamp value not found %s');
|
||||||
|
|
||||||
Configure::write('debug', 0);
|
Configure::write('debug', 0);
|
||||||
Configure::write('Asset.timestamp', 'force');
|
Configure::write('Asset.timestamp', 'force');
|
||||||
$result = $this->Html->script('__cake_js_test', array('inline' => true, 'once' => false));
|
$result = $this->Html->script('__cake_js_test', array('inline' => true, 'once' => false));
|
||||||
$this->assertRegExp('/__cake_js_test.js\?' . $timestamp . '[0-9]{2}"/', $result, 'Timestamp value not found %s');
|
$this->assertMatchesRegularExpression('/__cake_js_test.js\?' . $timestamp . '[0-9]{2}"/', $result, 'Timestamp value not found %s');
|
||||||
unlink(WWW_ROOT . 'js' . DS . '__cake_js_test.js');
|
unlink(WWW_ROOT . 'js' . DS . '__cake_js_test.js');
|
||||||
Configure::write('Asset.timestamp', false);
|
Configure::write('Asset.timestamp', false);
|
||||||
}
|
}
|
||||||
|
@ -993,12 +993,12 @@ class HtmlHelperTest extends CakeTestCase {
|
||||||
$timestamp = substr(strtotime('now'), 0, 8);
|
$timestamp = substr(strtotime('now'), 0, 8);
|
||||||
|
|
||||||
$result = $this->Html->script('TestPlugin.__cake_js_test', array('inline' => true, 'once' => false));
|
$result = $this->Html->script('TestPlugin.__cake_js_test', array('inline' => true, 'once' => false));
|
||||||
$this->assertRegExp('/test_plugin\/js\/__cake_js_test.js\?' . $timestamp . '[0-9]{2}"/', $result, 'Timestamp value not found %s');
|
$this->assertMatchesRegularExpression('/test_plugin\/js\/__cake_js_test.js\?' . $timestamp . '[0-9]{2}"/', $result, 'Timestamp value not found %s');
|
||||||
|
|
||||||
Configure::write('debug', 0);
|
Configure::write('debug', 0);
|
||||||
Configure::write('Asset.timestamp', 'force');
|
Configure::write('Asset.timestamp', 'force');
|
||||||
$result = $this->Html->script('TestPlugin.__cake_js_test', array('inline' => true, 'once' => false));
|
$result = $this->Html->script('TestPlugin.__cake_js_test', array('inline' => true, 'once' => false));
|
||||||
$this->assertRegExp('/test_plugin\/js\/__cake_js_test.js\?' . $timestamp . '[0-9]{2}"/', $result, 'Timestamp value not found %s');
|
$this->assertMatchesRegularExpression('/test_plugin\/js\/__cake_js_test.js\?' . $timestamp . '[0-9]{2}"/', $result, 'Timestamp value not found %s');
|
||||||
unlink($pluginJsPath . DS . '__cake_js_test.js');
|
unlink($pluginJsPath . DS . '__cake_js_test.js');
|
||||||
Configure::write('Asset.timestamp', false);
|
Configure::write('Asset.timestamp', false);
|
||||||
|
|
||||||
|
|
|
@ -375,7 +375,7 @@ class JsHelperTest extends CakeTestCase {
|
||||||
preg_match('/src="(.*\.js)"/', $result, $filename);
|
preg_match('/src="(.*\.js)"/', $result, $filename);
|
||||||
$this->assertTrue(file_exists(WWW_ROOT . $filename[1]));
|
$this->assertTrue(file_exists(WWW_ROOT . $filename[1]));
|
||||||
$contents = file_get_contents(WWW_ROOT . $filename[1]);
|
$contents = file_get_contents(WWW_ROOT . $filename[1]);
|
||||||
$this->assertRegExp('/one\s=\s1;\ntwo\s=\s2;/', $contents);
|
$this->assertMatchesRegularExpression('/one\s=\s1;\ntwo\s=\s2;/', $contents);
|
||||||
if (file_exists(WWW_ROOT . $filename[1])) {
|
if (file_exists(WWW_ROOT . $filename[1])) {
|
||||||
unlink(WWW_ROOT . $filename[1]);
|
unlink(WWW_ROOT . $filename[1]);
|
||||||
}
|
}
|
||||||
|
@ -384,7 +384,7 @@ class JsHelperTest extends CakeTestCase {
|
||||||
$this->Js->buffer('one = 1;');
|
$this->Js->buffer('one = 1;');
|
||||||
$this->Js->buffer('two = 2;');
|
$this->Js->buffer('two = 2;');
|
||||||
$result = $this->Js->writeBuffer(array('onDomReady' => false, 'cache' => true));
|
$result = $this->Js->writeBuffer(array('onDomReady' => false, 'cache' => true));
|
||||||
$this->assertRegExp('/one\s=\s1;\ntwo\s=\s2;/', $result);
|
$this->assertMatchesRegularExpression('/one\s=\s1;\ntwo\s=\s2;/', $result);
|
||||||
$this->assertFalse(file_exists(WWW_ROOT . $filename[1]));
|
$this->assertFalse(file_exists(WWW_ROOT . $filename[1]));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -902,8 +902,8 @@ class JsBaseEngineTest extends CakeTestCase {
|
||||||
|
|
||||||
$object = array('title' => 'New thing', 'indexes' => array(5, 6, 7, 8), 'object' => array('inner' => array('value' => 1)));
|
$object = array('title' => 'New thing', 'indexes' => array(5, 6, 7, 8), 'object' => array('inner' => array('value' => 1)));
|
||||||
$result = $this->JsEngine->object($object, array('prefix' => 'PREFIX', 'postfix' => 'POSTFIX'));
|
$result = $this->JsEngine->object($object, array('prefix' => 'PREFIX', 'postfix' => 'POSTFIX'));
|
||||||
$this->assertRegExp('/^PREFIX/', $result);
|
$this->assertMatchesRegularExpression('/^PREFIX/', $result);
|
||||||
$this->assertRegExp('/POSTFIX$/', $result);
|
$this->assertMatchesRegularExpression('/POSTFIX$/', $result);
|
||||||
$this->assertNotRegExp('/.PREFIX./', $result);
|
$this->assertNotRegExp('/.PREFIX./', $result);
|
||||||
$this->assertNotRegExp('/.POSTFIX./', $result);
|
$this->assertNotRegExp('/.POSTFIX./', $result);
|
||||||
}
|
}
|
||||||
|
|
|
@ -198,37 +198,37 @@ class PaginatorHelperTest extends CakeTestCase {
|
||||||
$this->Paginator->request->params['paging']['Article']['options']['order'] = array('Article.title' => 'desc');
|
$this->Paginator->request->params['paging']['Article']['options']['order'] = array('Article.title' => 'desc');
|
||||||
$this->Paginator->request->params['paging']['Article']['options']['sort'] = null;
|
$this->Paginator->request->params['paging']['Article']['options']['sort'] = null;
|
||||||
$result = $this->Paginator->sort('title');
|
$result = $this->Paginator->sort('title');
|
||||||
$this->assertRegExp('/\/accounts\/index\/param\/sort:title\/direction:asc" class="desc">Title<\/a>$/', $result);
|
$this->assertMatchesRegularExpression('/\/accounts\/index\/param\/sort:title\/direction:asc" class="desc">Title<\/a>$/', $result);
|
||||||
|
|
||||||
$this->Paginator->request->params['paging']['Article']['options']['order'] = array('Article.title' => 'asc');
|
$this->Paginator->request->params['paging']['Article']['options']['order'] = array('Article.title' => 'asc');
|
||||||
$this->Paginator->request->params['paging']['Article']['options']['sort'] = null;
|
$this->Paginator->request->params['paging']['Article']['options']['sort'] = null;
|
||||||
$result = $this->Paginator->sort('title');
|
$result = $this->Paginator->sort('title');
|
||||||
$this->assertRegExp('/\/accounts\/index\/param\/sort:title\/direction:desc" class="asc">Title<\/a>$/', $result);
|
$this->assertMatchesRegularExpression('/\/accounts\/index\/param\/sort:title\/direction:desc" class="asc">Title<\/a>$/', $result);
|
||||||
|
|
||||||
$this->Paginator->request->params['paging']['Article']['options']['order'] = array('Article.title' => 'desc');
|
$this->Paginator->request->params['paging']['Article']['options']['order'] = array('Article.title' => 'desc');
|
||||||
$this->Paginator->request->params['paging']['Article']['options']['sort'] = null;
|
$this->Paginator->request->params['paging']['Article']['options']['sort'] = null;
|
||||||
$result = $this->Paginator->sort('title', 'Title', array('direction' => 'desc'));
|
$result = $this->Paginator->sort('title', 'Title', array('direction' => 'desc'));
|
||||||
$this->assertRegExp('/\/accounts\/index\/param\/sort:title\/direction:asc" class="desc">Title<\/a>$/', $result);
|
$this->assertMatchesRegularExpression('/\/accounts\/index\/param\/sort:title\/direction:asc" class="desc">Title<\/a>$/', $result);
|
||||||
|
|
||||||
$this->Paginator->request->params['paging']['Article']['options']['order'] = array('Article.title' => 'desc');
|
$this->Paginator->request->params['paging']['Article']['options']['order'] = array('Article.title' => 'desc');
|
||||||
$this->Paginator->request->params['paging']['Article']['options']['sort'] = null;
|
$this->Paginator->request->params['paging']['Article']['options']['sort'] = null;
|
||||||
$result = $this->Paginator->sort('title', 'Title', array('direction' => 'ASC'));
|
$result = $this->Paginator->sort('title', 'Title', array('direction' => 'ASC'));
|
||||||
$this->assertRegExp('/\/accounts\/index\/param\/sort:title\/direction:asc" class="desc">Title<\/a>$/', $result);
|
$this->assertMatchesRegularExpression('/\/accounts\/index\/param\/sort:title\/direction:asc" class="desc">Title<\/a>$/', $result);
|
||||||
|
|
||||||
$this->Paginator->request->params['paging']['Article']['options']['order'] = array('Article.title' => 'asc');
|
$this->Paginator->request->params['paging']['Article']['options']['order'] = array('Article.title' => 'asc');
|
||||||
$this->Paginator->request->params['paging']['Article']['options']['sort'] = null;
|
$this->Paginator->request->params['paging']['Article']['options']['sort'] = null;
|
||||||
$result = $this->Paginator->sort('title', 'Title', array('direction' => 'asc'));
|
$result = $this->Paginator->sort('title', 'Title', array('direction' => 'asc'));
|
||||||
$this->assertRegExp('/\/accounts\/index\/param\/sort:title\/direction:desc" class="asc">Title<\/a>$/', $result);
|
$this->assertMatchesRegularExpression('/\/accounts\/index\/param\/sort:title\/direction:desc" class="asc">Title<\/a>$/', $result);
|
||||||
|
|
||||||
$this->Paginator->request->params['paging']['Article']['options']['order'] = array('Article.title' => 'asc');
|
$this->Paginator->request->params['paging']['Article']['options']['order'] = array('Article.title' => 'asc');
|
||||||
$this->Paginator->request->params['paging']['Article']['options']['sort'] = null;
|
$this->Paginator->request->params['paging']['Article']['options']['sort'] = null;
|
||||||
$result = $this->Paginator->sort('title', 'Title', array('direction' => 'desc'));
|
$result = $this->Paginator->sort('title', 'Title', array('direction' => 'desc'));
|
||||||
$this->assertRegExp('/\/accounts\/index\/param\/sort:title\/direction:desc" class="asc">Title<\/a>$/', $result);
|
$this->assertMatchesRegularExpression('/\/accounts\/index\/param\/sort:title\/direction:desc" class="asc">Title<\/a>$/', $result);
|
||||||
|
|
||||||
$this->Paginator->request->params['paging']['Article']['options']['order'] = array('Article.title' => 'asc');
|
$this->Paginator->request->params['paging']['Article']['options']['order'] = array('Article.title' => 'asc');
|
||||||
$this->Paginator->request->params['paging']['Article']['options']['sort'] = null;
|
$this->Paginator->request->params['paging']['Article']['options']['sort'] = null;
|
||||||
$result = $this->Paginator->sort('title', 'Title', array('direction' => 'desc', 'class' => 'foo'));
|
$result = $this->Paginator->sort('title', 'Title', array('direction' => 'desc', 'class' => 'foo'));
|
||||||
$this->assertRegExp('/\/accounts\/index\/param\/sort:title\/direction:desc" class="foo asc">Title<\/a>$/', $result);
|
$this->assertMatchesRegularExpression('/\/accounts\/index\/param\/sort:title\/direction:desc" class="foo asc">Title<\/a>$/', $result);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -129,7 +129,7 @@ class TextHelperTest extends CakeTestCase {
|
||||||
$text = 'Text with a partial www.cakephp.org URL and test@cakephp.org email address';
|
$text = 'Text with a partial www.cakephp.org URL and test@cakephp.org email address';
|
||||||
$result = $this->Text->autoLink($text);
|
$result = $this->Text->autoLink($text);
|
||||||
$expected = 'Text with a partial <a href="http://www.cakephp.org">www.cakephp.org</a> URL and <a href="mailto:test@cakephp\.org">test@cakephp\.org</a> email address';
|
$expected = 'Text with a partial <a href="http://www.cakephp.org">www.cakephp.org</a> URL and <a href="mailto:test@cakephp\.org">test@cakephp\.org</a> email address';
|
||||||
$this->assertRegExp('#^' . $expected . '$#', $result);
|
$this->assertMatchesRegularExpression('#^' . $expected . '$#', $result);
|
||||||
|
|
||||||
$text = 'Text with a partial <a href="//www.cakephp.org">link</a> link';
|
$text = 'Text with a partial <a href="//www.cakephp.org">link</a> link';
|
||||||
$result = $this->Text->autoLink($text, array('escape' => false));
|
$result = $this->Text->autoLink($text, array('escape' => false));
|
||||||
|
@ -333,12 +333,12 @@ class TextHelperTest extends CakeTestCase {
|
||||||
$text = 'Text with a partial www.cakephp.org URL';
|
$text = 'Text with a partial www.cakephp.org URL';
|
||||||
$expected = 'Text with a partial <a href="http://www.cakephp.org" \s*class="link">www.cakephp.org</a> URL';
|
$expected = 'Text with a partial <a href="http://www.cakephp.org" \s*class="link">www.cakephp.org</a> URL';
|
||||||
$result = $this->Text->autoLinkUrls($text, array('class' => 'link'));
|
$result = $this->Text->autoLinkUrls($text, array('class' => 'link'));
|
||||||
$this->assertRegExp('#^' . $expected . '$#', $result);
|
$this->assertMatchesRegularExpression('#^' . $expected . '$#', $result);
|
||||||
|
|
||||||
$text = 'Text with a partial WWW.cakephp.org © URL';
|
$text = 'Text with a partial WWW.cakephp.org © URL';
|
||||||
$expected = 'Text with a partial <a href="http://WWW.cakephp.org"\s*>WWW.cakephp.org</a> © URL';
|
$expected = 'Text with a partial <a href="http://WWW.cakephp.org"\s*>WWW.cakephp.org</a> © URL';
|
||||||
$result = $this->Text->autoLinkUrls($text, array('escape' => false));
|
$result = $this->Text->autoLinkUrls($text, array('escape' => false));
|
||||||
$this->assertRegExp('#^' . $expected . '$#', $result);
|
$this->assertMatchesRegularExpression('#^' . $expected . '$#', $result);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -613,19 +613,19 @@ class HelperTest extends CakeTestCase {
|
||||||
Configure::write('Asset.timestamp', true);
|
Configure::write('Asset.timestamp', true);
|
||||||
Configure::write('debug', 2);
|
Configure::write('debug', 2);
|
||||||
$result = $this->Helper->assetTimestamp(Configure::read('App.cssBaseUrl') . 'cake.generic.css');
|
$result = $this->Helper->assetTimestamp(Configure::read('App.cssBaseUrl') . 'cake.generic.css');
|
||||||
$this->assertRegExp('/' . preg_quote(Configure::read('App.cssBaseUrl') . 'cake.generic.css?', '/') . '[0-9]+/', $result);
|
$this->assertMatchesRegularExpression('/' . preg_quote(Configure::read('App.cssBaseUrl') . 'cake.generic.css?', '/') . '[0-9]+/', $result);
|
||||||
|
|
||||||
Configure::write('Asset.timestamp', 'force');
|
Configure::write('Asset.timestamp', 'force');
|
||||||
Configure::write('debug', 0);
|
Configure::write('debug', 0);
|
||||||
$result = $this->Helper->assetTimestamp(Configure::read('App.cssBaseUrl') . 'cake.generic.css');
|
$result = $this->Helper->assetTimestamp(Configure::read('App.cssBaseUrl') . 'cake.generic.css');
|
||||||
$this->assertRegExp('/' . preg_quote(Configure::read('App.cssBaseUrl') . 'cake.generic.css?', '/') . '[0-9]+/', $result);
|
$this->assertMatchesRegularExpression('/' . preg_quote(Configure::read('App.cssBaseUrl') . 'cake.generic.css?', '/') . '[0-9]+/', $result);
|
||||||
|
|
||||||
$result = $this->Helper->assetTimestamp(Configure::read('App.cssBaseUrl') . 'cake.generic.css?someparam');
|
$result = $this->Helper->assetTimestamp(Configure::read('App.cssBaseUrl') . 'cake.generic.css?someparam');
|
||||||
$this->assertEquals(Configure::read('App.cssBaseUrl') . 'cake.generic.css?someparam', $result);
|
$this->assertEquals(Configure::read('App.cssBaseUrl') . 'cake.generic.css?someparam', $result);
|
||||||
|
|
||||||
$this->Helper->request->webroot = '/some/dir/';
|
$this->Helper->request->webroot = '/some/dir/';
|
||||||
$result = $this->Helper->assetTimestamp('/some/dir/' . Configure::read('App.cssBaseUrl') . 'cake.generic.css');
|
$result = $this->Helper->assetTimestamp('/some/dir/' . Configure::read('App.cssBaseUrl') . 'cake.generic.css');
|
||||||
$this->assertRegExp('/' . preg_quote(Configure::read('App.cssBaseUrl') . 'cake.generic.css?', '/') . '[0-9]+/', $result);
|
$this->assertMatchesRegularExpression('/' . preg_quote(Configure::read('App.cssBaseUrl') . 'cake.generic.css?', '/') . '[0-9]+/', $result);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -707,7 +707,7 @@ class HelperTest extends CakeTestCase {
|
||||||
Configure::write('Asset.timestamp', 'force');
|
Configure::write('Asset.timestamp', 'force');
|
||||||
|
|
||||||
$result = $this->Helper->assetUrl('cake.generic.css', array('pathPrefix' => Configure::read('App.cssBaseUrl')));
|
$result = $this->Helper->assetUrl('cake.generic.css', array('pathPrefix' => Configure::read('App.cssBaseUrl')));
|
||||||
$this->assertRegExp('/' . preg_quote(Configure::read('App.cssBaseUrl') . 'cake.generic.css?', '/') . '[0-9]+/', $result);
|
$this->assertMatchesRegularExpression('/' . preg_quote(Configure::read('App.cssBaseUrl') . 'cake.generic.css?', '/') . '[0-9]+/', $result);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -723,16 +723,16 @@ class HelperTest extends CakeTestCase {
|
||||||
CakePlugin::load(array('TestPlugin'));
|
CakePlugin::load(array('TestPlugin'));
|
||||||
|
|
||||||
$result = $this->Helper->assetTimestamp('/test_plugin/css/test_plugin_asset.css');
|
$result = $this->Helper->assetTimestamp('/test_plugin/css/test_plugin_asset.css');
|
||||||
$this->assertRegExp('#/test_plugin/css/test_plugin_asset.css\?[0-9]+$#', $result, 'Missing timestamp plugin');
|
$this->assertMatchesRegularExpression('#/test_plugin/css/test_plugin_asset.css\?[0-9]+$#', $result, 'Missing timestamp plugin');
|
||||||
|
|
||||||
$result = $this->Helper->assetTimestamp('/test_plugin/css/i_dont_exist.css');
|
$result = $this->Helper->assetTimestamp('/test_plugin/css/i_dont_exist.css');
|
||||||
$this->assertRegExp('#/test_plugin/css/i_dont_exist.css\?$#', $result, 'No error on missing file');
|
$this->assertMatchesRegularExpression('#/test_plugin/css/i_dont_exist.css\?$#', $result, 'No error on missing file');
|
||||||
|
|
||||||
$result = $this->Helper->assetTimestamp('/theme/test_theme/js/theme.js');
|
$result = $this->Helper->assetTimestamp('/theme/test_theme/js/theme.js');
|
||||||
$this->assertRegExp('#/theme/test_theme/js/theme.js\?[0-9]+$#', $result, 'Missing timestamp theme');
|
$this->assertMatchesRegularExpression('#/theme/test_theme/js/theme.js\?[0-9]+$#', $result, 'Missing timestamp theme');
|
||||||
|
|
||||||
$result = $this->Helper->assetTimestamp('/theme/test_theme/js/non_existant.js');
|
$result = $this->Helper->assetTimestamp('/theme/test_theme/js/non_existant.js');
|
||||||
$this->assertRegExp('#/theme/test_theme/js/non_existant.js\?$#', $result, 'No error on missing file');
|
$this->assertMatchesRegularExpression('#/theme/test_theme/js/non_existant.js\?$#', $result, 'No error on missing file');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -379,7 +379,7 @@ class JsonViewTest extends CakeTestCase {
|
||||||
$this->fail('Failed asserting that exception of type "CakeException" is thrown.');
|
$this->fail('Failed asserting that exception of type "CakeException" is thrown.');
|
||||||
} catch (CakeException $e) {
|
} catch (CakeException $e) {
|
||||||
restore_error_handler();
|
restore_error_handler();
|
||||||
$this->assertRegExp('/UTF-8/', $e->getMessage());
|
$this->assertMatchesRegularExpression('/UTF-8/', $e->getMessage());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -238,13 +238,13 @@ class ScaffoldViewTest extends CakeTestCase {
|
||||||
$this->Controller->response->send();
|
$this->Controller->response->send();
|
||||||
$result = ob_get_clean();
|
$result = ob_get_clean();
|
||||||
|
|
||||||
$this->assertRegExp('#<h2>Scaffold Mock</h2>#', $result);
|
$this->assertMatchesRegularExpression('#<h2>Scaffold Mock</h2>#', $result);
|
||||||
$this->assertRegExp('#<table cellpadding="0" cellspacing="0">#', $result);
|
$this->assertMatchesRegularExpression('#<table cellpadding="0" cellspacing="0">#', $result);
|
||||||
|
|
||||||
$this->assertRegExp('#<a href="/scaffold_users/view/1">1</a>#', $result); //belongsTo links
|
$this->assertMatchesRegularExpression('#<a href="/scaffold_users/view/1">1</a>#', $result); //belongsTo links
|
||||||
$this->assertRegExp('#<li><a href="/scaffold_mock/add">New Scaffold Mock</a></li>#', $result);
|
$this->assertMatchesRegularExpression('#<li><a href="/scaffold_mock/add">New Scaffold Mock</a></li>#', $result);
|
||||||
$this->assertRegExp('#<li><a href="/scaffold_users">List Scaffold Users</a></li>#', $result);
|
$this->assertMatchesRegularExpression('#<li><a href="/scaffold_users">List Scaffold Users</a></li>#', $result);
|
||||||
$this->assertRegExp('#<li><a href="/scaffold_comments/add">New Comment</a></li>#', $result);
|
$this->assertMatchesRegularExpression('#<li><a href="/scaffold_comments/add">New Comment</a></li>#', $result);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -277,15 +277,15 @@ class ScaffoldViewTest extends CakeTestCase {
|
||||||
$this->Controller->response->send();
|
$this->Controller->response->send();
|
||||||
$result = ob_get_clean();
|
$result = ob_get_clean();
|
||||||
|
|
||||||
$this->assertRegExp('/<h2>View Scaffold Mock<\/h2>/', $result);
|
$this->assertMatchesRegularExpression('/<h2>View Scaffold Mock<\/h2>/', $result);
|
||||||
$this->assertRegExp('/<dl>/', $result);
|
$this->assertMatchesRegularExpression('/<dl>/', $result);
|
||||||
|
|
||||||
$this->assertRegExp('/<a href="\/scaffold_users\/view\/1">1<\/a>/', $result); //belongsTo links
|
$this->assertMatchesRegularExpression('/<a href="\/scaffold_users\/view\/1">1<\/a>/', $result); //belongsTo links
|
||||||
$this->assertRegExp('/<li><a href="\/scaffold_mock\/edit\/1">Edit Scaffold Mock<\/a>\s<\/li>/', $result);
|
$this->assertMatchesRegularExpression('/<li><a href="\/scaffold_mock\/edit\/1">Edit Scaffold Mock<\/a>\s<\/li>/', $result);
|
||||||
$this->assertRegExp('/<a href="\#" onclick="if[^>]*>Delete Scaffold Mock<\/a>\s<\/li>/', $result);
|
$this->assertMatchesRegularExpression('/<a href="\#" onclick="if[^>]*>Delete Scaffold Mock<\/a>\s<\/li>/', $result);
|
||||||
//check related table
|
//check related table
|
||||||
$this->assertRegExp('/<div class="related">\s*<h3>Related Scaffold Comments<\/h3>\s*<table cellpadding="0" cellspacing="0">/', $result);
|
$this->assertMatchesRegularExpression('/<div class="related">\s*<h3>Related Scaffold Comments<\/h3>\s*<table cellpadding="0" cellspacing="0">/', $result);
|
||||||
$this->assertRegExp('/<li><a href="\/scaffold_comments\/add">New Comment<\/a><\/li>/', $result);
|
$this->assertMatchesRegularExpression('/<li><a href="\/scaffold_comments\/add">New Comment<\/a><\/li>/', $result);
|
||||||
$this->assertNotRegExp('/<th>JoinThing<\/th>/', $result);
|
$this->assertNotRegExp('/<th>JoinThing<\/th>/', $result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -328,7 +328,7 @@ class ScaffoldViewTest extends CakeTestCase {
|
||||||
$this->assertContains('input name="data[ScaffoldMock][title]" maxlength="255" type="text" value="First Article" id="ScaffoldMockTitle"', $result);
|
$this->assertContains('input name="data[ScaffoldMock][title]" maxlength="255" type="text" value="First Article" id="ScaffoldMockTitle"', $result);
|
||||||
$this->assertContains('input name="data[ScaffoldMock][published]" maxlength="1" type="text" value="Y" id="ScaffoldMockPublished"', $result);
|
$this->assertContains('input name="data[ScaffoldMock][published]" maxlength="1" type="text" value="Y" id="ScaffoldMockPublished"', $result);
|
||||||
$this->assertContains('textarea name="data[ScaffoldMock][body]" cols="30" rows="6" id="ScaffoldMockBody"', $result);
|
$this->assertContains('textarea name="data[ScaffoldMock][body]" cols="30" rows="6" id="ScaffoldMockBody"', $result);
|
||||||
$this->assertRegExp('/<a href="\#" onclick="if[^>]*>Delete<\/a><\/li>/', $result);
|
$this->assertMatchesRegularExpression('/<a href="\#" onclick="if[^>]*>Delete<\/a><\/li>/', $result);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -368,10 +368,10 @@ class ScaffoldViewTest extends CakeTestCase {
|
||||||
$this->Controller->response->send();
|
$this->Controller->response->send();
|
||||||
$result = ob_get_clean();
|
$result = ob_get_clean();
|
||||||
|
|
||||||
$this->assertRegExp('/<h2>Scaffold Mock<\/h2>/', $result);
|
$this->assertMatchesRegularExpression('/<h2>Scaffold Mock<\/h2>/', $result);
|
||||||
$this->assertRegExp('/<table cellpadding="0" cellspacing="0">/', $result);
|
$this->assertMatchesRegularExpression('/<table cellpadding="0" cellspacing="0">/', $result);
|
||||||
|
|
||||||
$this->assertRegExp('/<li><a href="\/admin\/scaffold_mock\/add">New Scaffold Mock<\/a><\/li>/', $result);
|
$this->assertMatchesRegularExpression('/<li><a href="\/admin\/scaffold_mock\/add">New Scaffold Mock<\/a><\/li>/', $result);
|
||||||
|
|
||||||
Configure::write('Routing.prefixes', $_backAdmin);
|
Configure::write('Routing.prefixes', $_backAdmin);
|
||||||
}
|
}
|
||||||
|
@ -411,8 +411,8 @@ class ScaffoldViewTest extends CakeTestCase {
|
||||||
$this->Controller->response->send();
|
$this->Controller->response->send();
|
||||||
$result = ob_get_clean();
|
$result = ob_get_clean();
|
||||||
|
|
||||||
$this->assertRegExp('#admin/scaffold_mock/edit/1#', $result);
|
$this->assertMatchesRegularExpression('#admin/scaffold_mock/edit/1#', $result);
|
||||||
$this->assertRegExp('#Scaffold Mock#', $result);
|
$this->assertMatchesRegularExpression('#Scaffold Mock#', $result);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -452,10 +452,10 @@ class ScaffoldViewTest extends CakeTestCase {
|
||||||
$this->Controller->response->send();
|
$this->Controller->response->send();
|
||||||
$result = ob_get_clean();
|
$result = ob_get_clean();
|
||||||
|
|
||||||
$this->assertRegExp('/<h2>Scaffold Mock<\/h2>/', $result);
|
$this->assertMatchesRegularExpression('/<h2>Scaffold Mock<\/h2>/', $result);
|
||||||
$this->assertRegExp('/<table cellpadding="0" cellspacing="0">/', $result);
|
$this->assertMatchesRegularExpression('/<table cellpadding="0" cellspacing="0">/', $result);
|
||||||
|
|
||||||
$this->assertRegExp('/<li><a href="\/member\/scaffold_mock\/add">New Scaffold Mock<\/a><\/li>/', $result);
|
$this->assertMatchesRegularExpression('/<li><a href="\/member\/scaffold_mock\/add">New Scaffold Mock<\/a><\/li>/', $result);
|
||||||
|
|
||||||
Configure::write('Routing.prefixes', $_backAdmin);
|
Configure::write('Routing.prefixes', $_backAdmin);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1085,8 +1085,8 @@ class ViewTest extends CakeTestCase {
|
||||||
|
|
||||||
$content = 'This is my view output';
|
$content = 'This is my view output';
|
||||||
$result = $View->renderLayout($content, 'default');
|
$result = $View->renderLayout($content, 'default');
|
||||||
$this->assertRegExp('/modified in the afterlife/', $result);
|
$this->assertMatchesRegularExpression('/modified in the afterlife/', $result);
|
||||||
$this->assertRegExp('/This is my view output/', $result);
|
$this->assertMatchesRegularExpression('/This is my view output/', $result);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1124,9 +1124,9 @@ class ViewTest extends CakeTestCase {
|
||||||
$View = new TestView($this->PostsController);
|
$View = new TestView($this->PostsController);
|
||||||
$result = $View->render('index');
|
$result = $View->render('index');
|
||||||
|
|
||||||
$this->assertRegExp("/<meta http-equiv=\"Content-Type\" content=\"text\/html; charset=utf-8\" \/>\s*<title>/", $result);
|
$this->assertMatchesRegularExpression("/<meta http-equiv=\"Content-Type\" content=\"text\/html; charset=utf-8\" \/>\s*<title>/", $result);
|
||||||
$this->assertRegExp("/<div id=\"content\">\s*posts index\s*<\/div>/", $result);
|
$this->assertMatchesRegularExpression("/<div id=\"content\">\s*posts index\s*<\/div>/", $result);
|
||||||
$this->assertRegExp("/<div id=\"content\">\s*posts index\s*<\/div>/", $result);
|
$this->assertMatchesRegularExpression("/<div id=\"content\">\s*posts index\s*<\/div>/", $result);
|
||||||
|
|
||||||
$this->assertTrue(isset($View->viewVars['content_for_layout']), 'content_for_layout should be a view var');
|
$this->assertTrue(isset($View->viewVars['content_for_layout']), 'content_for_layout should be a view var');
|
||||||
$this->assertTrue(isset($View->viewVars['scripts_for_layout']), 'scripts_for_layout should be a view var');
|
$this->assertTrue(isset($View->viewVars['scripts_for_layout']), 'scripts_for_layout should be a view var');
|
||||||
|
@ -1139,8 +1139,8 @@ class ViewTest extends CakeTestCase {
|
||||||
$View = new TestView($this->PostsController);
|
$View = new TestView($this->PostsController);
|
||||||
$result = $View->render(false, 'flash');
|
$result = $View->render(false, 'flash');
|
||||||
|
|
||||||
$this->assertRegExp("/<title>yo what up<\/title>/", $result);
|
$this->assertMatchesRegularExpression("/<title>yo what up<\/title>/", $result);
|
||||||
$this->assertRegExp("/<p><a href=\"flash\">yo what up<\/a><\/p>/", $result);
|
$this->assertMatchesRegularExpression("/<p><a href=\"flash\">yo what up<\/a><\/p>/", $result);
|
||||||
|
|
||||||
$this->assertNull($View->render(false, 'flash'));
|
$this->assertNull($View->render(false, 'flash'));
|
||||||
|
|
||||||
|
@ -1153,9 +1153,9 @@ class ViewTest extends CakeTestCase {
|
||||||
$View = new TestView($this->PostsController);
|
$View = new TestView($this->PostsController);
|
||||||
$result = $View->render('index');
|
$result = $View->render('index');
|
||||||
|
|
||||||
$this->assertRegExp("/<meta http-equiv=\"Content-Type\" content=\"text\/html; charset=utf-8\" \/>\s*<title>/", $result);
|
$this->assertMatchesRegularExpression("/<meta http-equiv=\"Content-Type\" content=\"text\/html; charset=utf-8\" \/>\s*<title>/", $result);
|
||||||
$this->assertRegExp("/<div id=\"content\">\s*posts index\s*<\/div>/", $result);
|
$this->assertMatchesRegularExpression("/<div id=\"content\">\s*posts index\s*<\/div>/", $result);
|
||||||
$this->assertRegExp("/<div id=\"content\">\s*posts index\s*<\/div>/", $result);
|
$this->assertMatchesRegularExpression("/<div id=\"content\">\s*posts index\s*<\/div>/", $result);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1169,7 +1169,7 @@ class ViewTest extends CakeTestCase {
|
||||||
|
|
||||||
$this->assertEquals('cache_form', $View->view);
|
$this->assertEquals('cache_form', $View->view);
|
||||||
$result = $View->render();
|
$result = $View->render();
|
||||||
$this->assertRegExp('/Add User/', $result);
|
$this->assertMatchesRegularExpression('/Add User/', $result);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1202,8 +1202,8 @@ class ViewTest extends CakeTestCase {
|
||||||
$View = new View($Controller);
|
$View = new View($Controller);
|
||||||
$result = $View->render('helper_overwrite', false);
|
$result = $View->render('helper_overwrite', false);
|
||||||
|
|
||||||
$this->assertRegExp('/I am some test html/', $result);
|
$this->assertMatchesRegularExpression('/I am some test html/', $result);
|
||||||
$this->assertRegExp('/Test link/', $result);
|
$this->assertMatchesRegularExpression('/Test link/', $result);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1215,19 +1215,19 @@ class ViewTest extends CakeTestCase {
|
||||||
$View = new TestView($this->PostsController);
|
$View = new TestView($this->PostsController);
|
||||||
|
|
||||||
$result = $View->getViewFileName('index');
|
$result = $View->getViewFileName('index');
|
||||||
$this->assertRegExp('/Posts(\/|\\\)index.ctp/', $result);
|
$this->assertMatchesRegularExpression('/Posts(\/|\\\)index.ctp/', $result);
|
||||||
|
|
||||||
$result = $View->getViewFileName('TestPlugin.index');
|
$result = $View->getViewFileName('TestPlugin.index');
|
||||||
$this->assertRegExp('/Posts(\/|\\\)index.ctp/', $result);
|
$this->assertMatchesRegularExpression('/Posts(\/|\\\)index.ctp/', $result);
|
||||||
|
|
||||||
$result = $View->getViewFileName('/Pages/home');
|
$result = $View->getViewFileName('/Pages/home');
|
||||||
$this->assertRegExp('/Pages(\/|\\\)home.ctp/', $result);
|
$this->assertMatchesRegularExpression('/Pages(\/|\\\)home.ctp/', $result);
|
||||||
|
|
||||||
$result = $View->getViewFileName('../Elements/test_element');
|
$result = $View->getViewFileName('../Elements/test_element');
|
||||||
$this->assertRegExp('/Elements(\/|\\\)test_element.ctp/', $result);
|
$this->assertMatchesRegularExpression('/Elements(\/|\\\)test_element.ctp/', $result);
|
||||||
|
|
||||||
$result = $View->getViewFileName('../Themed/TestTheme/Posts/index');
|
$result = $View->getViewFileName('../Themed/TestTheme/Posts/index');
|
||||||
$this->assertRegExp('/Themed(\/|\\\)TestTheme(\/|\\\)Posts(\/|\\\)index.ctp/', $result);
|
$this->assertMatchesRegularExpression('/Themed(\/|\\\)TestTheme(\/|\\\)Posts(\/|\\\)index.ctp/', $result);
|
||||||
|
|
||||||
$expected = CAKE . 'Test' . DS . 'test_app' . DS . 'View' . DS . 'Posts' . DS . 'index.ctp';
|
$expected = CAKE . 'Test' . DS . 'test_app' . DS . 'View' . DS . 'Posts' . DS . 'index.ctp';
|
||||||
$result = $View->getViewFileName('../Posts/index');
|
$result = $View->getViewFileName('../Posts/index');
|
||||||
|
@ -1263,7 +1263,7 @@ class ViewTest extends CakeTestCase {
|
||||||
fclose($f);
|
fclose($f);
|
||||||
$result = $View->renderCache($path, '+1 second');
|
$result = $View->renderCache($path, '+1 second');
|
||||||
|
|
||||||
$this->assertRegExp('/^some cacheText/', $result);
|
$this->assertMatchesRegularExpression('/^some cacheText/', $result);
|
||||||
|
|
||||||
if (file_exists($path)) {
|
if (file_exists($path)) {
|
||||||
unlink($path);
|
unlink($path);
|
||||||
|
|
Loading…
Reference in a new issue