public function testAddBreadcrumbNoBlock() { $label = 'label'; $title = 'title'; $this->layoutMock->expects($this->once())->method('getBlock')->with('breadcrumbs')->willReturn(false); $this->breadcrumbsBlockMock->expects($this->never())->method('addLink'); $this->assertSame($this->resultPage, $this->resultPage->addBreadcrumb($label, $title)); }
/** * @covers \Magento\Email\Controller\Adminhtml\Email\Template\Edit::execute */ public function testExecuteEdit() { $this->requestMock->expects($this->any())->method('getParam')->with('id')->willReturn(1); $this->registryMock->expects($this->atLeastOnce())->method('registry')->willReturnMap([['email_template', false], ['current_email_template', false]]); $this->pageTitleMock->expects($this->any())->method('prepend')->willReturnMap([['Email Templates', $this->returnSelf()], ['My Template', $this->returnSelf()]]); $this->breadcrumbsBlockMock->expects($this->any())->method('addLink')->willReturnMap([['Transactional Emails', 'Transactional Emails', null, $this->returnSelf()], ['Edit Template', 'Edit System Template', null, $this->returnSelf()]]); $this->assertNull($this->editController->execute()); }
/** * @covers \Magento\Email\Controller\Adminhtml\Email\Template\Index::execute */ public function testExecute() { $this->prepareExecute(); $this->viewMock->expects($this->atLeastOnce())->method('getLayout')->willReturn($this->layoutMock); $this->layoutMock->expects($this->at(0))->method('getBlock')->with('menu')->will($this->returnValue($this->menuBlockMock)); $this->menuBlockMock->expects($this->any())->method('getMenuModel')->will($this->returnSelf()); $this->menuBlockMock->expects($this->any())->method('getParentItems')->will($this->returnValue([])); $this->viewMock->expects($this->once())->method('getPage')->willReturn($this->resultPageMock); $this->resultPageMock->expects($this->once())->method('getConfig')->willReturn($this->pageConfigMock); $this->pageConfigMock->expects($this->once())->method('getTitle')->willReturn($this->pageTitleMock); $this->pageTitleMock->expects($this->once())->method('prepend')->with('Email Templates'); $this->layoutMock->expects($this->at(1))->method('getBlock')->with('breadcrumbs')->will($this->returnValue($this->breadcrumbsBlockMock)); $this->breadcrumbsBlockMock->expects($this->any())->method('addLink')->willReturnSelf(); $this->assertNull($this->indexController->execute()); }