diff --git a/README.md b/README.md
index e38062eef..7f178f870 100644
--- a/README.md
+++ b/README.md
@@ -17,7 +17,7 @@ Some Handy Links
[The Bakery](http://bakery.cakephp.org) - Tips, tutorials and articles
-[API](http://api.cakephp.org) - A reference to Cake's classes
+[API](http://api.cakephp.org) - A reference to CakePHP's classes
[CakePHP TV](http://tv.cakephp.org) - Screen casts from events and video tutorials
diff --git a/app/Config/database.php.default b/app/Config/database.php.default
index 684fecdf9..47613acf1 100644
--- a/app/Config/database.php.default
+++ b/app/Config/database.php.default
@@ -2,7 +2,7 @@
/**
* This is core configuration file.
*
- * Use it to configure core behaviour of Cake.
+ * Use it to configure core behaviour of CakePHP.
*
* PHP 5
*
diff --git a/app/Config/email.php.default b/app/Config/email.php.default
index a2d355e47..717a45860 100644
--- a/app/Config/email.php.default
+++ b/app/Config/email.php.default
@@ -2,7 +2,7 @@
/**
* This is email configuration file.
*
- * Use it to configure email transports of Cake.
+ * Use it to configure email transports of CakePHP.
*
* PHP 5
*
diff --git a/app/Model/AppModel.php b/app/Model/AppModel.php
index c47d72922..5b79d2a04 100644
--- a/app/Model/AppModel.php
+++ b/app/Model/AppModel.php
@@ -1,6 +1,6 @@
_loadModels();
+ $this->loadTasks();
}
/**
diff --git a/lib/Cake/Console/ShellDispatcher.php b/lib/Cake/Console/ShellDispatcher.php
index ab1709131..b9841744d 100644
--- a/lib/Cake/Console/ShellDispatcher.php
+++ b/lib/Cake/Console/ShellDispatcher.php
@@ -114,7 +114,7 @@ class ShellDispatcher {
}
/**
- * Initializes the environment and loads the Cake core.
+ * Initializes the environment and loads the CakePHP core.
*
* @return boolean Success.
*/
@@ -206,7 +206,6 @@ class ShellDispatcher {
if ($Shell instanceof Shell) {
$Shell->initialize();
- $Shell->loadTasks();
return $Shell->runCommand($command, $this->args);
}
$methods = array_diff(get_class_methods($Shell), get_class_methods('Shell'));
diff --git a/lib/Cake/Controller/Component/AuthComponent.php b/lib/Cake/Controller/Component/AuthComponent.php
index fe1f1e8af..2a0097921 100644
--- a/lib/Cake/Controller/Component/AuthComponent.php
+++ b/lib/Cake/Controller/Component/AuthComponent.php
@@ -304,7 +304,10 @@ class AuthComponent extends Component {
return $this->_unauthenticated($controller);
}
- if (empty($this->authorize) || $this->isAuthorized($this->user())) {
+ if ($this->_isLoginAction($controller) ||
+ empty($this->authorize) ||
+ $this->isAuthorized($this->user())
+ ) {
return true;
}
@@ -347,6 +350,11 @@ class AuthComponent extends Component {
}
if ($this->_isLoginAction($controller)) {
+ if (empty($controller->request->data)) {
+ if (!$this->Session->check('Auth.redirect') && env('HTTP_REFERER')) {
+ $this->Session->write('Auth.redirect', $controller->referer(null, true));
+ }
+ }
return true;
}
@@ -367,9 +375,7 @@ class AuthComponent extends Component {
}
/**
- * Normalizes $loginAction and checks if current request url is same as login
- * action. If current url is same as login action, referrer url is saved in session
- * which is later accessible using redirectUrl().
+ * Normalizes $loginAction and checks if current request url is same as login action.
*
* @param Controller $controller A reference to the controller object.
* @return boolean True if current action is login action else false.
@@ -382,15 +388,7 @@ class AuthComponent extends Component {
$url = Router::normalize($url);
$loginAction = Router::normalize($this->loginAction);
- if ($loginAction == $url) {
- if (empty($controller->request->data)) {
- if (!$this->Session->check('Auth.redirect') && env('HTTP_REFERER')) {
- $this->Session->write('Auth.redirect', $controller->referer(null, true));
- }
- }
- return true;
- }
- return false;
+ return $loginAction === $url;
}
/**
diff --git a/lib/Cake/Controller/Controller.php b/lib/Cake/Controller/Controller.php
index b3982bfe4..0f36fb7f5 100644
--- a/lib/Cake/Controller/Controller.php
+++ b/lib/Cake/Controller/Controller.php
@@ -207,7 +207,7 @@ class Controller extends Object implements CakeEventListener {
public $View;
/**
- * File extension for view templates. Defaults to Cake's conventional ".ctp".
+ * File extension for view templates. Defaults to CakePHP's conventional ".ctp".
*
* @var string
*/
diff --git a/lib/Cake/Model/Datasource/CakeSession.php b/lib/Cake/Model/Datasource/CakeSession.php
index 04d1dc9f5..6ce55ff47 100644
--- a/lib/Cake/Model/Datasource/CakeSession.php
+++ b/lib/Cake/Model/Datasource/CakeSession.php
@@ -1,8 +1,8 @@
_configClass) && !config('email')) {
throw new ConfigureException(__d('cake_dev', '%s not found.', APP . 'Config' . DS . 'email.php'));
}
- $configs = new EmailConfig();
+ $configs = new $this->_configClass();
if (!isset($configs->{$config})) {
throw new ConfigureException(__d('cake_dev', 'Unknown email configuration "%s".', $config));
}
diff --git a/lib/Cake/Routing/Dispatcher.php b/lib/Cake/Routing/Dispatcher.php
index aed253a88..2ad4efa53 100644
--- a/lib/Cake/Routing/Dispatcher.php
+++ b/lib/Cake/Routing/Dispatcher.php
@@ -3,7 +3,7 @@
* Dispatcher takes the URL information, parses it for parameters and
* tells the involved controllers what to do.
*
- * This is the heart of Cake's operation.
+ * This is the heart of CakePHP's operation.
*
* PHP 5
*
diff --git a/lib/Cake/Test/Case/Console/ShellDispatcherTest.php b/lib/Cake/Test/Case/Console/ShellDispatcherTest.php
index 3d647be48..520ed6448 100644
--- a/lib/Cake/Test/Case/Console/ShellDispatcherTest.php
+++ b/lib/Cake/Test/Case/Console/ShellDispatcherTest.php
@@ -441,7 +441,6 @@ class ShellDispatcherTest extends CakeTestCase {
$Mock = $this->getMock('Shell', array(), array(), 'MockWithMainShell');
$Mock->expects($this->once())->method('initialize');
- $Mock->expects($this->once())->method('loadTasks');
$Mock->expects($this->once())->method('runCommand')
->with(null, array())
->will($this->returnValue(true));
@@ -467,7 +466,6 @@ class ShellDispatcherTest extends CakeTestCase {
$this->mockObjects[] = $Shell;
$Shell->expects($this->once())->method('initialize');
- $Shell->expects($this->once())->method('loadTasks');
$Shell->expects($this->once())->method('runCommand')
->with('initdb', array('initdb'))
->will($this->returnValue(true));
@@ -491,7 +489,6 @@ class ShellDispatcherTest extends CakeTestCase {
$Shell = $this->getMock('Object', $methods, array(), 'MockWithMainNotAShell');
$Shell->expects($this->never())->method('initialize');
- $Shell->expects($this->never())->method('loadTasks');
$Shell->expects($this->once())->method('startup');
$Shell->expects($this->once())->method('main')->will($this->returnValue(true));
$Dispatcher->TestShell = $Shell;
@@ -524,7 +521,6 @@ class ShellDispatcherTest extends CakeTestCase {
$Shell = $this->getMock('Object', $methods, array(&$Dispatcher), 'MockWithoutMainNotAShell');
$Shell->expects($this->never())->method('initialize');
- $Shell->expects($this->never())->method('loadTasks');
$Shell->expects($this->once())->method('startup');
$Shell->expects($this->once())->method('main')->will($this->returnValue(true));
$Dispatcher->TestShell = $Shell;
diff --git a/lib/Cake/Test/Case/Console/ShellTest.php b/lib/Cake/Test/Case/Console/ShellTest.php
index 10e15be6a..cd10eb13d 100644
--- a/lib/Cake/Test/Case/Console/ShellTest.php
+++ b/lib/Cake/Test/Case/Console/ShellTest.php
@@ -195,6 +195,7 @@ class ShellTest extends CakeTestCase {
), App::RESET);
CakePlugin::load('TestPlugin');
+ $this->Shell->tasks = array('DbConfig' => array('one', 'two'));
$this->Shell->uses = array('TestPlugin.TestPluginPost');
$this->Shell->initialize();
@@ -208,6 +209,7 @@ class ShellTest extends CakeTestCase {
$this->assertTrue(isset($this->Shell->Comment));
$this->assertInstanceOf('Comment', $this->Shell->Comment);
$this->assertEquals('Comment', $this->Shell->modelClass);
+ $this->assertInstanceOf('DbConfigTask', $this->Shell->DbConfig);
App::build();
}
diff --git a/lib/Cake/Test/Case/Controller/Component/AuthComponentTest.php b/lib/Cake/Test/Case/Controller/Component/AuthComponentTest.php
index 1fcf626bb..89826f5a2 100644
--- a/lib/Cake/Test/Case/Controller/Component/AuthComponentTest.php
+++ b/lib/Cake/Test/Case/Controller/Component/AuthComponentTest.php
@@ -876,6 +876,28 @@ class AuthComponentTest extends CakeTestCase {
$this->Auth->Session->delete('Auth');
}
+/**
+ * testNoLoginRedirectForAuthenticatedUser method
+ *
+ * @return void
+ */
+ public function testNoLoginRedirectForAuthenticatedUser() {
+ $this->Controller->request['controller'] = 'auth_test';
+ $this->Controller->request['action'] = 'login';
+ $this->Controller->here = '/auth_test/login';
+ $this->Auth->request->url = 'auth_test/login';
+
+ $this->Auth->Session->write('Auth.User.id', '1');
+ $this->Auth->authenticate = array('Form');
+ $this->getMock('BaseAuthorize', array('authorize'), array(), 'NoLoginRedirectMockAuthorize', false);
+ $this->Auth->authorize = array('NoLoginRedirectMockAuthorize');
+ $this->Auth->loginAction = array('controller' => 'auth_test', 'action' => 'login');
+
+ $return = $this->Auth->startup($this->Controller);
+ $this->assertTrue($return);
+ $this->assertNull($this->Controller->testUrl);
+ }
+
/**
* Default to loginRedirect, if set, on authError.
*
diff --git a/lib/Cake/Test/Case/Model/Behavior/ContainableBehaviorTest.php b/lib/Cake/Test/Case/Model/Behavior/ContainableBehaviorTest.php
index 57a390069..dc0e44b6e 100644
--- a/lib/Cake/Test/Case/Model/Behavior/ContainableBehaviorTest.php
+++ b/lib/Cake/Test/Case/Model/Behavior/ContainableBehaviorTest.php
@@ -3477,7 +3477,7 @@ class ContainableBehaviorTest extends CakeTestCase {
'joinTable' => 'articles_tags',
'foreignKey' => 'article_id',
'associationForeignKey' => 'tag_id',
- // LENGHT function mysql-only, using LIKE does almost the same
+ // LENGTH function mysql-only, using LIKE does almost the same
'conditions' => "ShortTag.tag LIKE '???'"
)
)
diff --git a/lib/Cake/Test/Case/Model/CakeSchemaTest.php b/lib/Cake/Test/Case/Model/CakeSchemaTest.php
index 07afe7fee..244568adc 100644
--- a/lib/Cake/Test/Case/Model/CakeSchemaTest.php
+++ b/lib/Cake/Test/Case/Model/CakeSchemaTest.php
@@ -703,7 +703,7 @@ class CakeSchemaTest extends CakeTestCase {
);
$result = $this->Schema->generateTable('fields', $posts);
$this->assertRegExp('/public \$fields/', $result);
- $this->assertPattern('/\'type\' \=\> \'fulltext\'/', $result);
+ $this->assertRegExp('/\'type\' \=\> \'fulltext\'/', $result);
}
/**
diff --git a/lib/Cake/Test/Case/Model/Datasource/DboSourceTest.php b/lib/Cake/Test/Case/Model/Datasource/DboSourceTest.php
index bcfd5a060..7fc9a80cc 100644
--- a/lib/Cake/Test/Case/Model/Datasource/DboSourceTest.php
+++ b/lib/Cake/Test/Case/Model/Datasource/DboSourceTest.php
@@ -951,6 +951,9 @@ class DboSourceTest extends CakeTestCase {
* @return void
*/
public function testFieldsCacheKeyWithSchemanameChange() {
+ if ($this->db instanceof Postgres || $this->db instanceof Sqlserver) {
+ $this->markTestSkipped('Cannot run this test with SqlServer or Postgres');
+ }
Cache::delete('method_cache', '_cake_core_');
DboSource::$methodCache = array();
$Article = ClassRegistry::init('Article');
diff --git a/lib/Cake/Test/Case/Model/ModelCrossSchemaHabtmTest.php b/lib/Cake/Test/Case/Model/ModelCrossSchemaHabtmTest.php
index bc06c1e65..4081d5ee2 100644
--- a/lib/Cake/Test/Case/Model/ModelCrossSchemaHabtmTest.php
+++ b/lib/Cake/Test/Case/Model/ModelCrossSchemaHabtmTest.php
@@ -147,7 +147,7 @@ class ModelCrossSchemaHabtmTest extends BaseModelTest {
));
$results = $Player->saveAll($player, array('validate' => 'first'));
- $this->assertNotEqual(false, $results);
+ $this->assertNotSame(false, $results);
$count = $Player->find('count');
$this->assertEquals(5, $count);
diff --git a/lib/Cake/Test/Case/Network/Email/CakeEmailTest.php b/lib/Cake/Test/Case/Network/Email/CakeEmailTest.php
index 025d96530..9fbb8c207 100644
--- a/lib/Cake/Test/Case/Network/Email/CakeEmailTest.php
+++ b/lib/Cake/Test/Case/Network/Email/CakeEmailTest.php
@@ -26,6 +26,15 @@ App::uses('CakeEmail', 'Network/Email');
*/
class TestCakeEmail extends CakeEmail {
+/**
+ * Config classname.
+ *
+ * Use a the testing config class in this file.
+ *
+ * @var string
+ */
+ protected $_configClass = 'TestEmailConfig';
+
/**
* Config
*
@@ -79,7 +88,7 @@ class TestCakeEmail extends CakeEmail {
* EmailConfig class
*
*/
-class EmailConfig {
+class TestEmailConfig {
/**
* test config
@@ -841,7 +850,7 @@ class CakeEmailTest extends CakeTestCase {
* @return void
*/
public function testConfigString() {
- $configs = new EmailConfig();
+ $configs = new TestEmailConfig();
$this->CakeEmail->config('test');
$result = $this->CakeEmail->to();
@@ -1767,8 +1776,8 @@ class CakeEmailTest extends CakeTestCase {
* @return void
*/
public function testConstructWithConfigString() {
- $configs = new EmailConfig();
- $this->CakeEmail = new CakeEmail('test');
+ $configs = new TestEmailConfig();
+ $this->CakeEmail = new TestCakeEmail('test');
$result = $this->CakeEmail->to();
$this->assertEquals($configs->test['to'], $result);
diff --git a/lib/Cake/Test/Case/View/Helper/FormHelperTest.php b/lib/Cake/Test/Case/View/Helper/FormHelperTest.php
index 97dd8a0ae..0959c9ce6 100644
--- a/lib/Cake/Test/Case/View/Helper/FormHelperTest.php
+++ b/lib/Cake/Test/Case/View/Helper/FormHelperTest.php
@@ -6754,7 +6754,7 @@ class FormHelperTest extends CakeTestCase {
$result = $matches[1];
$expected = range(date('Y') + 20, 1930);
- $this->assertEquals($result, $expected);
+ $this->assertEquals($expected, $result);
$this->Form->request->data['Project']['release'] = '2050-10-10';
$result = $this->Form->year('Project.release');
@@ -6762,7 +6762,7 @@ class FormHelperTest extends CakeTestCase {
$result = $matches[1];
$expected = range(2050, date('Y') - 20);
- $this->assertEquals($result, $expected);
+ $this->assertEquals($expected, $result);
$this->Form->request->data['Project']['release'] = '1881-10-10';
$result = $this->Form->year('Project.release', 1890, 1900);
@@ -6770,7 +6770,7 @@ class FormHelperTest extends CakeTestCase {
$result = $matches[1];
$expected = range(1900, 1881);
- $this->assertEquals($result, $expected);
+ $this->assertEquals($expected, $result);
}
/**
@@ -9312,7 +9312,7 @@ class FormHelperTest extends CakeTestCase {
'div' => false,
'label' => false,
);
- $this->assertEqual($result, $expected);
+ $this->assertEquals($expected, $result);
}
}
diff --git a/lib/Cake/Test/Case/View/Helper/HtmlHelperTest.php b/lib/Cake/Test/Case/View/Helper/HtmlHelperTest.php
index 9b4ceb70c..d0957653f 100644
--- a/lib/Cake/Test/Case/View/Helper/HtmlHelperTest.php
+++ b/lib/Cake/Test/Case/View/Helper/HtmlHelperTest.php
@@ -1844,13 +1844,13 @@ class HtmlHelperTest extends CakeTestCase {
$this->assertTags($result, array('div' => array('class' => 'class-name'), '<text>', '/div'));
$result = $this->Html->tag(false, 'stuff');
- $this->assertEquals($result, 'stuff');
+ $this->assertEquals('stuff', $result);
$result = $this->Html->tag(null, 'stuff');
- $this->assertEquals($result, 'stuff');
+ $this->assertEquals('stuff', $result);
$result = $this->Html->tag('', 'stuff');
- $this->assertEquals($result, 'stuff');
+ $this->assertEquals('stuff', $result);
}
/**
diff --git a/lib/Cake/Test/Case/View/Helper/PaginatorHelperTest.php b/lib/Cake/Test/Case/View/Helper/PaginatorHelperTest.php
index 5e63a3fe5..d8f289d1f 100644
--- a/lib/Cake/Test/Case/View/Helper/PaginatorHelperTest.php
+++ b/lib/Cake/Test/Case/View/Helper/PaginatorHelperTest.php
@@ -2233,7 +2233,7 @@ class PaginatorHelperTest extends CakeTestCase {
*/
public function testParam() {
$result = $this->Paginator->param('count');
- $this->assertIdentical(62, $result);
+ $this->assertSame(62, $result);
$result = $this->Paginator->param('imaginary');
$this->assertNull($result);
diff --git a/lib/Cake/Test/Case/View/Helper/TextHelperTest.php b/lib/Cake/Test/Case/View/Helper/TextHelperTest.php
index 887f84372..2fc6f21ab 100644
--- a/lib/Cake/Test/Case/View/Helper/TextHelperTest.php
+++ b/lib/Cake/Test/Case/View/Helper/TextHelperTest.php
@@ -241,6 +241,14 @@ class TextHelperTest extends CakeTestCase {
'Text with a url http://www.not--work.com and more',
'Text with a url http://www.not--work.com and more',
),
+ array(
+ 'Text with a partial www.küchenschöhn-not-working.de URL',
+ 'Text with a partial www.küchenschöhn-not-working.de URL'
+ ),
+ array(
+ 'Text with a partial http://www.küchenschöhn-not-working.de URL',
+ 'Text with a partial http://www.küchenschöhn-not-working.de URL'
+ )
);
}
@@ -351,6 +359,16 @@ class TextHelperTest extends CakeTestCase {
$expected = 'Text with email@example.com address';
$result = $this->Text->autoLinkEmails($text, array('class' => 'link'));
$this->assertRegExp('#^' . $expected . '$#', $result);
+
+ $text = 'Text with düsentrieb@küchenschöhn-not-working.de address';
+ $expected = 'Text with düsentrieb@küchenschöhn-not-working.de address';
+ $result = $this->Text->autoLinkEmails($text);
+ $this->assertRegExp('#^' . $expected . '$#', $result);
+
+ $text = 'Text with me@subdomain.küchenschöhn.de address';
+ $expected = 'Text with me@subdomain.küchenschöhn.de address';
+ $result = $this->Text->autoLinkEmails($text);
+ $this->assertRegExp('#^' . $expected . '$#', $result);
}
/**
@@ -383,7 +401,7 @@ TEXT;
TEXT;
$result = $this->Text->autoParagraph($text);
- $this->assertEquals($expected, $result);
+ $this->assertTextEquals($expected, $result);
$result = $this->Text->autoParagraph($text);
$text = 'This is a
test text';
$expected = <<Text->autoParagraph($text);
- $this->assertEquals($expected, $result);
+ $this->assertTextEquals($expected, $result);
$text = <<
TEXT;
$result = $this->Text->autoParagraph($text);
- $this->assertEquals($expected, $result);
+ $this->assertTextEquals($expected, $result);
$text = <<Text->autoParagraph($text);
- $this->assertEquals($expected, $result);
+ $this->assertTextEquals($expected, $result);
}
}
diff --git a/lib/Cake/Test/Case/View/ViewTest.php b/lib/Cake/Test/Case/View/ViewTest.php
index 33bd4c267..e068964b6 100644
--- a/lib/Cake/Test/Case/View/ViewTest.php
+++ b/lib/Cake/Test/Case/View/ViewTest.php
@@ -1388,7 +1388,7 @@ class ViewTest extends CakeTestCase {
public function testBlockSetDecimal() {
$this->View->assign('testWithDecimal', 1.23456789);
$result = $this->View->fetch('testWithDecimal');
- $this->assertEqual('1.23456789', $result);
+ $this->assertEquals('1.23456789', $result);
}
/**
diff --git a/lib/Cake/Test/Fixture/AssertTagsTestCase.php b/lib/Cake/Test/Fixture/AssertTagsTestCase.php
index 42bebde9a..9391dd426 100644
--- a/lib/Cake/Test/Fixture/AssertTagsTestCase.php
+++ b/lib/Cake/Test/Fixture/AssertTagsTestCase.php
@@ -1,6 +1,6 @@
_placeholders = array();
$options += array('escape' => true);
- $pattern = '#(?)((?:https?|ftp|nntp)://[a-z0-9.\-:]+(?:[/?][^\s<]*)?)#i';
+ $pattern = '#(?)((?:https?|ftp|nntp)://[\p{L}0-9.\-:]+(?:[/?][^\s<]*)?)#ui';
$text = preg_replace_callback(
$pattern,
array(&$this, '_insertPlaceHolder'),
@@ -186,9 +186,9 @@ class TextHelper extends AppHelper {
$options += array('escape' => true);
$this->_placeholders = array();
- $atom = '[a-z0-9!#$%&\'*+\/=?^_`{|}~-]';
+ $atom = '[\p{L}0-9!#$%&\'*+\/=?^_`{|}~-]';
$text = preg_replace_callback(
- '/(' . $atom . '+(?:\.' . $atom . '+)*@[a-z0-9-]+(?:\.[a-z0-9-]+)+)/i',
+ '/(' . $atom . '+(?:\.' . $atom . '+)*@[\p{L}0-9-]+(?:\.[\p{L}0-9-]+)+)/ui',
array(&$this, '_insertPlaceholder'),
$text
);
diff --git a/lib/Cake/View/View.php b/lib/Cake/View/View.php
index be34de93c..3588baa5f 100644
--- a/lib/Cake/View/View.php
+++ b/lib/Cake/View/View.php
@@ -136,7 +136,7 @@ class View extends Object {
public $layoutPath = null;
/**
- * Turns on or off Cake's conventional mode of applying layout files. On by default.
+ * Turns on or off CakePHP's conventional mode of applying layout files. On by default.
* Setting to off means that layouts will not be automatically applied to rendered views.
*
* @var boolean
@@ -144,7 +144,7 @@ class View extends Object {
public $autoLayout = true;
/**
- * File extension. Defaults to Cake's template ".ctp".
+ * File extension. Defaults to CakePHP's template ".ctp".
*
* @var string
*/
diff --git a/lib/Cake/bootstrap.php b/lib/Cake/bootstrap.php
index a2c058248..9b7feca3b 100644
--- a/lib/Cake/bootstrap.php
+++ b/lib/Cake/bootstrap.php
@@ -1,6 +1,6 @@