public function testGetHrefByPageId() { $href = 'pagelink'; $this->mockCmsPage->expects($this->once())->method('getPageUrl')->willReturn($href); $this->linkElement->setData('page_id', 1); $this->assertEquals($href, $this->linkElement->getHref()); }
/** * @covers \Magento\Cms\Model\Observer::noCookies * @param string $pageUrl * @dataProvider noCookiesDataProvider */ public function testNoCookies($pageUrl) { $pageId = 1; $this->observerMock->expects($this->atLeastOnce())->method('getEvent')->willReturn($this->eventMock); $this->eventMock->expects($this->atLeastOnce())->method('getRedirect')->willReturn($this->objectMock); $this->scopeConfigMock->expects($this->atLeastOnce())->method('getValue')->with('web/default/cms_no_cookies', 'store')->willReturn($pageId); $this->cmsPageMock->expects($this->atLeastOnce())->method('getPageUrl')->with($pageId)->willReturn($pageUrl); $this->objectMock->expects($this->any())->method('setRedirectUrl')->with($pageUrl)->willReturnSelf(); $this->objectMock->expects($this->any())->method('setRedirect')->with(true)->willReturnSelf(); $this->objectMock->expects($this->any())->method('setPath')->with('cms/index/noCookies')->willReturnSelf(); $this->objectMock->expects($this->any())->method('setArguments')->with([])->willReturnSelf(); $this->assertEquals($this->this, $this->this->noCookies($this->observerMock)); }