示例#1
0
 public function testNewProperty()
 {
     $data = ['title' => 'Testname', 'tags' => ['tag1', 'tag2'], 'url' => '/news/test', 'article' => 'sulu_io'];
     $contentBefore = $this->mapper->save($data, 'overview', 'sulu_io', 'de', 1);
     $root = $this->session->getRootNode();
     $route = $root->getNode('cmf/sulu_io/routes/de/news/test');
     /** @var NodeInterface $contentNode */
     $contentNode = $route->getPropertyValue('sulu:content');
     // simulate new property article, by deleting the property
     /** @var PropertyInterface $articleProperty */
     $articleProperty = $contentNode->getProperty($this->languageNamespace . ':de-article');
     $this->session->removeItem($articleProperty->getPath());
     $this->session->save();
     $this->documentManager->clear();
     /** @var StructureInterface $content */
     $content = $this->mapper->load($contentBefore->getUuid(), 'sulu_io', 'de');
     // test values
     $this->assertEquals('Testname', $content->title);
     $this->assertEquals(null, $content->article);
     $this->assertEquals('/news/test', $content->url);
     $this->assertEquals(['tag1', 'tag2'], $content->tags);
     $this->assertEquals(StructureInterface::STATE_TEST, $content->getNodeState());
     $this->assertEquals(1, $content->getCreator());
     $this->assertEquals(1, $content->getChanger());
 }
 public function testCaseInsensativeRename()
 {
     $root = $this->session->getNode('/');
     $topic1 = $root->addNode('topic');
     $this->session->save();
     $this->session->move('/topic', '/Topic');
     $this->session->save();
 }
示例#3
0
 /**
  * {@inheritdoc}
  */
 public function execute(InputInterface $input, OutputInterface $output)
 {
     $srcLocale = $input->getArgument('srcLocale');
     $destLocale = $input->getArgument('destLocale');
     $overwrite = $input->getOption('overwrite');
     $dryRun = $input->getOption('dry-run');
     $this->session = $this->getContainer()->get('doctrine_phpcr')->getManager()->getPhpcrSession();
     $this->queryManager = $this->session->getWorkspace()->getQueryManager();
     $this->languageNamespace = $this->getContainer()->getParameter('sulu.content.language.namespace');
     $this->snippetRepository = $this->getContainer()->get('sulu_snippet.repository');
     $this->contentMapper = $this->getContainer()->get('sulu.content.mapper');
     $this->output = $output;
     $this->copyNodes($srcLocale, $destLocale, $overwrite);
     if (false === $dryRun) {
         $this->output->writeln('<info>Saving ...</info>');
         $this->session->save();
         $this->output->writeln('<info>Done</info>');
     } else {
         $this->output->writeln('<info>Dry run complete</info>');
     }
 }