Permalink
Browse files

Making model tests less time dependent

  • Loading branch information...
1 parent 71c7350 commit 0a2553cce596c7f70e273accb604cb10d3581fd2 @lorenzo lorenzo committed Oct 3, 2011
@@ -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();
}
@@ -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);
}
Oops, something went wrong.

0 comments on commit 0a2553c

Please sign in to comment.