_schemaTool->createSchema( [ $this->_em->getClassMetadata(Category::class), $this->_em->getClassMetadata(Article::class), ] ); } catch (ORMException $e) { } } /** * This test case tests that a versionable entity, that has a oneToOne relationship as it's id can be created * without this bug fix (DDC-3318), you could not do this */ public function testSetVersionOnCreate() { $category = new Category(); $category->name = 'Category'; $article = new Article(); $article->name = 'Article'; $article->category = $category; $this->_em->persist($article); $this->_em->flush(); $this->_em->clear(); $mergeSucceed = false; try { $articleMerged = $this->_em->merge($article); $mergeSucceed = true; } catch (OptimisticLockException $e) { } $this->assertTrue($mergeSucceed); $articleMerged->name = 'Article Merged'; $flushSucceed = false; try { $this->_em->flush(); $flushSucceed = true; } catch (OptimisticLockException $e) { } $this->assertTrue($flushSucceed); } }