Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
DataBuilderTest.php
Go to the documentation of this file.
1 <?php
8 
10 
11 class DataBuilderTest extends \PHPUnit\Framework\TestCase
12 {
16  protected $dataBuilder;
17 
18  protected function setUp()
19  {
20  $objectManagerHelper = new ObjectManagerHelper($this);
21  $this->dataBuilder = $objectManagerHelper->getObject(
22  \Magento\Catalog\Model\Layer\Filter\Item\DataBuilder::class,
23  []
24  );
25  }
26 
27  public function testBuild()
28  {
29  $data = [
30  [
31  'label' => 'Test label',
32  'value' => 34,
33  'count' => 21235,
34  ],
35  [
36  'label' => 'New label for test',
37  'value' => 2344,
38  'count' => 122,
39  ],
40  ];
41 
42  foreach ($data as $item) {
43  $this->dataBuilder->addItemData($item['label'], $item['value'], $item['count']);
44  }
45 
46  $actualData = $this->dataBuilder->build();
47  $this->assertEquals($data, $actualData);
48  }
49 }