write() публичный Метод

public write ( PHPCR\NodeInterface $node, Sulu\Component\Content\Compat\PropertyInterface $property, $userId, $webspaceKey, $languageCode, $segmentKey )
$node PHPCR\NodeInterface
$property Sulu\Component\Content\Compat\PropertyInterface
Пример #1
0
 public function testWrite()
 {
     $webspaceKey = 'sulu_io';
     $locale = 'de';
     $dateValue = new \DateTime();
     $node = $this->prophesize(NodeInterface::class);
     $property = $this->prophesize(PropertyInterface::class);
     $property->getValue()->willReturn($dateValue->format('Y-m-d'));
     $property->getName()->willReturn('test');
     $date = new Date('test.html.twig');
     // to avoid second jumps
     $dateValue = new \DateTime();
     $date->write($node->reveal(), $property->reveal(), 1, $webspaceKey, $locale, null);
     $node->setProperty('test', Argument::that(function (\DateTime $value) use($dateValue) {
         // let there a delta of 2 seconds is ok
         $this->assertEquals($dateValue->getTimestamp(), $value->getTimestamp(), '', 60);
         return true;
     }))->shouldBeCalled();
 }