public function testItAddsChildNodesBasedOnProperties()
 {
     $properties = ['a' => 1, 'b' => 2];
     $this->givenTypeSupportedReturns(true);
     $this->givenGetTypeReturns(new PrimitiveType());
     $this->givenGetPropertiesReturns($properties);
     $node = $this->context->getNodeForData(null);
     $resolvedNode = $this->SUT->resolve($node, $this->context);
     $this->assertCount(2, $resolvedNode->getChildNodes());
     $this->assertCount(3, $this->context->getNodes());
 }
Example #2
0
 /**
  * @param Context $context
  * @throws Exception
  */
 public function __construct(Context $context)
 {
     $this->nodes = $context->getNodes();
     foreach ($this->nodes as $node) {
         if (!$node->hasType()) {
             throw new Exception('Detected non-resolved node in result context');
         }
         $this->nodesById[$node->getId()] = $node;
     }
 }