Skip to content

Commit

Permalink
created, modified and updated fields now use static timestamp in test…
Browse files Browse the repository at this point in the history
…cases
  • Loading branch information
ceeram committed Apr 21, 2012
1 parent dec67ef commit f0bd738
Show file tree
Hide file tree
Showing 7 changed files with 124 additions and 96 deletions.
2 changes: 1 addition & 1 deletion lib/Cake/Model/Model.php
Expand Up @@ -1629,7 +1629,7 @@ public function save($data = null, $validate = true, $fieldList = array()) {
if (!array_key_exists('format', $colType)) {
$time = strtotime('now');
} else {
$time = $colType['formatter']($colType['format']);
$time = call_user_func($colType['formatter'], $colType['format']);
}
if (!empty($this->whitelist)) {
$this->whitelist[] = $updateCol;
Expand Down
Expand Up @@ -163,7 +163,6 @@ public function testPluginModel() {
), App::RESET);
CakePlugin::load('TestPlugin');

$ts = date('Y-m-d H:i:s');
$PluginModel = ClassRegistry::init('TestPlugin.TestPluginAuthUser');
$user['id'] = 1;
$user['username'] = 'gwoo';
Expand All @@ -185,7 +184,7 @@ public function testPluginModel() {
'username' => 'gwoo',
'created' => '2007-03-17 01:16:23'
);
$this->assertTrue($result['updated'] >= $ts);
$this->assertEquals(self::date(), $result['updated']);
unset($result['updated']);
$this->assertEquals($expected, $result);
CakePlugin::unload();
Expand Down
3 changes: 1 addition & 2 deletions lib/Cake/Test/Case/Model/ModelIntegrationTest.php
Expand Up @@ -1867,7 +1867,6 @@ public function testWithAssociation() {
'doomed' => true
))));

$ts = date('Y-m-d H:i:s');
$TestModel->save();

$TestModel->hasAndBelongsToMany['SomethingElse']['order'] = 'SomethingElse.id ASC';
Expand Down Expand Up @@ -1921,7 +1920,7 @@ public function testWithAssociation() {
)
)
);
$this->assertTrue($result['Something']['updated'] >= $ts);
$this->assertEquals(self::date(), $result['Something']['updated']);
unset($result['Something']['updated']);
$this->assertEquals($expected, $result);
}
Expand Down

0 comments on commit f0bd738

Please sign in to comment.