useModelSet('cms'); parent::setUp(); } public function testSimpleDetachMerge() { $user = new CmsUser; $user->name = 'Roman'; $user->username = 'romanb'; $user->status = 'dev'; $this->_em->save($user); $this->_em->flush(); $this->_em->clear(); // $user is now detached $this->assertFalse($this->_em->contains($user)); $user->name = 'Roman B.'; //$this->assertEquals(UnitOfWork::STATE_DETACHED, $this->_em->getUnitOfWork()->getEntityState($user)); $user2 = $this->_em->merge($user); $this->assertFalse($user === $user2); $this->assertTrue($this->_em->contains($user2)); $this->assertEquals('Roman B.', $user2->name); } }