/** * Test the getObjectFromArgs method. */ public function testGetObjectFromArgs() { $entity = new DummyEntity(); $args = $this->getMockBuilder('Doctrine\\ODM\\MongoDB\\Event\\LifecycleEventArgs')->disableOriginalConstructor()->getMock(); $args->expects($this->once())->method('getDocument')->will($this->returnValue($entity)); $adapter = new MongoDBAdapter(); $this->assertEquals($entity, $adapter->getObjectFromArgs($args)); }
/** * Tests the getReflectionClass method with a proxy. */ public function testGetReflectionClassProxy() { if (!interface_exists('Doctrine\\ODM\\MongoDB\\Proxy\\Proxy')) { $this->markTestSkipped('Doctrine\\ODM\\MongoDB\\Proxy\\Proxy does not exist.'); } else { $obj = new DummyEntityProxyMongo(); $adapter = new MongoDBAdapter(); $class = $adapter->getReflectionClass($obj); $this->assertEquals($class->getName(), get_parent_class($obj)); } }