read() public method

public read ( PHPCR\NodeInterface $node, Sulu\Component\Content\Compat\PropertyInterface $property, $webspaceKey, $languageCode, $segmentKey )
$node PHPCR\NodeInterface
$property Sulu\Component\Content\Compat\PropertyInterface
Ejemplo n.º 1
0
 public function testRead()
 {
     $categoryEntity1 = new CategoryEntity();
     $categoryTranslation1 = new CategoryTranslationEntity();
     $categoryTranslation1->setLocale('en');
     $categoryTranslation1->setTranslation('Category 1');
     $categoryEntity1->addTranslation($categoryTranslation1);
     $categoryEntity2 = new CategoryEntity();
     $categoryTranslation2 = new CategoryTranslationEntity();
     $categoryTranslation2->setLocale('en');
     $categoryTranslation2->setTranslation('Category 2');
     $categoryEntity2->addTranslation($categoryTranslation2);
     $category1 = new Category($categoryEntity1, 'en');
     $category2 = new Category($categoryEntity2, 'en');
     $this->categoryManager->expects($this->any())->method('findByIds')->will($this->returnValueMap([[[1, 2], [$categoryEntity1, $categoryEntity2]]]));
     $this->categoryManager->expects($this->any())->method('getApiObjects')->will($this->returnValueMap([[[$categoryEntity1, $categoryEntity2], 'en', [$category1, $category2]]]));
     $node = $this->getMockBuilder('PHPCR\\NodeInterface')->getMock();
     $node->expects($this->any())->method('getPropertyValueWithDefault')->will($this->returnValueMap([['property', [], [1, 2]]]));
     $property = $this->getMockBuilder('Sulu\\Component\\Content\\Compat\\PropertyInterface')->getMock();
     $property->expects($this->any())->method('getName')->willReturn('property');
     $property->expects($this->any())->method('setValue')->with([$category1->toArray(), $category2->toArray()]);
     $this->categoryManager->expects($this->once())->method('findByIds');
     $this->categoryList->read($node, $property, null, 'en', null);
 }