public function testRenderLink() { $blockHtml = 'test'; $name = 'test_name'; $this->context->getLayout()->expects($this->once())->method('renderElement')->with($name)->willReturn($blockHtml); /** @var \Magento\Framework\View\Element\AbstractBlock $link */ $link = $this->getMockBuilder('Magento\\Framework\\View\\Element\\AbstractBlock')->disableOriginalConstructor()->getMock(); $link->expects($this->once())->method('getNameInLayout')->willReturn($name); $this->assertEquals($blockHtml, $this->block->renderLink($link)); }