Skip to content

Commit

Permalink
Fix failing tests.
Browse files Browse the repository at this point in the history
* Fix failing tests from merge with 2.3
* Move multibyte initialization into Config/app.php
  • Loading branch information
markstory committed Oct 28, 2012
1 parent 8b6cd24 commit 270d022
Show file tree
Hide file tree
Showing 6 changed files with 55 additions and 33 deletions.
22 changes: 22 additions & 0 deletions App/Config/app.php
Expand Up @@ -110,3 +110,25 @@
$loader = new ClassLoader($namespace, dirname(APP));
$loader->register();
unset($loader, $namespace);

/**
* Define the FULL_BASE_URL used for link generation.
* In most cases the code below will generate the correct hostname.
* However, you can manually define the hostname to resolve any issues.
*/
$s = null;
if (env('HTTPS')) {
$s = 's';
}

$httpHost = env('HTTP_HOST');
if (isset($httpHost)) {
define('FULL_BASE_URL', 'http' . $s . '://' . $httpHost);
}
unset($httpHost, $s);

/**
* Configure the mbstring extension to use the correct encoding.
*/
$encoding = Configure::read('App.encoding');
mb_internal_encoding($encoding);
29 changes: 26 additions & 3 deletions lib/Cake/Console/Templates/skel/Config/app.php
Expand Up @@ -80,9 +80,10 @@
* - cipherSeed - A random numeric string (digits only) used to seed
* the xor cipher functions in Security.
*/
Configure::write('Security.salt', 'DYhG93b0qyJfIxfs2guVoUubWwvniR2G0FgaC9mi');

Configure::write('Security.cipherSeed', '76859309657453542496749683645');
Configure::write('Security', [
'salt' => 'DYhG93b0qyJfIxfs2guVoUubWwvniR2G0FgaC9mi',
'cipherSeed' => '76859309657453542496749683645',
]);

/**
* Apply timestamps with the last modified time to static assets (js, css, images).
Expand All @@ -109,3 +110,25 @@
$loader = new ClassLoader($namespace, dirname(APP));
$loader->register();
unset($loader, $namespace);

/**
* Define the FULL_BASE_URL used for link generation.
* In most cases the code below will generate the correct hostname.
* However, you can manually define the hostname to resolve any issues.
*/
$s = null;
if (env('HTTPS')) {
$s = 's';
}

$httpHost = env('HTTP_HOST');
if (isset($httpHost)) {
define('FULL_BASE_URL', 'http' . $s . '://' . $httpHost);
}
unset($httpHost, $s);

/**
* Configure the mbstring extension to use the correct encoding.
*/
$encoding = Configure::read('App.encoding');
mb_internal_encoding($encoding);
2 changes: 1 addition & 1 deletion lib/Cake/Routing/Router.php
Expand Up @@ -450,7 +450,7 @@ public static function parse($url) {
static::_loadRoutes();
}

if ($url && strpos($url, '/') !== 0) {
if (strlen($url) && strpos($url, '/') !== 0) {
$url = '/' . $url;
}
if (strpos($url, '?') !== false) {
Expand Down
6 changes: 3 additions & 3 deletions lib/Cake/Test/TestCase/Routing/RouterTest.php
Expand Up @@ -399,12 +399,12 @@ public function testUrlCatchAllRoute() {
$result = Router::url(array('controller' => 'categories', 'action' => 'index', '0'));
$this->assertEquals('/0', $result);

$expected = array(
$expected = [
'plugin' => null,
'controller' => 'categories',
'action' => 'index',
'pass' => array('0'),
);
'pass' => ['0'],
];
$result = Router::parse('/0');
$this->assertEquals($expected, $result);

Expand Down
4 changes: 2 additions & 2 deletions lib/Cake/Test/TestCase/View/Helper/FormHelperTest.php
Expand Up @@ -2750,7 +2750,7 @@ public function testInputMagicSelectForTypeNumber() {
'label' => array('for' => 'ValidateUserBalance'),
'Balance',
'/label',
'select' => array('name' => 'data[ValidateUser][balance]', 'id' => 'ValidateUserBalance'),
'select' => array('name' => 'ValidateUser[balance]', 'id' => 'ValidateUserBalance'),
array('option' => array('value' => '0')),
'nothing',
'/option',
Expand Down Expand Up @@ -7177,7 +7177,7 @@ public function testFormInputRequiredDetection() {
'Iamrequiredalways',
'/label',
'input' => array(
'type' => 'text', 'name' => 'data[Contact][iamrequiredalways]',
'type' => 'text', 'name' => 'Contact[iamrequiredalways]',
'id' => 'ContactIamrequiredalways'
),
'/div'
Expand Down
25 changes: 1 addition & 24 deletions lib/Cake/bootstrap.php
Expand Up @@ -26,30 +26,7 @@
$loader->register();

use Cake\Core\App;
use Cake\Core\Configure;

App::init();
App::build();

/**
* Full url prefix
*/
if (!defined('FULL_BASE_URL')) {
$s = null;
if (env('HTTPS')) {
$s = 's';
}

$httpHost = env('HTTP_HOST');

if (isset($httpHost)) {
define('FULL_BASE_URL', 'http' . $s . '://' . $httpHost);
}
unset($httpHost, $s);
}

spl_autoload_register(array('App', 'load'));

$encoding = Configure::read('App.encoding');
if (!empty($encoding)) {
mb_internal_encoding($encoding);
}

0 comments on commit 270d022

Please sign in to comment.