Skip to content

Commit

Permalink
Update the toolbar coverage test to use the a layout toolbar declarat…
Browse files Browse the repository at this point in the history
…ion present in default layout. Remove the previews correction made because it's not solve the problem where is checking if the toolbar HTML is not empty.
  • Loading branch information
mariuscris committed Oct 16, 2017
1 parent b6ed2d9 commit 9cd20c0
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -55,16 +55,16 @@ public function testToolbarCoverage()
$parent = $this->_getLayout()->createBlock(\Magento\Catalog\Block\Product\ListProduct::class, 'parent');

/* Prepare toolbar block */
$this->_getLayout()->createBlock(\Magento\Catalog\Block\Product\ProductList\Toolbar::class, 'product_list_toolbar');
$parent->setToolbarBlockName('product_list_toolbar');

$toolbar = $parent->getToolbarBlock();
$this->assertInstanceOf(\Magento\Catalog\Block\Product\ProductList\Toolbar::class, $toolbar, 'Default Toolbar');

$parent->setChild('toolbar', $toolbar);
/* In order to initialize toolbar collection block toHtml should be called before toolbar toHtml */
$this->assertEmpty($parent->toHtml(), 'Block HTML'); /* Template not specified */
$this->assertEquals('grid', $parent->getMode(), 'Default Mode'); /* default mode */

/* In order to use toolbar html you need a collection to be set to toolbar block */
$parent->getToolbarBlock()->setCollection($parent->getLoadedProductCollection());
$this->assertNotEmpty($parent->getToolbarHtml(), 'Toolbar HTML'); /* toolbar for one simple product */
}

Expand Down

0 comments on commit 9cd20c0

Please sign in to comment.