36 $objectManager = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this);
38 $this->agreementCollFactoryMock = $this->createPartialMock(
42 $this->storeManagerMock = $this->createMock(\
Magento\Store\Model\StoreManagerInterface::class);
43 $this->scopeConfigMock = $this->createMock(\
Magento\Framework\
App\Config\ScopeConfigInterface::class);
46 \
Magento\CheckoutAgreements\Model\AgreementsProvider::class,
48 'agreementCollectionFactory' => $this->agreementCollFactoryMock,
49 'storeManager' => $this->storeManagerMock,
50 'scopeConfig' => $this->scopeConfigMock
58 $expectedResult = [1, 2, 3, 4, 5];
59 $this->scopeConfigMock->expects($this->once())
64 $agreementCollection = $this->createMock(
67 $this->agreementCollFactoryMock->expects($this->once())->method(
'create')->willReturn($agreementCollection);
69 $storeMock = $this->createMock(\
Magento\Store\Model\Store::class);
70 $storeMock->expects($this->once())->method(
'getId')->willReturn(
$storeId);
71 $this->storeManagerMock->expects($this->once())->method(
'getStore')->willReturn($storeMock);
73 $agreementCollection->expects($this->once())->method(
'addStoreFilter')->with(
$storeId)->willReturnSelf();
74 $agreementCollection->expects($this->at(1))
75 ->method(
'addFieldToFilter')
76 ->with(
'is_active', 1)
78 $agreementCollection->expects($this->at(2))
79 ->method(
'addFieldToFilter')
82 $agreementCollection->expects($this->once())->method(
'getAllIds')->willReturn($expectedResult);
84 $this->assertEquals($expectedResult, $this->model->getRequiredAgreementIds());
90 $this->scopeConfigMock->expects($this->once())
94 $this->assertEquals($expectedResult, $this->model->getRequiredAgreementIds());
testGetRequiredAgreementIdsIfAgreementsDisabled()
$agreementCollFactoryMock
testGetRequiredAgreementIdsIfAgreementsEnabled()