Ejemplo n.º 1
0
 /**
  * @BeforeScenario
  */
 public function purgeAndInitializeDatabase()
 {
     $purger = new PHPCRPurger($this->documentManager);
     $purger->purge();
     $this->documentManager->clear();
     $this->initializerManager->initialize();
 }
 /**
  * Just make one field of a document untranslated again
  */
 public function testPartialUntranslateChild()
 {
     $article = new ChildTranslationArticle();
     $article->id = '/functional/convert';
     $article->topic = 'Some interesting subject';
     $article->setText('Lorem ipsum...');
     $this->dm->persist($article);
     $this->dm->flush();
     $this->dm->clear();
     $class = 'Doctrine\\Tests\\Models\\Translation\\ChildTranslationArticle';
     $field = 'author';
     $node = $this->node->getNode('convert');
     $node->getNode('phpcr_locale:en')->setProperty($field, 'Move to untranslated');
     $this->session->save();
     $this->assertFalse($this->converter->convert($class, array('en'), array($field)));
     $this->session->save();
     $this->dm->clear();
     $this->dm = $this->createDocumentManager();
     $this->dm->setLocaleChooserStrategy(new LocaleChooser($this->localePrefs, 'en'));
     $this->assertTrue($node->hasProperty($field), 'new property was not created');
     $this->assertTrue($node->hasNode('phpcr_locale:en'), 'lost translation');
     $this->assertFalse($node->getNode('phpcr_locale:en')->hasProperty($field), 'old property was not removed');
     $article = $this->dm->find(null, '/functional/convert');
     $this->assertInstanceof($class, $article);
     $this->assertEquals('Move to untranslated', $article->author);
     $this->assertEquals('Lorem ipsum...', $article->getText());
     $this->dm->clear();
     $article = $this->dm->find(null, '/functional/convert');
     $this->assertInstanceof($class, $article);
     $this->assertEquals('Move to untranslated', $article->author);
     $this->assertEquals('Lorem ipsum...', $article->getText());
 }
 /**
  * {@inheritDoc}
  */
 public function clear($className = null)
 {
     $this->wrapped->clear($className);
 }