Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
PlaceOrderPoolTest.php
Go to the documentation of this file.
1 <?php
6 declare(strict_types=1);
7 
9 
13 
17 class PlaceOrderPoolTest extends \PHPUnit\Framework\TestCase
18 {
27  public function testGet(string $paymentProviderCode, array $placeOrderList, $expectedResult)
28  {
30  $tMapFactory = $this->getMockBuilder(TMapFactory::class)
31  ->disableOriginalConstructor()
32  ->getMock();
33  $tMapFactory->method('createSharedObjectsMap')->willReturn($placeOrderList);
34 
35  $placeOrderPool = new PlaceOrderPool($tMapFactory);
36  $result = $placeOrderPool->get($paymentProviderCode);
37 
38  $this->assertEquals($expectedResult, $result);
39  }
40 
44  public function getDataProvider(): array
45  {
46  $placeOrder = $this->getMockForAbstractClass(PlaceOrderInterface::class);
47  $placeOrderList = ['payment_code' => $placeOrder];
48 
49  return [
50  'code exists in pool' => ['payment_code', $placeOrderList, $placeOrder],
51  'no code in pool' => ['some_code', $placeOrderList, null],
52  ];
53  }
54 }