Upgrade CakePHP from 2.2.5 to 2.9.5

This commit is contained in:
Brm Ko 2017-02-26 15:29:44 +01:00
parent 5a580df460
commit 235a541597
793 changed files with 60746 additions and 23753 deletions

View file

@ -2,20 +2,20 @@
/**
* RssHelperTest file
*
* PHP 5
*
* CakePHP(tm) Tests <http://book.cakephp.org/2.0/en/development/testing.html>
* Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
* Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
*
* Licensed under The MIT License
* For full copyright and license information, please see the LICENSE.txt
* Redistributions of files must retain the above copyright notice
*
* @copyright Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
* @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
* @link http://book.cakephp.org/2.0/en/development/testing.html CakePHP(tm) Tests
* @package Cake.Test.Case.View.Helper
* @since CakePHP(tm) v 1.2.0.4206
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
* @license http://www.opensource.org/licenses/mit-license.php MIT License
*/
App::uses('View', 'View');
App::uses('RssHelper', 'View/Helper');
App::uses('TimeHelper', 'View/Helper');
@ -91,7 +91,7 @@ class RssHelperTest extends CakeTestCase {
*/
public function testChannel() {
$attrib = array('a' => '1', 'b' => '2');
$elements = array('title' => 'title');
$elements = array('title' => 'Title');
$content = 'content';
$result = $this->Rss->channel($attrib, $elements, $content);
@ -101,30 +101,7 @@ class RssHelperTest extends CakeTestCase {
'b' => '2'
),
'<title',
'title',
'/title',
'<link',
$this->Rss->url('/', true),
'/link',
'<description',
'content',
'/channel'
);
$this->assertTags($result, $expected);
$this->View->pageTitle = 'title';
$attrib = array('a' => '1', 'b' => '2');
$elements = array();
$content = 'content';
$result = $this->Rss->channel($attrib, $elements, $content);
$expected = array(
'channel' => array(
'a' => '1',
'b' => '2'
),
'<title',
'title',
'Title',
'/title',
'<link',
$this->Rss->url('/', true),
@ -608,7 +585,7 @@ class RssHelperTest extends CakeTestCase {
$this->assertTrue($File->write('123'), 'Could not write to ' . $tmpFile);
if (50300 <= PHP_VERSION_ID) {
if (PHP_VERSION_ID >= 50300) {
clearstatcache(true, $tmpFile);
} else {
clearstatcache();
@ -642,13 +619,12 @@ class RssHelperTest extends CakeTestCase {
)
);
$result = $this->Rss->item(null, $item);
if (!function_exists('finfo_open') &&
(function_exists('mime_content_type') && false === mime_content_type($tmpFile))
) {
$type = false;
if (!function_exists('mime_content_type')) {
$type = null;
} else {
$type = 'text/plain';
$type = mime_content_type($tmpFile);
}
$expected = array(
'<item',
'<title',
@ -679,6 +655,9 @@ class RssHelperTest extends CakeTestCase {
'/category',
'/item'
);
if ($type === null) {
unset($expected['enclosure']['type']);
}
$this->assertTags($result, $expected);
$File->delete();
@ -741,36 +720,36 @@ class RssHelperTest extends CakeTestCase {
public function testElementNamespaceWithPrefix() {
$item = array(
'title' => 'Title',
'dc:creator' => 'Alex',
'xy:description' => 'descriptive words'
);
'title' => 'Title',
'dc:creator' => 'Alex',
'dc:description' => 'descriptive words'
);
$attributes = array(
'namespace' => array(
'prefix' => 'dc',
'url' => 'http://link.com'
)
'namespace' => array(
'prefix' => 'dc',
'url' => 'http://link.com'
)
);
$result = $this->Rss->item($attributes, $item);
$expected = array(
'item' => array(
'xmlns:dc' => 'http://link.com'
'xmlns:dc' => 'http://link.com'
),
'title' => array(
'xmlns:dc' => 'http://link.com'
'xmlns:dc' => 'http://link.com'
),
'Title',
'/title',
'dc:creator' => array(
'xmlns:dc' => 'http://link.com'
'xmlns:dc' => 'http://link.com'
),
'Alex',
'/dc:creator',
'description' => array(
'xmlns:dc' => 'http://link.com'
'dc:description' => array(
'xmlns:dc' => 'http://link.com'
),
'descriptive words',
'/description',
'/dc:description',
'/item'
);
$this->assertTags($result, $expected, true);