Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
OperationPoolTest.php
Go to the documentation of this file.
1 <?php
7 
8 use PHPUnit\Framework\TestCase;
11 
12 class OperationPoolTest extends TestCase
13 {
15  {
16  $objectManagerMock = $this->createMock(ObjectManagerInterface::class);
17  $operationPool = new OperationPool(
18  $objectManagerMock,
19  []
20  );
21 
22  $objectManagerMock->expects($this->once())
23  ->method('get')
24  ->with(\Magento\Framework\EntityManager\Operation\Read::class);
25  $operationPool->getOperation('entity_type', 'read');
26  }
27 
29  {
30  $customReadOperation = 'CustomReadOperation';
31  $objectManagerMock = $this->createMock(ObjectManagerInterface::class);
32  $operationPool = new OperationPool(
33  $objectManagerMock,
34  [
35  'default' => [
36  'read' => $customReadOperation,
37  'new' => 'CustomNewOperation',
38  ],
39  ]
40  );
41 
42  $objectManagerMock->expects($this->once())
43  ->method('get')
44  ->with($customReadOperation);
45  $operationPool->getOperation('entity_type', 'read');
46  }
47 }