public function testPrepare() { $this->prepareMeta(); $config = ['page_actions' => ['add' => ['name' => 'add', 'label' => __('Add New'), 'class' => 'primary', 'url' => 'http://some.url']]]; $this->urlBuilder->expects($this->at(0))->method('getUrl')->with('*/*/new')->willReturn('http://mage.local/category/new'); $dataCollection = $this->getMock('Magento\\Framework\\Data\\CollectionDataSourceInterface', [], [], '', false); $this->listingView->setData('configuration', $config); $this->listingView->setData('name', 'someName'); $this->listingView->setData('dataSource', $dataCollection); $this->actionPool->expects($this->once())->method('add')->with('add', $config['page_actions']['add'], $this->listingView); $this->configurationFactory->expects($this->once())->method('create')->willReturn($this->configuration); $this->assertNull($this->listingView->prepare()); }