/**
  * It should persist data from extensions.
  */
 public function testPersistExtensionsData()
 {
     $document = new TestExtensionDocument(['ext_1' => ['foo' => 'bar']]);
     $this->persistEvent->getDocument()->willReturn($document);
     $this->inspector->getWebspace($document)->willReturn('sulu_io');
     $this->inspector->getLocale($document)->shouldBeCalled()->willReturn('de');
     $this->namespaceRegistry->getPrefix('extension_localized')->willReturn('ext_prefix');
     $this->extensionManager->getExtensions('foobar')->willReturn(['ext_1' => $this->extension->reveal()]);
     $this->extension->getName()->willReturn('ext_1');
     $this->extension->setLanguageCode('de', 'ext_prefix', '')->shouldBeCalled();
     $this->extension->save($this->node->reveal(), ['foo' => 'bar'], 'sulu_io', 'de')->shouldBeCalled();
     $this->subscriber->handlePersist($this->persistEvent->reveal());
 }
Example #2
0
 /**
  * load data from extension.
  */
 private function loadExtensionData(NodeInterface $node, ExtensionInterface $extension, $webspaceKey, $locale)
 {
     $extension->setLanguageCode($locale, $this->namespaceRegistry->getPrefix('extension_localized'), '');
     $data = $extension->load($node, $webspaceKey, $locale);
     return $extension->getContentData($data);
 }
Example #3
0
 /**
  * It should get an extension.
  */
 public function testGetExtension()
 {
     $this->extensionManager->getExtension('content', 'foo')->willReturn($this->extension->reveal());
     $extension = $this->structureManager->getExtension('content', 'foo');
     $this->assertSame($this->extension->reveal(), $extension);
 }