Inheritance: extends Sulu\Component\Content\ComplexContentType, implements Sulu\Component\Content\ContentTypeExportInterface
Beispiel #1
0
 public function testWriteWithNoneExistingUUID()
 {
     $subNode1 = $this->getMockForAbstractClass('Sulu\\Bundle\\ContentBundle\\Tests\\Unit\\Content\\Types\\InternalLink\\NodeInterface', [], '', true, true, true);
     $subNode1->expects($this->any())->method('getIdentifier')->will($this->returnValue('123-123-123'));
     $subNode2 = $this->getMockForAbstractClass('Sulu\\Bundle\\ContentBundle\\Tests\\Unit\\Content\\Types\\InternalLink\\NodeInterface', [], '', true, true, true);
     $subNode2->expects($this->any())->method('getIdentifier')->will($this->returnValue('123-456-789'));
     $node = $this->getMockForAbstractClass('Sulu\\Bundle\\ContentBundle\\Tests\\Unit\\Content\\Types\\InternalLink\\NodeInterface', [], '', true, true, true);
     $session = $this->getMockForAbstractClass('PHPCR\\SessionInterface', [], '', true, true, true);
     $node->expects($this->any())->method('getSession')->will($this->returnValue($session));
     $session->expects($this->any())->method('getNodesByIdentifier')->will($this->returnValue([$subNode1, $subNode2]));
     $property = $this->getMockForAbstractClass('Sulu\\Component\\Content\\Compat\\PropertyInterface', [], '', true, true, true);
     $property->expects($this->any())->method('getName')->will($this->returnValue('property'));
     $property->expects($this->any())->method('getValue')->will($this->returnValue(['123-123-123', '123-456-789', 'not existing']));
     $node->expects($this->once())->method('setProperty')->with('property', ['123-123-123', '123-456-789']);
     $this->internalLinks->write($node, $property, 1, 'test', 'de', null);
 }
Beispiel #2
0
 /**
  * @dataProvider provideGetReferencedUuids
  */
 public function testGetReferencedUuids($propertyValue, $expected)
 {
     $this->property->getValue()->willReturn($propertyValue);
     $uuids = $this->type->getReferencedUuids($this->property->reveal());
     $this->assertEquals($expected, $uuids);
 }