/**
  * Returns the rendered breadcrumb.
  *
  * @param \Twig_Environment $twig
  * @param array             $context Twig context containing all the view variables.
  * @return string
  */
 public function renderBreadcrumb(\Twig_Environment $twig, array $context)
 {
     $breadcrumb = [];
     foreach ($this->builder->getItems() as $item) {
         $breadcrumb[] = $this->itemProcessor->process($item, $context);
     }
     return $twig->render($this->template, ['items' => $breadcrumb]);
 }
 /**
  * @covers ::__construct
  * @covers ::addItem
  * @covers ::getItems
  */
 public function test_getItems_nonEmptyBreadcrumb()
 {
     $item1 = \Mockery::mock(BreadcrumbItem::class);
     $this->itemFactory->shouldReceive('create')->with('aLabel', 'aRoute', null)->andReturn($item1);
     $item2 = \Mockery::mock(BreadcrumbItem::class);
     $this->itemFactory->shouldReceive('create')->with('anotherLabel', 'anotherRoute', ['a' => 'b'])->andReturn($item2);
     $this->builder->addItem('aLabel', 'aRoute');
     $this->builder->addItem('anotherLabel', 'anotherRoute', ['a' => 'b']);
     $this->assertEquals([$item1, $item2], $this->builder->getItems());
 }