mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
Merge branch 'master' into 2.5
This commit is contained in:
commit
5e9b22271a
34 changed files with 121 additions and 66 deletions
|
@ -17,7 +17,7 @@ Some Handy Links
|
||||||
|
|
||||||
[The Bakery](http://bakery.cakephp.org) - Tips, tutorials and articles
|
[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
|
[CakePHP TV](http://tv.cakephp.org) - Screen casts from events and video tutorials
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
/**
|
/**
|
||||||
* This is core configuration file.
|
* This is core configuration file.
|
||||||
*
|
*
|
||||||
* Use it to configure core behaviour of Cake.
|
* Use it to configure core behaviour of CakePHP.
|
||||||
*
|
*
|
||||||
* PHP 5
|
* PHP 5
|
||||||
*
|
*
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
/**
|
/**
|
||||||
* This is email configuration file.
|
* This is email configuration file.
|
||||||
*
|
*
|
||||||
* Use it to configure email transports of Cake.
|
* Use it to configure email transports of CakePHP.
|
||||||
*
|
*
|
||||||
* PHP 5
|
* PHP 5
|
||||||
*
|
*
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
* Application model for Cake.
|
* Application model for CakePHP.
|
||||||
*
|
*
|
||||||
* This file is application-wide model file. You can put all
|
* This file is application-wide model file. You can put all
|
||||||
* application-wide model-related methods here.
|
* application-wide model-related methods here.
|
||||||
|
|
|
@ -23,7 +23,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get Cake's root directory
|
* Get CakePHP's root directory
|
||||||
*/
|
*/
|
||||||
define('APP_DIR', 'app');
|
define('APP_DIR', 'app');
|
||||||
define('DS', DIRECTORY_SEPARATOR);
|
define('DS', DIRECTORY_SEPARATOR);
|
||||||
|
|
|
@ -201,6 +201,7 @@ class Shell extends Object {
|
||||||
*/
|
*/
|
||||||
public function initialize() {
|
public function initialize() {
|
||||||
$this->_loadModels();
|
$this->_loadModels();
|
||||||
|
$this->loadTasks();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -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.
|
* @return boolean Success.
|
||||||
*/
|
*/
|
||||||
|
@ -206,7 +206,6 @@ class ShellDispatcher {
|
||||||
|
|
||||||
if ($Shell instanceof Shell) {
|
if ($Shell instanceof Shell) {
|
||||||
$Shell->initialize();
|
$Shell->initialize();
|
||||||
$Shell->loadTasks();
|
|
||||||
return $Shell->runCommand($command, $this->args);
|
return $Shell->runCommand($command, $this->args);
|
||||||
}
|
}
|
||||||
$methods = array_diff(get_class_methods($Shell), get_class_methods('Shell'));
|
$methods = array_diff(get_class_methods($Shell), get_class_methods('Shell'));
|
||||||
|
|
|
@ -304,7 +304,10 @@ class AuthComponent extends Component {
|
||||||
return $this->_unauthenticated($controller);
|
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;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -347,6 +350,11 @@ class AuthComponent extends Component {
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($this->_isLoginAction($controller)) {
|
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;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -367,9 +375,7 @@ class AuthComponent extends Component {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Normalizes $loginAction and checks if current request url is same as login
|
* Normalizes $loginAction and checks if current request url is same as login action.
|
||||||
* action. If current url is same as login action, referrer url is saved in session
|
|
||||||
* which is later accessible using redirectUrl().
|
|
||||||
*
|
*
|
||||||
* @param Controller $controller A reference to the controller object.
|
* @param Controller $controller A reference to the controller object.
|
||||||
* @return boolean True if current action is login action else false.
|
* @return boolean True if current action is login action else false.
|
||||||
|
@ -382,15 +388,7 @@ class AuthComponent extends Component {
|
||||||
$url = Router::normalize($url);
|
$url = Router::normalize($url);
|
||||||
$loginAction = Router::normalize($this->loginAction);
|
$loginAction = Router::normalize($this->loginAction);
|
||||||
|
|
||||||
if ($loginAction == $url) {
|
return $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;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -207,7 +207,7 @@ class Controller extends Object implements CakeEventListener {
|
||||||
public $View;
|
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
|
* @var string
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
* Session class for Cake.
|
* Session class for CakePHP.
|
||||||
*
|
*
|
||||||
* Cake abstracts the handling of sessions.
|
* CakePHP abstracts the handling of sessions.
|
||||||
* There are several convenient methods to access session information.
|
* There are several convenient methods to access session information.
|
||||||
* This class is the implementation of those methods.
|
* This class is the implementation of those methods.
|
||||||
* They are mostly used by the Session Component.
|
* They are mostly used by the Session Component.
|
||||||
|
@ -27,9 +27,9 @@ App::uses('Hash', 'Utility');
|
||||||
App::uses('Security', 'Utility');
|
App::uses('Security', 'Utility');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Session class for Cake.
|
* Session class for CakePHP.
|
||||||
*
|
*
|
||||||
* Cake abstracts the handling of sessions. There are several convenient methods to access session information.
|
* CakePHP abstracts the handling of sessions. There are several convenient methods to access session information.
|
||||||
* This class is the implementation of those methods. They are mostly used by the Session Component.
|
* This class is the implementation of those methods. They are mostly used by the Session Component.
|
||||||
*
|
*
|
||||||
* @package Cake.Model.Datasource
|
* @package Cake.Model.Datasource
|
||||||
|
@ -444,7 +444,7 @@ class CakeSession {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Helper method to initialize a session, based on Cake core settings.
|
* Helper method to initialize a session, based on CakePHP core settings.
|
||||||
*
|
*
|
||||||
* Sessions can be configured with a few shortcut names as well as have any number of ini settings declared.
|
* Sessions can be configured with a few shortcut names as well as have any number of ini settings declared.
|
||||||
*
|
*
|
||||||
|
|
|
@ -325,6 +325,13 @@ class CakeEmail {
|
||||||
*/
|
*/
|
||||||
protected $_emailPattern = null;
|
protected $_emailPattern = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The classname used for email configuration.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $_configClass = 'EmailConfig';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
*
|
*
|
||||||
|
@ -1179,10 +1186,10 @@ class CakeEmail {
|
||||||
*/
|
*/
|
||||||
protected function _applyConfig($config) {
|
protected function _applyConfig($config) {
|
||||||
if (is_string($config)) {
|
if (is_string($config)) {
|
||||||
if (!class_exists('EmailConfig') && !config('email')) {
|
if (!class_exists($this->_configClass) && !config('email')) {
|
||||||
throw new ConfigureException(__d('cake_dev', '%s not found.', APP . 'Config' . DS . 'email.php'));
|
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})) {
|
if (!isset($configs->{$config})) {
|
||||||
throw new ConfigureException(__d('cake_dev', 'Unknown email configuration "%s".', $config));
|
throw new ConfigureException(__d('cake_dev', 'Unknown email configuration "%s".', $config));
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
* Dispatcher takes the URL information, parses it for parameters and
|
* Dispatcher takes the URL information, parses it for parameters and
|
||||||
* tells the involved controllers what to do.
|
* 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
|
* PHP 5
|
||||||
*
|
*
|
||||||
|
|
|
@ -441,7 +441,6 @@ class ShellDispatcherTest extends CakeTestCase {
|
||||||
$Mock = $this->getMock('Shell', array(), array(), 'MockWithMainShell');
|
$Mock = $this->getMock('Shell', array(), array(), 'MockWithMainShell');
|
||||||
|
|
||||||
$Mock->expects($this->once())->method('initialize');
|
$Mock->expects($this->once())->method('initialize');
|
||||||
$Mock->expects($this->once())->method('loadTasks');
|
|
||||||
$Mock->expects($this->once())->method('runCommand')
|
$Mock->expects($this->once())->method('runCommand')
|
||||||
->with(null, array())
|
->with(null, array())
|
||||||
->will($this->returnValue(true));
|
->will($this->returnValue(true));
|
||||||
|
@ -467,7 +466,6 @@ class ShellDispatcherTest extends CakeTestCase {
|
||||||
$this->mockObjects[] = $Shell;
|
$this->mockObjects[] = $Shell;
|
||||||
|
|
||||||
$Shell->expects($this->once())->method('initialize');
|
$Shell->expects($this->once())->method('initialize');
|
||||||
$Shell->expects($this->once())->method('loadTasks');
|
|
||||||
$Shell->expects($this->once())->method('runCommand')
|
$Shell->expects($this->once())->method('runCommand')
|
||||||
->with('initdb', array('initdb'))
|
->with('initdb', array('initdb'))
|
||||||
->will($this->returnValue(true));
|
->will($this->returnValue(true));
|
||||||
|
@ -491,7 +489,6 @@ class ShellDispatcherTest extends CakeTestCase {
|
||||||
$Shell = $this->getMock('Object', $methods, array(), 'MockWithMainNotAShell');
|
$Shell = $this->getMock('Object', $methods, array(), 'MockWithMainNotAShell');
|
||||||
|
|
||||||
$Shell->expects($this->never())->method('initialize');
|
$Shell->expects($this->never())->method('initialize');
|
||||||
$Shell->expects($this->never())->method('loadTasks');
|
|
||||||
$Shell->expects($this->once())->method('startup');
|
$Shell->expects($this->once())->method('startup');
|
||||||
$Shell->expects($this->once())->method('main')->will($this->returnValue(true));
|
$Shell->expects($this->once())->method('main')->will($this->returnValue(true));
|
||||||
$Dispatcher->TestShell = $Shell;
|
$Dispatcher->TestShell = $Shell;
|
||||||
|
@ -524,7 +521,6 @@ class ShellDispatcherTest extends CakeTestCase {
|
||||||
$Shell = $this->getMock('Object', $methods, array(&$Dispatcher), 'MockWithoutMainNotAShell');
|
$Shell = $this->getMock('Object', $methods, array(&$Dispatcher), 'MockWithoutMainNotAShell');
|
||||||
|
|
||||||
$Shell->expects($this->never())->method('initialize');
|
$Shell->expects($this->never())->method('initialize');
|
||||||
$Shell->expects($this->never())->method('loadTasks');
|
|
||||||
$Shell->expects($this->once())->method('startup');
|
$Shell->expects($this->once())->method('startup');
|
||||||
$Shell->expects($this->once())->method('main')->will($this->returnValue(true));
|
$Shell->expects($this->once())->method('main')->will($this->returnValue(true));
|
||||||
$Dispatcher->TestShell = $Shell;
|
$Dispatcher->TestShell = $Shell;
|
||||||
|
|
|
@ -195,6 +195,7 @@ class ShellTest extends CakeTestCase {
|
||||||
), App::RESET);
|
), App::RESET);
|
||||||
|
|
||||||
CakePlugin::load('TestPlugin');
|
CakePlugin::load('TestPlugin');
|
||||||
|
$this->Shell->tasks = array('DbConfig' => array('one', 'two'));
|
||||||
$this->Shell->uses = array('TestPlugin.TestPluginPost');
|
$this->Shell->uses = array('TestPlugin.TestPluginPost');
|
||||||
$this->Shell->initialize();
|
$this->Shell->initialize();
|
||||||
|
|
||||||
|
@ -208,6 +209,7 @@ class ShellTest extends CakeTestCase {
|
||||||
$this->assertTrue(isset($this->Shell->Comment));
|
$this->assertTrue(isset($this->Shell->Comment));
|
||||||
$this->assertInstanceOf('Comment', $this->Shell->Comment);
|
$this->assertInstanceOf('Comment', $this->Shell->Comment);
|
||||||
$this->assertEquals('Comment', $this->Shell->modelClass);
|
$this->assertEquals('Comment', $this->Shell->modelClass);
|
||||||
|
$this->assertInstanceOf('DbConfigTask', $this->Shell->DbConfig);
|
||||||
|
|
||||||
App::build();
|
App::build();
|
||||||
}
|
}
|
||||||
|
|
|
@ -876,6 +876,28 @@ class AuthComponentTest extends CakeTestCase {
|
||||||
$this->Auth->Session->delete('Auth');
|
$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.
|
* Default to loginRedirect, if set, on authError.
|
||||||
*
|
*
|
||||||
|
|
|
@ -3477,7 +3477,7 @@ class ContainableBehaviorTest extends CakeTestCase {
|
||||||
'joinTable' => 'articles_tags',
|
'joinTable' => 'articles_tags',
|
||||||
'foreignKey' => 'article_id',
|
'foreignKey' => 'article_id',
|
||||||
'associationForeignKey' => 'tag_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 '???'"
|
'conditions' => "ShortTag.tag LIKE '???'"
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
|
@ -703,7 +703,7 @@ class CakeSchemaTest extends CakeTestCase {
|
||||||
);
|
);
|
||||||
$result = $this->Schema->generateTable('fields', $posts);
|
$result = $this->Schema->generateTable('fields', $posts);
|
||||||
$this->assertRegExp('/public \$fields/', $result);
|
$this->assertRegExp('/public \$fields/', $result);
|
||||||
$this->assertPattern('/\'type\' \=\> \'fulltext\'/', $result);
|
$this->assertRegExp('/\'type\' \=\> \'fulltext\'/', $result);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -951,6 +951,9 @@ class DboSourceTest extends CakeTestCase {
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function testFieldsCacheKeyWithSchemanameChange() {
|
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_');
|
Cache::delete('method_cache', '_cake_core_');
|
||||||
DboSource::$methodCache = array();
|
DboSource::$methodCache = array();
|
||||||
$Article = ClassRegistry::init('Article');
|
$Article = ClassRegistry::init('Article');
|
||||||
|
|
|
@ -147,7 +147,7 @@ class ModelCrossSchemaHabtmTest extends BaseModelTest {
|
||||||
));
|
));
|
||||||
|
|
||||||
$results = $Player->saveAll($player, array('validate' => 'first'));
|
$results = $Player->saveAll($player, array('validate' => 'first'));
|
||||||
$this->assertNotEqual(false, $results);
|
$this->assertNotSame(false, $results);
|
||||||
$count = $Player->find('count');
|
$count = $Player->find('count');
|
||||||
$this->assertEquals(5, $count);
|
$this->assertEquals(5, $count);
|
||||||
|
|
||||||
|
|
|
@ -26,6 +26,15 @@ App::uses('CakeEmail', 'Network/Email');
|
||||||
*/
|
*/
|
||||||
class TestCakeEmail extends CakeEmail {
|
class TestCakeEmail extends CakeEmail {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Config classname.
|
||||||
|
*
|
||||||
|
* Use a the testing config class in this file.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $_configClass = 'TestEmailConfig';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Config
|
* Config
|
||||||
*
|
*
|
||||||
|
@ -79,7 +88,7 @@ class TestCakeEmail extends CakeEmail {
|
||||||
* EmailConfig class
|
* EmailConfig class
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
class EmailConfig {
|
class TestEmailConfig {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* test config
|
* test config
|
||||||
|
@ -841,7 +850,7 @@ class CakeEmailTest extends CakeTestCase {
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function testConfigString() {
|
public function testConfigString() {
|
||||||
$configs = new EmailConfig();
|
$configs = new TestEmailConfig();
|
||||||
$this->CakeEmail->config('test');
|
$this->CakeEmail->config('test');
|
||||||
|
|
||||||
$result = $this->CakeEmail->to();
|
$result = $this->CakeEmail->to();
|
||||||
|
@ -1767,8 +1776,8 @@ class CakeEmailTest extends CakeTestCase {
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function testConstructWithConfigString() {
|
public function testConstructWithConfigString() {
|
||||||
$configs = new EmailConfig();
|
$configs = new TestEmailConfig();
|
||||||
$this->CakeEmail = new CakeEmail('test');
|
$this->CakeEmail = new TestCakeEmail('test');
|
||||||
|
|
||||||
$result = $this->CakeEmail->to();
|
$result = $this->CakeEmail->to();
|
||||||
$this->assertEquals($configs->test['to'], $result);
|
$this->assertEquals($configs->test['to'], $result);
|
||||||
|
|
|
@ -6754,7 +6754,7 @@ class FormHelperTest extends CakeTestCase {
|
||||||
|
|
||||||
$result = $matches[1];
|
$result = $matches[1];
|
||||||
$expected = range(date('Y') + 20, 1930);
|
$expected = range(date('Y') + 20, 1930);
|
||||||
$this->assertEquals($result, $expected);
|
$this->assertEquals($expected, $result);
|
||||||
|
|
||||||
$this->Form->request->data['Project']['release'] = '2050-10-10';
|
$this->Form->request->data['Project']['release'] = '2050-10-10';
|
||||||
$result = $this->Form->year('Project.release');
|
$result = $this->Form->year('Project.release');
|
||||||
|
@ -6762,7 +6762,7 @@ class FormHelperTest extends CakeTestCase {
|
||||||
|
|
||||||
$result = $matches[1];
|
$result = $matches[1];
|
||||||
$expected = range(2050, date('Y') - 20);
|
$expected = range(2050, date('Y') - 20);
|
||||||
$this->assertEquals($result, $expected);
|
$this->assertEquals($expected, $result);
|
||||||
|
|
||||||
$this->Form->request->data['Project']['release'] = '1881-10-10';
|
$this->Form->request->data['Project']['release'] = '1881-10-10';
|
||||||
$result = $this->Form->year('Project.release', 1890, 1900);
|
$result = $this->Form->year('Project.release', 1890, 1900);
|
||||||
|
@ -6770,7 +6770,7 @@ class FormHelperTest extends CakeTestCase {
|
||||||
|
|
||||||
$result = $matches[1];
|
$result = $matches[1];
|
||||||
$expected = range(1900, 1881);
|
$expected = range(1900, 1881);
|
||||||
$this->assertEquals($result, $expected);
|
$this->assertEquals($expected, $result);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -9312,7 +9312,7 @@ class FormHelperTest extends CakeTestCase {
|
||||||
'div' => false,
|
'div' => false,
|
||||||
'label' => false,
|
'label' => false,
|
||||||
);
|
);
|
||||||
$this->assertEqual($result, $expected);
|
$this->assertEquals($expected, $result);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1844,13 +1844,13 @@ class HtmlHelperTest extends CakeTestCase {
|
||||||
$this->assertTags($result, array('div' => array('class' => 'class-name'), '<text>', '/div'));
|
$this->assertTags($result, array('div' => array('class' => 'class-name'), '<text>', '/div'));
|
||||||
|
|
||||||
$result = $this->Html->tag(false, '<em>stuff</em>');
|
$result = $this->Html->tag(false, '<em>stuff</em>');
|
||||||
$this->assertEquals($result, '<em>stuff</em>');
|
$this->assertEquals('<em>stuff</em>', $result);
|
||||||
|
|
||||||
$result = $this->Html->tag(null, '<em>stuff</em>');
|
$result = $this->Html->tag(null, '<em>stuff</em>');
|
||||||
$this->assertEquals($result, '<em>stuff</em>');
|
$this->assertEquals('<em>stuff</em>', $result);
|
||||||
|
|
||||||
$result = $this->Html->tag('', '<em>stuff</em>');
|
$result = $this->Html->tag('', '<em>stuff</em>');
|
||||||
$this->assertEquals($result, '<em>stuff</em>');
|
$this->assertEquals('<em>stuff</em>', $result);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -2233,7 +2233,7 @@ class PaginatorHelperTest extends CakeTestCase {
|
||||||
*/
|
*/
|
||||||
public function testParam() {
|
public function testParam() {
|
||||||
$result = $this->Paginator->param('count');
|
$result = $this->Paginator->param('count');
|
||||||
$this->assertIdentical(62, $result);
|
$this->assertSame(62, $result);
|
||||||
|
|
||||||
$result = $this->Paginator->param('imaginary');
|
$result = $this->Paginator->param('imaginary');
|
||||||
$this->assertNull($result);
|
$this->assertNull($result);
|
||||||
|
|
|
@ -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',
|
||||||
'Text with a url <a href="http://www.not--work.com">http://www.not--work.com</a> and more',
|
'Text with a url <a href="http://www.not--work.com">http://www.not--work.com</a> and more',
|
||||||
),
|
),
|
||||||
|
array(
|
||||||
|
'Text with a partial www.küchenschöhn-not-working.de URL',
|
||||||
|
'Text with a partial <a href="http://www.küchenschöhn-not-working.de">www.küchenschöhn-not-working.de</a> URL'
|
||||||
|
),
|
||||||
|
array(
|
||||||
|
'Text with a partial http://www.küchenschöhn-not-working.de URL',
|
||||||
|
'Text with a partial <a href="http://www.küchenschöhn-not-working.de">http://www.küchenschöhn-not-working.de</a> URL'
|
||||||
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -351,6 +359,16 @@ class TextHelperTest extends CakeTestCase {
|
||||||
$expected = 'Text with <a href="mailto:email@example.com" \s*class="link">email@example.com</a> address';
|
$expected = 'Text with <a href="mailto:email@example.com" \s*class="link">email@example.com</a> address';
|
||||||
$result = $this->Text->autoLinkEmails($text, array('class' => 'link'));
|
$result = $this->Text->autoLinkEmails($text, array('class' => 'link'));
|
||||||
$this->assertRegExp('#^' . $expected . '$#', $result);
|
$this->assertRegExp('#^' . $expected . '$#', $result);
|
||||||
|
|
||||||
|
$text = 'Text with düsentrieb@küchenschöhn-not-working.de address';
|
||||||
|
$expected = 'Text with <a href="mailto:düsentrieb@küchenschöhn-not-working.de">düsentrieb@küchenschöhn-not-working.de</a> address';
|
||||||
|
$result = $this->Text->autoLinkEmails($text);
|
||||||
|
$this->assertRegExp('#^' . $expected . '$#', $result);
|
||||||
|
|
||||||
|
$text = 'Text with me@subdomain.küchenschöhn.de address';
|
||||||
|
$expected = 'Text with <a href="mailto:me@subdomain.küchenschöhn.de">me@subdomain.küchenschöhn.de</a> address';
|
||||||
|
$result = $this->Text->autoLinkEmails($text);
|
||||||
|
$this->assertRegExp('#^' . $expected . '$#', $result);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -383,7 +401,7 @@ TEXT;
|
||||||
|
|
||||||
TEXT;
|
TEXT;
|
||||||
$result = $this->Text->autoParagraph($text);
|
$result = $this->Text->autoParagraph($text);
|
||||||
$this->assertEquals($expected, $result);
|
$this->assertTextEquals($expected, $result);
|
||||||
$result = $this->Text->autoParagraph($text);
|
$result = $this->Text->autoParagraph($text);
|
||||||
$text = 'This is a <BR id="test"/><br class="test"> test text';
|
$text = 'This is a <BR id="test"/><br class="test"> test text';
|
||||||
$expected = <<<TEXT
|
$expected = <<<TEXT
|
||||||
|
@ -392,7 +410,7 @@ TEXT;
|
||||||
|
|
||||||
TEXT;
|
TEXT;
|
||||||
$result = $this->Text->autoParagraph($text);
|
$result = $this->Text->autoParagraph($text);
|
||||||
$this->assertEquals($expected, $result);
|
$this->assertTextEquals($expected, $result);
|
||||||
$text = <<<TEXT
|
$text = <<<TEXT
|
||||||
This is a test text.
|
This is a test text.
|
||||||
This is a line return.
|
This is a line return.
|
||||||
|
@ -403,7 +421,7 @@ This is a line return.</p>
|
||||||
|
|
||||||
TEXT;
|
TEXT;
|
||||||
$result = $this->Text->autoParagraph($text);
|
$result = $this->Text->autoParagraph($text);
|
||||||
$this->assertEquals($expected, $result);
|
$this->assertTextEquals($expected, $result);
|
||||||
$text = <<<TEXT
|
$text = <<<TEXT
|
||||||
This is a test text.
|
This is a test text.
|
||||||
|
|
||||||
|
@ -415,7 +433,7 @@ TEXT;
|
||||||
|
|
||||||
TEXT;
|
TEXT;
|
||||||
$result = $this->Text->autoParagraph($text);
|
$result = $this->Text->autoParagraph($text);
|
||||||
$this->assertEquals($expected, $result);
|
$this->assertTextEquals($expected, $result);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1388,7 +1388,7 @@ class ViewTest extends CakeTestCase {
|
||||||
public function testBlockSetDecimal() {
|
public function testBlockSetDecimal() {
|
||||||
$this->View->assign('testWithDecimal', 1.23456789);
|
$this->View->assign('testWithDecimal', 1.23456789);
|
||||||
$result = $this->View->fetch('testWithDecimal');
|
$result = $this->View->fetch('testWithDecimal');
|
||||||
$this->assertEqual('1.23456789', $result);
|
$this->assertEquals('1.23456789', $result);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
* This class helpes in indirectly testing the functionaliteies of CakeTestCase::assertTags
|
* This class helpes in indirectly testing the functionalities of CakeTestCase::assertTags
|
||||||
*
|
*
|
||||||
* @package Cake.Test.Fixture
|
* @package Cake.Test.Fixture
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -42,7 +42,7 @@ class CakeTestLoader extends PHPUnit_Runner_StandardTestSuiteLoader {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Convert path fragments used by Cake's test runner to absolute paths that can be fed to PHPUnit.
|
* Convert path fragments used by CakePHP's test runner to absolute paths that can be fed to PHPUnit.
|
||||||
*
|
*
|
||||||
* @param string $filePath
|
* @param string $filePath
|
||||||
* @param string $params
|
* @param string $params
|
||||||
|
|
|
@ -22,14 +22,14 @@ require_once 'PHPUnit/TextUI/TestRunner.php';
|
||||||
App::uses('CakeFixtureManager', 'TestSuite/Fixture');
|
App::uses('CakeFixtureManager', 'TestSuite/Fixture');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A custom test runner for Cake's use of PHPUnit.
|
* A custom test runner for CakePHP's use of PHPUnit.
|
||||||
*
|
*
|
||||||
* @package Cake.TestSuite
|
* @package Cake.TestSuite
|
||||||
*/
|
*/
|
||||||
class CakeTestRunner extends PHPUnit_TextUI_TestRunner {
|
class CakeTestRunner extends PHPUnit_TextUI_TestRunner {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Lets us pass in some options needed for cake's webrunner.
|
* Lets us pass in some options needed for CakePHP's webrunner.
|
||||||
*
|
*
|
||||||
* @param mixed $loader
|
* @param mixed $loader
|
||||||
* @param array $params list of options to be used for this run
|
* @param array $params list of options to be used for this run
|
||||||
|
|
|
@ -32,7 +32,7 @@ class CakeTestFixture {
|
||||||
public $name = null;
|
public $name = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Cake's DBO driver (e.g: DboMysql).
|
* CakePHP's DBO driver (e.g: DboMysql).
|
||||||
*
|
*
|
||||||
* @var object
|
* @var object
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
* Pluralize and singularize English words.
|
* Pluralize and singularize English words.
|
||||||
*
|
*
|
||||||
* Inflector pluralizes and singularizes English nouns.
|
* Inflector pluralizes and singularizes English nouns.
|
||||||
* Used by Cake's naming conventions throughout the framework.
|
* Used by CakePHP's naming conventions throughout the framework.
|
||||||
*
|
*
|
||||||
* @package Cake.Utility
|
* @package Cake.Utility
|
||||||
* @link http://book.cakephp.org/2.0/en/core-utility-libraries/inflector.html
|
* @link http://book.cakephp.org/2.0/en/core-utility-libraries/inflector.html
|
||||||
|
|
|
@ -23,7 +23,7 @@
|
||||||
App::uses('HttpSocket', 'Network/Http');
|
App::uses('HttpSocket', 'Network/Http');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* XML handling for Cake.
|
* XML handling for CakePHP.
|
||||||
*
|
*
|
||||||
* The methods in these classes enable the datasources that use XML to work.
|
* The methods in these classes enable the datasources that use XML to work.
|
||||||
*
|
*
|
||||||
|
|
|
@ -105,7 +105,7 @@ class TextHelper extends AppHelper {
|
||||||
$this->_placeholders = array();
|
$this->_placeholders = array();
|
||||||
$options += array('escape' => true);
|
$options += array('escape' => true);
|
||||||
|
|
||||||
$pattern = '#(?<!href="|src="|">)((?:https?|ftp|nntp)://[a-z0-9.\-:]+(?:[/?][^\s<]*)?)#i';
|
$pattern = '#(?<!href="|src="|">)((?:https?|ftp|nntp)://[\p{L}0-9.\-:]+(?:[/?][^\s<]*)?)#ui';
|
||||||
$text = preg_replace_callback(
|
$text = preg_replace_callback(
|
||||||
$pattern,
|
$pattern,
|
||||||
array(&$this, '_insertPlaceHolder'),
|
array(&$this, '_insertPlaceHolder'),
|
||||||
|
@ -186,9 +186,9 @@ class TextHelper extends AppHelper {
|
||||||
$options += array('escape' => true);
|
$options += array('escape' => true);
|
||||||
$this->_placeholders = array();
|
$this->_placeholders = array();
|
||||||
|
|
||||||
$atom = '[a-z0-9!#$%&\'*+\/=?^_`{|}~-]';
|
$atom = '[\p{L}0-9!#$%&\'*+\/=?^_`{|}~-]';
|
||||||
$text = preg_replace_callback(
|
$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'),
|
array(&$this, '_insertPlaceholder'),
|
||||||
$text
|
$text
|
||||||
);
|
);
|
||||||
|
|
|
@ -136,7 +136,7 @@ class View extends Object {
|
||||||
public $layoutPath = null;
|
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.
|
* Setting to off means that layouts will not be automatically applied to rendered views.
|
||||||
*
|
*
|
||||||
* @var boolean
|
* @var boolean
|
||||||
|
@ -144,7 +144,7 @@ class View extends Object {
|
||||||
public $autoLayout = true;
|
public $autoLayout = true;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* File extension. Defaults to Cake's template ".ctp".
|
* File extension. Defaults to CakePHP's template ".ctp".
|
||||||
*
|
*
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
* Basic Cake functionality.
|
* Basic CakePHP functionality.
|
||||||
*
|
*
|
||||||
* Handles loading of core files needed on every request
|
* Handles loading of core files needed on every request
|
||||||
*
|
*
|
||||||
|
|
Loading…
Reference in a new issue