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,26 +2,28 @@
/**
* TimeHelperTest 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('TimeHelper', 'View/Helper');
App::uses('View', 'View');
App::uses('CakeTime', 'Utility');
/**
* TimeHelperTestObject class
*
* @package Cake.Test.Case.View.Helper
*/
class TimeHelperTestObject extends TimeHelper {
@ -37,6 +39,8 @@ class TimeHelperTestObject extends TimeHelper {
/**
* CakeTimeMock class
*
* @package Cake.Test.Case.View.Helper
*/
class CakeTimeMock {
}
@ -74,6 +78,8 @@ class TimeHelperTest extends CakeTestCase {
/**
* test CakeTime class methods are called correctly
*
* @return void
*/
public function testTimeHelperProxyMethodCalls() {
$methods = array(
@ -81,7 +87,7 @@ class TimeHelperTest extends CakeTestCase {
'nice', 'niceShort', 'daysAsSql', 'dayAsSql',
'isToday', 'isThisMonth', 'isThisYear', 'wasYesterday',
'isTomorrow', 'toQuarter', 'toUnix', 'toAtom', 'toRSS',
'timeAgoInWords', 'wasWithinLast', 'gmt', 'format', 'i18nFormat',
'wasWithinLast', 'gmt', 'format', 'i18nFormat',
);
$CakeTime = $this->getMock('CakeTimeMock', $methods);
$Time = new TimeHelperTestObject($this->View, array('engine' => 'CakeTimeMock'));
@ -90,10 +96,18 @@ class TimeHelperTest extends CakeTestCase {
$CakeTime->expects($this->at(0))->method($method);
$Time->{$method}('who', 'what', 'when', 'where', 'how');
}
$CakeTime = $this->getMock('CakeTimeMock', array('timeAgoInWords'));
$Time = new TimeHelperTestObject($this->View, array('engine' => 'CakeTimeMock'));
$Time->attach($CakeTime);
$CakeTime->expects($this->at(0))->method('timeAgoInWords');
$Time->timeAgoInWords('who', array('what'), array('when'), array('where'), array('how'));
}
/**
* test engine override
*
* @return void
*/
public function testEngineOverride() {
App::build(array(
@ -161,7 +175,7 @@ class TimeHelperTest extends CakeTestCase {
'title' => $timestamp,
'class' => 'time-ago-in-words'
),
'2 weeks',
'in 2 weeks',
'/div'
);
$this->assertTags($result, $expected);