Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
AggregationFactoryTest.php
Go to the documentation of this file.
1 <?php
7 
10 
14 class AggregationFactoryTest extends \PHPUnit\Framework\TestCase
15 {
16 
20  private $model;
21 
25  protected $objectManager;
26 
32  protected function setUp()
33  {
34  $this->objectManager = $this->getMockBuilder(\Magento\Framework\ObjectManagerInterface::class)
35  ->setMethods(['create'])
36  ->disableOriginalConstructor()
37  ->getMockForAbstractClass();
38 
39  $objectManagerHelper = new ObjectManagerHelper($this);
40  $this->objectManager->expects($this->any())
41  ->method('create')
42  ->willReturn($this->createMock(\Magento\Framework\Search\Response\Aggregation::class));
43  $this->model = $objectManagerHelper->getObject(
44  \Magento\Elasticsearch\SearchAdapter\AggregationFactory::class,
45  [
46  'objectManager' => $this->objectManager
47  ]
48  );
49  }
50 
56  public function testCreate()
57  {
58  $object = $this->model->create(
59  [
60  'price_bucket' => [
61  'name' => 1,
62  ],
63  'category_bucket' => [],
64  ]
65  );
66  $this->assertNotNull($object);
67  }
68 }