35 $objectManager = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this);
36 $this->agreementCollFactoryMock = $this->createPartialMock(
41 $this->scopeConfigMock = $this->createMock(\
Magento\Framework\
App\Config\ScopeConfigInterface::class);
42 $this->storeManagerMock = $this->createMock(\
Magento\Store\Model\StoreManagerInterface::class);
44 $contextMock = $this->createMock(\
Magento\Framework\View\Element\Template\Context::class);
45 $contextMock->expects($this->once())->method(
'getScopeConfig')->willReturn($this->scopeConfigMock);
46 $contextMock->expects($this->once())->method(
'getStoreManager')->willReturn($this->storeManagerMock);
49 \
Magento\CheckoutAgreements\Block\Agreements::class,
51 'agreementCollectionFactory' => $this->agreementCollFactoryMock,
52 'context' => $contextMock
60 $this->scopeConfigMock->expects($this->once())
65 $agreementCollection = $this->createMock(
68 $this->agreementCollFactoryMock->expects($this->once())->method(
'create')->willReturn($agreementCollection);
70 $storeMock = $this->createMock(\
Magento\Store\Model\Store::class);
71 $storeMock->expects($this->once())->method(
'getId')->willReturn(
$storeId);
72 $this->storeManagerMock->expects($this->once())->method(
'getStore')->willReturn($storeMock);
74 $agreementCollection->expects($this->once())->method(
'addStoreFilter')->with(
$storeId)->willReturnSelf();
75 $agreementCollection->expects($this->once())
76 ->method(
'addFieldToFilter')
77 ->with(
'is_active', 1)
80 $this->assertEquals($agreementCollection, $this->model->getAgreements());
86 $this->scopeConfigMock->expects($this->once())
90 $this->assertEquals($expectedResult, $this->model->getAgreements());
$agreementCollFactoryMock
testGetAgreementsIfAgreementsDisabled()