Ejemplo n.º 1
0
 /**
  * @param array $items
  * @param string $result
  *
  * @dataProvider dataProviderGetGridIdsJsonWithUseSelectAll
  */
 public function testGetGridIdsJsonWithUseSelectAll(array $items, $result)
 {
     $this->_block->setUseSelectAll(true);
     $collectionMock = $this->getMockBuilder('Magento\\Framework\\Data\\Collection')->disableOriginalConstructor()->getMock();
     $this->_gridMock->expects($this->once())->method('getCollection')->willReturn($collectionMock);
     $collectionMock->expects($this->once())->method('clear')->willReturnSelf();
     $collectionMock->expects($this->once())->method('setPageSize')->with(0)->willReturnSelf();
     $collectionMock->expects($this->once())->method('getAllIds')->willReturn($items);
     $this->assertEquals($result, $this->_block->getGridIdsJson());
 }
Ejemplo n.º 2
0
 /**
  * @param $itemId
  * @param $expectedItem
  * @dataProvider getItemsDataProvider
  */
 public function testGetItems($itemId, $expectedItem)
 {
     $items = $this->_block->getItems();
     $this->assertCount(2, $items);
     $this->assertArrayHasKey($itemId, $items);
     $actualItem = $items[$itemId];
     $this->assertEquals($expectedItem['id'], $actualItem->getId());
     $this->assertEquals($expectedItem['label'], $actualItem->getLabel());
     $this->assertRegExp($expectedItem['url'], $actualItem->getUrl());
     $this->assertEquals($expectedItem['selected'], $actualItem->getSelected());
     $this->assertEquals($expectedItem['blockname'], $actualItem->getBlockName());
 }
Ejemplo n.º 3
0
 public function testUseSelectAll()
 {
     $this->_block->setUseSelectAll(false);
     $this->assertFalse($this->_block->getUseSelectAll());
     $this->_block->setUseSelectAll(true);
     $this->assertTrue($this->_block->getUseSelectAll());
 }