Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
CheckoutSummaryConfigProviderTest.php
Go to the documentation of this file.
1 <?php
8 
13 
14 class CheckoutSummaryConfigProviderTest extends \PHPUnit\Framework\TestCase
15 {
19  private $urlBuilderMock;
20 
24  private $scopeConfigMock;
25 
29  private $model;
30 
31  protected function setUp()
32  {
33  $this->urlBuilderMock = $this->getMockBuilder(UrlInterface::class)->getMock();
34  $this->scopeConfigMock = $this->getMockBuilder(ScopeConfigInterface::class)->getMock();
35  $this->model = new CheckoutSummaryConfigProvider($this->urlBuilderMock, $this->scopeConfigMock);
36  }
37 
38  public function testGetConfig()
39  {
40  $maxItemsCount = 10;
41  $cartUrl = 'url/to/cart/page';
42  $expectedResult = [
43  'maxCartItemsToDisplay' => $maxItemsCount,
44  'cartUrl' => $cartUrl
45  ];
46 
47  $this->urlBuilderMock->expects($this->once())->method('getUrl')->with('checkout/cart')->willReturn($cartUrl);
48  $this->scopeConfigMock->expects($this->once())
49  ->method('getValue')
50  ->with('checkout/options/max_items_display_count', ScopeInterface::SCOPE_STORE)
51  ->willReturn($maxItemsCount);
52 
53  $this->assertEquals($expectedResult, $this->model->getConfig());
54  }
55 }