urlInterface = $this->createMock(\Magento\Framework\UrlInterface::class); $this->scopeConfigInterface = $this->createMock(\Magento\Framework\App\Config\ScopeConfigInterface::class); $objectManagerHelper = new ObjectManagerHelper($this); $this->urlBuilder = $objectManagerHelper->getObject( \Magento\Rss\Model\UrlBuilder::class, [ 'urlBuilder' => $this->urlInterface, 'scopeConfig' => $this->scopeConfigInterface ] ); } public function testGetUrlEmpty() { $this->scopeConfigInterface->expects($this->once())->method('getValue') ->with('rss/config/active', \Magento\Store\Model\ScopeInterface::SCOPE_STORE) ->will($this->returnValue(false)); $this->assertEquals('', $this->urlBuilder->getUrl()); } public function testGetUrl() { $this->scopeConfigInterface->expects($this->once())->method('getValue') ->with('rss/config/active', \Magento\Store\Model\ScopeInterface::SCOPE_STORE) ->will($this->returnValue(true)); $this->urlInterface->expects($this->once())->method('getUrl') ->with('rss/feed/index', ['type' => 'rss_feed']) ->will($this->returnValue('http://magento.com/rss/feed/index/type/rss_feed')); $this->assertEquals( 'http://magento.com/rss/feed/index/type/rss_feed', $this->urlBuilder->getUrl(['type' => 'rss_feed']) ); } }