Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Use base test's DocumentManager in IdTest

  • Loading branch information...
commit 2d700b8901fb2053d52f65e470e03fda2c413c2d 1 parent 681c3db
@jmikola jmikola authored
Showing with 12 additions and 16 deletions.
  1. +12 −16 tests/Doctrine/ODM/MongoDB/Tests/Functional/IdTest.php
View
28 tests/Doctrine/ODM/MongoDB/Tests/Functional/IdTest.php
@@ -183,19 +183,17 @@ public function testIdTypesAndStrategies($type, $strategy, $id = null, $expected
{
$className = $this->createIdTestClass($type, $strategy);
- $dm = $this->createTestDocumentManager();
-
$object = new $className();
$object->id = $id;
- $dm->persist($object);
- $dm->flush();
- $dm->clear();
+ $this->dm->persist($object);
+ $this->dm->flush();
+ $this->dm->clear();
$this->assertNotNull($object->id);
if ($expectedMongoType !== null) {
- $check = $dm->getDocumentCollection(get_class($object))->findOne(array());
+ $check = $this->dm->getDocumentCollection(get_class($object))->findOne(array());
$this->assertEquals($expectedMongoType, is_object($check['_id']) ? get_class($check['_id']) : gettype($check['_id']));
}
@@ -203,7 +201,7 @@ public function testIdTypesAndStrategies($type, $strategy, $id = null, $expected
$this->assertEquals($expected, $object->id);
}
- $object = $dm->find(get_class($object), $object->id);
+ $object = $this->dm->find(get_class($object), $object->id);
$this->assertNotNull($object);
if ($expected !== null) {
@@ -211,10 +209,10 @@ public function testIdTypesAndStrategies($type, $strategy, $id = null, $expected
}
$object->test = 'changed';
- $dm->flush();
- $dm->clear();
+ $this->dm->flush();
+ $this->dm->clear();
- $object = $dm->find(get_class($object), $object->id);
+ $object = $this->dm->find(get_class($object), $object->id);
$this->assertEquals('changed', $object->test);
}
@@ -281,16 +279,14 @@ public function testBinIds($type, $expectedMongoBinDataType)
{
$className = $this->createIdTestClass($type, 'none');
- $dm = $this->createTestDocumentManager();
-
$object = new $className();
$object->id = 'ABRWTIFGPEeSFf69fISAOA==';
- $dm->persist($object);
- $dm->flush();
- $dm->clear();
+ $this->dm->persist($object);
+ $this->dm->flush();
+ $this->dm->clear();
- $check = $dm->getDocumentCollection(get_class($object))->findOne(array());
+ $check = $this->dm->getDocumentCollection(get_class($object))->findOne(array());
$this->assertEquals('MongoBinData', get_class($check['_id']));
$this->assertEquals($expectedMongoBinDataType, $check['_id']->type);
Please sign in to comment.
Something went wrong with that request. Please try again.