mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
Simplify assertions in tests
This commit is contained in:
parent
90ddb43632
commit
d5ac7aa0b2
1 changed files with 17 additions and 52 deletions
|
@ -380,25 +380,12 @@ class ExtractTaskTest extends CakeTestCase {
|
||||||
|
|
||||||
$this->Task->execute();
|
$this->Task->execute();
|
||||||
$result = file_get_contents($this->path . DS . 'default.pot');
|
$result = file_get_contents($this->path . DS . 'default.pot');
|
||||||
|
$this->assertContains('Model/PersisterOne.php:validation for field title', $result);
|
||||||
$pattern = preg_quote('#Model/PersisterOne.php:validation for field title#', '/');
|
$this->assertContains('Model/PersisterOne.php:validation for field body', $result);
|
||||||
$this->assertRegExp($pattern, $result);
|
$this->assertContains('msgid "Post title is required"', $result);
|
||||||
|
$this->assertContains('msgid "You may enter up to %s chars (minimum is %s chars)"', $result);
|
||||||
$pattern = preg_quote('#Model/PersisterOne.php:validation for field body#', '/');
|
$this->assertContains('msgid "Post body is required"', $result);
|
||||||
$this->assertRegExp($pattern, $result);
|
$this->assertContains('msgid "Post body is super required"', $result);
|
||||||
|
|
||||||
$pattern = '#msgid "Post title is required"#';
|
|
||||||
$this->assertRegExp($pattern, $result);
|
|
||||||
|
|
||||||
$pattern = '#msgid "You may enter up to %s chars \(minimum is %s chars\)"#';
|
|
||||||
$this->assertRegExp($pattern, $result);
|
|
||||||
|
|
||||||
$pattern = '#msgid "Post body is required"#';
|
|
||||||
$this->assertRegExp($pattern, $result);
|
|
||||||
|
|
||||||
$pattern = '#msgid "Post body is super required"#';
|
|
||||||
$this->assertRegExp($pattern, $result);
|
|
||||||
|
|
||||||
$this->assertContains('msgid "double \\"quoted\\" validation"', $result, 'Strings with quotes not handled correctly');
|
$this->assertContains('msgid "double \\"quoted\\" validation"', $result, 'Strings with quotes not handled correctly');
|
||||||
$this->assertContains("msgid \"single 'quoted' validation\"", $result, 'Strings with quotes not handled correctly');
|
$this->assertContains("msgid \"single 'quoted' validation\"", $result, 'Strings with quotes not handled correctly');
|
||||||
}
|
}
|
||||||
|
@ -429,21 +416,11 @@ class ExtractTaskTest extends CakeTestCase {
|
||||||
|
|
||||||
$this->Task->execute();
|
$this->Task->execute();
|
||||||
$result = file_get_contents($this->path . DS . 'test_plugin.pot');
|
$result = file_get_contents($this->path . DS . 'test_plugin.pot');
|
||||||
|
$this->assertContains('Plugin/TestPlugin/Model/TestPluginPost.php:validation for field title', $result);
|
||||||
$pattern = preg_quote('#Plugin/TestPlugin/Model/TestPluginPost.php:validation for field title#', '/');
|
$this->assertContains('Plugin/TestPlugin/Model/TestPluginPost.php:validation for field body', $result);
|
||||||
$this->assertRegExp($pattern, $result);
|
$this->assertContains('msgid "Post title is required"', $result);
|
||||||
|
$this->assertContains('msgid "Post body is required"', $result);
|
||||||
$pattern = preg_quote('#Plugin/TestPlugin/Model/TestPluginPost.php:validation for field body#', '/');
|
$this->assertContains('msgid "Post body is super required"', $result);
|
||||||
$this->assertRegExp($pattern, $result);
|
|
||||||
|
|
||||||
$pattern = '#msgid "Post title is required"#';
|
|
||||||
$this->assertRegExp($pattern, $result);
|
|
||||||
|
|
||||||
$pattern = '#msgid "Post body is required"#';
|
|
||||||
$this->assertRegExp($pattern, $result);
|
|
||||||
|
|
||||||
$pattern = '#msgid "Post body is super required"#';
|
|
||||||
$this->assertRegExp($pattern, $result);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -468,24 +445,12 @@ class ExtractTaskTest extends CakeTestCase {
|
||||||
|
|
||||||
$this->Task->execute();
|
$this->Task->execute();
|
||||||
$result = file_get_contents($this->path . DS . 'test_plugin.pot');
|
$result = file_get_contents($this->path . DS . 'test_plugin.pot');
|
||||||
|
$this->assertContains('Model/TestPluginPost.php:validation for field title', $result);
|
||||||
$pattern = preg_quote('#Model/TestPluginPost.php:validation for field title#', '/');
|
$this->assertContains('Model/TestPluginPost.php:validation for field body', $result);
|
||||||
$this->assertRegExp($pattern, $result);
|
$this->assertContains('msgid "Post title is required"', $result);
|
||||||
|
$this->assertContains('msgid "Post body is required"', $result);
|
||||||
$pattern = preg_quote('#Model/TestPluginPost.php:validation for field body#', '/');
|
$this->assertContains('msgid "Post body is super required"', $result);
|
||||||
$this->assertRegExp($pattern, $result);
|
$this->assertNotContains('Plugin/TestPlugin/Model/TestPluginPost.php:validation for field title', $result);
|
||||||
|
|
||||||
$pattern = '#msgid "Post title is required"#';
|
|
||||||
$this->assertRegExp($pattern, $result);
|
|
||||||
|
|
||||||
$pattern = '#msgid "Post body is required"#';
|
|
||||||
$this->assertRegExp($pattern, $result);
|
|
||||||
|
|
||||||
$pattern = '#msgid "Post body is super required"#';
|
|
||||||
$this->assertRegExp($pattern, $result);
|
|
||||||
|
|
||||||
$pattern = '#Plugin/TestPlugin/Model/TestPluginPost.php:validation for field title#';
|
|
||||||
$this->assertNotRegExp($pattern, $result);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in a new issue