Neos\ContentRepository\Tests\Functional\Domain\NodeDataTest::nodeWithRelatedEntityWillTakeCareOfAddingToPersistence PHP Метод

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

    public function nodeWithRelatedEntityWillTakeCareOfAddingToPersistence()
    {
        $identifier = Algorithms::generateUUID();
        $template = new NodeTemplate();
        $template->setName('new-node');
        $template->setIdentifier($identifier);
        $newEntity = new Fixtures\RelatedEntity();
        $newEntity->setFavoritePlace('Reykjavik');
        $template->setProperty('entity', $newEntity);
        $rootNode = $this->context->getRootNode();
        $newNode = $rootNode->createNodeFromTemplate($template);
        $this->persistenceManager->persistAll();
        $this->persistenceManager->clearState();
        $this->inject($this->contextFactory, 'contextInstances', array());
        $newLiveContext = $this->contextFactory->create(array('workspaceName' => 'live'));
        $newNodeAgain = $newLiveContext->getNode('/new-node');
        $this->assertEquals($newNode->getIdentifier(), $newNodeAgain->getIdentifier());
        $this->assertEquals('Reykjavik', $newNodeAgain->getProperty('entity')->getFavoritePlace());
    }