mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
Merge branch 'master' into 2.7
Conflicts: lib/Cake/VERSION.txt
This commit is contained in:
commit
d21ae178bf
8 changed files with 57 additions and 15 deletions
|
@ -70,6 +70,12 @@ Cache::config('default', array('engine' => 'File'));
|
|||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* To prefer app translation over plugin translation, you can set
|
||||
*
|
||||
* Configure::write('I18n.preferApp', true);
|
||||
*/
|
||||
|
||||
/**
|
||||
* You can attach event listeners to the request lifecycle as Dispatcher Filter. By default CakePHP bundles two filters:
|
||||
*
|
||||
|
|
|
@ -926,7 +926,7 @@ class ModelTask extends BakeTask {
|
|||
$tableIsGood = $this->in(__d('cake_console', 'Do you want to use this table?'), array('y', 'n'), 'y');
|
||||
}
|
||||
if (strtolower($tableIsGood) === 'n') {
|
||||
$useTable = $this->in(__d('cake_console', 'What is the name of the table?'));
|
||||
$useTable = $this->in(__d('cake_console', 'What is the name of the table (without prefix)?'));
|
||||
}
|
||||
}
|
||||
return $useTable;
|
||||
|
|
|
@ -387,7 +387,9 @@ class I18n {
|
|||
$pluginDomain = Inflector::underscore($plugin);
|
||||
if ($pluginDomain === $domain) {
|
||||
$searchPaths[] = CakePlugin::path($plugin) . 'Locale' . DS;
|
||||
$searchPaths = array_reverse($searchPaths);
|
||||
if (!Configure::read('I18n.preferApp')) {
|
||||
$searchPaths = array_reverse($searchPaths);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1758,6 +1758,30 @@ class I18nTest extends CakeTestCase {
|
|||
$this->assertTrue(in_array('25 = 0 or > 1 (from plugin)', $plurals));
|
||||
}
|
||||
|
||||
/**
|
||||
* Test that Configure::read('I18n.preferApp') will prefer app.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testPluginTranslationPreferApp() {
|
||||
// Reset internally stored entries
|
||||
I18n::clear();
|
||||
Cache::clear(false, '_cake_core_');
|
||||
|
||||
Configure::write('I18n.preferApp', true);
|
||||
|
||||
App::build(array(
|
||||
'Plugin' => array(CAKE . 'Test' . DS . 'test_app' . DS . 'Plugin' . DS)
|
||||
));
|
||||
|
||||
Configure::write('Config.language', 'po');
|
||||
$singular = $this->_domainSingular();
|
||||
$this->assertEquals('Plural Rule 1', $singular);
|
||||
|
||||
$plurals = $this->_domainPlural();
|
||||
$this->assertTrue(in_array('0 = 0 or > 1', $plurals));
|
||||
}
|
||||
|
||||
/**
|
||||
* testPoMultipleLineTranslation method
|
||||
*
|
||||
|
|
|
@ -77,9 +77,6 @@ class MediaViewTest extends CakeTestCase {
|
|||
array('name' => null, 'download' => null)
|
||||
);
|
||||
|
||||
$this->MediaView->response->expects($this->once())
|
||||
->method('send');
|
||||
|
||||
$this->MediaView->render();
|
||||
}
|
||||
|
||||
|
@ -115,9 +112,6 @@ class MediaViewTest extends CakeTestCase {
|
|||
)
|
||||
);
|
||||
|
||||
$this->MediaView->response->expects($this->once())
|
||||
->method('send');
|
||||
|
||||
$this->MediaView->render();
|
||||
}
|
||||
|
||||
|
@ -137,10 +131,6 @@ class MediaViewTest extends CakeTestCase {
|
|||
->with('jpg')
|
||||
->will($this->returnArgument(0));
|
||||
|
||||
$this->MediaView->response->expects($this->at(0))
|
||||
->method('send')
|
||||
->will($this->returnValue(true));
|
||||
|
||||
$this->MediaView->render();
|
||||
}
|
||||
|
||||
|
|
21
lib/Cake/Test/test_app/Locale/po/LC_MESSAGES/test_plugin.po
Normal file
21
lib/Cake/Test/test_app/Locale/po/LC_MESSAGES/test_plugin.po
Normal file
|
@ -0,0 +1,21 @@
|
|||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: CakePHP Testsuite\n"
|
||||
"POT-Creation-Date: 2008-05-15 02:51-0700\n"
|
||||
"PO-Revision-Date: \n"
|
||||
"Last-Translator: CakePHP I18N & I10N Team <i10n.cakephp@gmail.com>\n"
|
||||
"Language-Team: CakePHP I18N & I10N Team <i10n.cakephp@gmail.com>\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"Plural-Forms: nplurals=2; plural=n != 1;\n"
|
||||
"X-Poedit-Language: Two Forms of Plurals\n"
|
||||
"X-Poedit-SourceCharset: utf-8\n"
|
||||
|
||||
msgid "Plural Rule 1"
|
||||
msgstr "Plural Rule 1"
|
||||
|
||||
msgid "%d = 1"
|
||||
msgid_plural "%d = 0 or > 1"
|
||||
msgstr[0] "%d = 1"
|
||||
msgstr[1] "%d = 0 or > 1"
|
|
@ -210,12 +210,12 @@ abstract class ControllerTestCase extends CakeTestCase {
|
|||
* - `result` Get the return value of the controller action. Useful
|
||||
* for testing requestAction methods.
|
||||
*
|
||||
* @param string $url The url to test
|
||||
* @param string $url The URL to test
|
||||
* @param array $options See options
|
||||
* @return mixed The specified return type.
|
||||
* @triggers ControllerTestCase $Dispatch, array('request' => $request)
|
||||
*/
|
||||
protected function _testAction($url = '', $options = array()) {
|
||||
protected function _testAction($url, $options = array()) {
|
||||
$this->vars = $this->result = $this->view = $this->contents = $this->headers = null;
|
||||
|
||||
$options += array(
|
||||
|
|
|
@ -93,7 +93,6 @@ class MediaView extends View {
|
|||
if ($compress) {
|
||||
$this->response->compress();
|
||||
}
|
||||
$this->response->send();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue