Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Fix randomly failing tests. #719

Merged
merged 1 commit into from

2 participants

@jails
Collaborator

No description provided.

@nateabele nateabele merged commit 207794a into UnionOfRAD:dev
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Dec 10, 2012
  1. @jails

    Fix randomly failing tests.

    jails authored
This page is out of date. Refresh to see the latest.
Showing with 7 additions and 6 deletions.
  1. +7 −6 tests/cases/data/source/mongo_db/ExporterTest.php
View
13 tests/cases/data/source/mongo_db/ExporterTest.php
@@ -55,7 +55,7 @@ public function setUp() {
},
'date' => function($v) {
$v = is_numeric($v) ? intval($v) : strtotime($v);
- return (time() == $v) ? new MongoDate() : new MongoDate($v);
+ return !$v ? new MongoDate() : new MongoDate($v);
},
'regex' => function($v) { return new MongoRegex($v); },
'integer' => function($v) { return (integer) $v; },
@@ -76,9 +76,10 @@ public function testInvalid() {
}
public function testCreateWithFixedData() {
+ $time = time();
$doc = new Document(array('exists' => false, 'data' => array(
'_id' => new MongoId(),
- 'created' => new MongoDate(),
+ 'created' => new MongoDate($time),
'numbers' => new DocumentSet(array('data' => array(7, 8, 9))),
'objects' => new DocumentSet(array('data' => array(
new Document(array('data' => array('foo' => 'bar'))),
@@ -92,7 +93,7 @@ public function testCreateWithFixedData() {
$result = Exporter::get('create', $doc->export());
$this->assertTrue($result['create']['_id'] instanceof MongoId);
$this->assertTrue($result['create']['created'] instanceof MongoDate);
- $this->assertIdentical(time(), $result['create']['created']->sec);
+ $this->assertIdentical($time, $result['create']['created']->sec);
$this->assertIdentical(array(7, 8, 9), $result['create']['numbers']);
$expected = array(array('foo' => 'bar'), array('baz' => 'dib'));
@@ -370,19 +371,19 @@ public function testTypeCasting() {
* @return void
*/
public function testTypeCastingSubObjectArrays() {
+ $time = time();
$data = array(
'_id' => '4c8f86167675abfabd970300',
'accounts' => array(array(
'_id' => "4fb6e2dd3e91581fe6e75736",
'name' => 'Foo',
- 'created' => time()
+ 'created' => $time
),array(
'_id' => "4fb6e2df3e91581fe6e75737",
'name' => 'Bar',
- 'created' => time()
+ 'created' => $time
))
);
- $time = time();
$model = $this->_model;
$handlers = $this->_handlers;
$options = compact('model', 'handlers');
Something went wrong with that request. Please try again.