Refer to 'ContextFactoryInterface' instead of 'ContextFactory' when injecting this factory into your own class.
Inheritance: implements Neos\ContentRepository\Domain\Service\ContextFactoryInterface
 /**
  * @test
  */
 public function setDateTimeAllowsForMockingTheCurrentTime()
 {
     $simulatedCurrentTime = new \DateTime();
     $simulatedCurrentTime->add(new \DateInterval('P1D'));
     $context = $this->contextFactory->create(array('currentDateTime' => $simulatedCurrentTime));
     $this->assertEquals($simulatedCurrentTime, $context->getCurrentDateTime());
 }
 /**
  * Returns a node from the given $nodeIdentifier (disabling authorization checks)
  *
  * @param string $nodeIdentifier
  * @return NodeInterface
  */
 protected function getNodeByIdentifier($nodeIdentifier)
 {
     $context = $this->contextFactory->create();
     $node = null;
     $this->securityContext->withoutAuthorizationChecks(function () use($nodeIdentifier, $context, &$node) {
         $node = $context->getNodeByIdentifier($nodeIdentifier);
     });
     $context->getFirstLevelNodeCache()->setByIdentifier($nodeIdentifier, null);
     return $node;
 }
 /**
  * @param array $contextProperties
  * @return void
  * @throws InvalidNodeContextException
  */
 protected function validateContextProperties($contextProperties)
 {
     parent::validateContextProperties($contextProperties);
     if (isset($contextProperties['currentSite'])) {
         if (!$contextProperties['currentSite'] instanceof Site) {
             throw new InvalidNodeContextException('You tried to set currentSite in the context and did not provide a \\Neos\\Neos\\Domain\\Model\\Site object as value.', 1373145297);
         }
     }
     if (isset($contextProperties['currentDomain'])) {
         if (!$contextProperties['currentDomain'] instanceof Domain) {
             throw new InvalidNodeContextException('You tried to set currentDomain in the context and did not provide a \\Neos\\Neos\\Domain\\Model\\Domain object as value.', 1373145384);
         }
     }
 }