Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Making model tests less time dependent
  • Loading branch information
lorenzo committed Oct 3, 2011
1 parent 71c7350 commit 0a2553c
Show file tree
Hide file tree
Showing 3 changed files with 158 additions and 129 deletions.
Expand Up @@ -179,9 +179,10 @@ public function testPluginModel() {
$expected = array(
'id' => 1,
'username' => 'gwoo',
'created' => '2007-03-17 01:16:23',
'updated' => date('Y-m-d H:i:s')
'created' => '2007-03-17 01:16:23'
);
$this->assertTrue($result['updated'] >= date('Y-m-d H:i:s'));
unset($result['updated']);
$this->assertEquals($expected, $result);
CakePlugin::unload();
}
Expand Down
85 changes: 45 additions & 40 deletions lib/Cake/Test/Case/Model/ModelIntegrationTest.php
Expand Up @@ -1639,46 +1639,51 @@ public function testWithAssociation() {
'title' => 'First Post',
'body' => 'First Post Body',
'published' => 'Y',
'created' => '2007-03-18 10:39:23',
'updated' => $ts),
'SomethingElse' => array(
array(
'id' => '1',
'title' => 'First Post',
'body' => 'First Post Body',
'published' => 'Y',
'created' => '2007-03-18 10:39:23',
'updated' => '2007-03-18 10:41:31',
'JoinThing' => array(
'doomed' => true,
'something_id' => '1',
'something_else_id' => '1'
)),
array(
'id' => '2',
'title' => 'Second Post',
'body' => 'Second Post Body',
'published' => 'Y',
'created' => '2007-03-18 10:41:23',
'updated' => '2007-03-18 10:43:31',
'JoinThing' => array(
'doomed' => true,
'something_id' => '1',
'something_else_id' => '2'
)),
array(
'id' => '3',
'title' => 'Third Post',
'body' => 'Third Post Body',
'published' => 'Y',
'created' => '2007-03-18 10:43:23',
'updated' => '2007-03-18 10:45:31',
'JoinThing' => array(
'doomed' => false,
'something_id' => '1',
'something_else_id' => '3'
))));

'created' => '2007-03-18 10:39:23'
),
'SomethingElse' => array(
array(
'id' => '1',
'title' => 'First Post',
'body' => 'First Post Body',
'published' => 'Y',
'created' => '2007-03-18 10:39:23',
'updated' => '2007-03-18 10:41:31',
'JoinThing' => array(
'doomed' => true,
'something_id' => '1',
'something_else_id' => '1'
)
),
array(
'id' => '2',
'title' => 'Second Post',
'body' => 'Second Post Body',
'published' => 'Y',
'created' => '2007-03-18 10:41:23',
'updated' => '2007-03-18 10:43:31',
'JoinThing' => array(
'doomed' => true,
'something_id' => '1',
'something_else_id' => '2'
)
),
array(
'id' => '3',
'title' => 'Third Post',
'body' => 'Third Post Body',
'published' => 'Y',
'created' => '2007-03-18 10:43:23',
'updated' => '2007-03-18 10:45:31',
'JoinThing' => array(
'doomed' => false,
'something_id' => '1',
'something_else_id' => '3')
)
)
);
$this->assertTrue($result['Something']['updated'] >= $ts);
unset($result['Something']['updated']);
$this->assertEqual($expected, $result);
}

Expand Down

0 comments on commit 0a2553c

Please sign in to comment.