Example #1
0
 /**
  * @param string   $name
  * @param Template $template
  */
 public function setTemplate($name, Template $template)
 {
     $this->templates[$name] = $template;
     $this->graphNode->setResourceHandler($name, $this);
 }
Example #2
0
 /**
  * It resolves origins resource names from aliases.
  */
 function it_resolves_origin_resource_names_from_aliases()
 {
     $handler = (object) [];
     $node1 = new GraphNode();
     $node1->setResourceHandler('foo', $handler);
     $node1->export('foo');
     $node1->export('foo', 'bar');
     $node2 = new GraphNode();
     $node2->import($node1, ['foo' => 'foo', 'bar' => 'baz']);
     $node2->export('foo');
     $node2->export('baz', 'qux');
     $this->import($node2, ['foo' => 'foo', 'qux' => 'quux']);
     $this->getResourceHandler('quux')->shouldReturn($handler);
     $this->getResourceIdentifier('quux')->shouldReturn('foo');
     $this->getResourceHandler('foo')->shouldReturn($handler);
     $this->getResourceIdentifier('foo')->shouldReturn('foo');
 }