Skip to content
Permalink
Browse files

changing methods in CakeTime class to static

  • Loading branch information...
rchavik committed Feb 13, 2012
1 parent 9624c27 commit d6fd051fb4fe142344c41e7bdf829afb55c52647
@@ -328,6 +328,11 @@ public function testNice() {
$this->Time->niceFormat = '%Y-%d-%m';
$this->assertEquals(date('Y-d-m', $time), $this->Time->nice($time));
$this->assertEquals('%Y-%d-%m', $this->Time->niceFormat);
CakeTime::$niceFormat = '%Y-%d-%m %H:%M:%S';
$this->assertEquals(date('Y-d-m H:i:s', $time), $this->Time->nice($time));
$this->assertEquals('%Y-%d-%m %H:%M:%S', $this->Time->niceFormat);
}
/**
@@ -25,12 +25,18 @@
*/
class TimeHelperTestObject extends TimeHelper {
public function attach(CakeTime $cakeTime) {
public function attach(CakeTimeMock $cakeTime) {
$this->_CakeTime = $cakeTime;
}
}
/**
* CakeTimeMock class
*/
class CakeTimeMock {
}
/**
* TimeHelperTest class
*
@@ -48,10 +54,8 @@ class TimeHelperTest extends CakeTestCase {
* @return void
*/
public function setUp() {
$View = new View(null);
$this->CakeTime = $this->getMock('CakeTime');
$this->Time = new TimeHelperTestObject($View);
$this->Time->attach($this->CakeTime);
parent::setUp();
$this->View = new View(null);
}
/**
@@ -60,8 +64,8 @@ public function setUp() {
* @return void
*/
public function tearDown() {
unset($this->Time);
unset($this->CakeTime);
unset($this->View);
parent::tearDown();
}
/**
@@ -75,9 +79,12 @@ public function testTimeHelperProxyMethodCalls() {
'isTomorrow', 'toQuarter', 'toUnix', 'toAtom', 'toRSS',
'timeAgoInWords', 'wasWithinLast', 'gmt', 'format', 'i18nFormat',
);
$CakeTime = $this->getMock('CakeTimeMock', $methods);
$Time = new TimeHelperTestObject($this->View, array('engine' => 'CakeTimeMock'));
$Time->attach($CakeTime);
foreach ($methods as $method) {
$this->CakeTime->expects($this->at(0))->method($method);
$this->Time->{$method}('who', 'what', 'when', 'where', 'how');
$CakeTime->expects($this->at(0))->method($method);
$Time->{$method}('who', 'what', 'when', 'where', 'how');
}
}
Oops, something went wrong.

0 comments on commit d6fd051

Please sign in to comment.
You can’t perform that action at this time.