40 $this->contextMock = $this->createPartialMock(\
Magento\Framework\Model\Context::class, [
'getEventDispatcher']);
41 $eventManagerMock = $this->getMockForAbstractClass(
42 \
Magento\Framework\Event\ManagerInterface::class,
50 $this->contextMock->expects($this->once())
51 ->method(
'getEventDispatcher')
52 ->will($this->returnValue($eventManagerMock));
53 $this->registryMock = $this->createMock(\
Magento\Framework\Registry::class);
54 $this->resourceMock = $this->getMockForAbstractClass(
61 [
'getIdFieldName',
'load',
'selectActiveIntegrationByConsumerId']
63 $this->resourceCollectionMock = $this->createMock(\
Magento\Framework\Data\
Collection\AbstractDb::class);
64 $this->integrationModel = new \Magento\Integration\Model\Integration(
68 $this->resourceCollectionMock
75 $this->resourceMock->expects($this->once())
79 $this->integrationModel->loadByConsumerId($consumerId);
80 $this->assertFalse($this->integrationModel->hasDataChanges());
87 'integration_id' => 1,
88 'name' =>
'Test Integration' 91 $this->resourceMock->expects($this->once())
92 ->method(
'selectActiveIntegrationByConsumerId')
94 ->will($this->returnValue($integrationData));
96 $this->integrationModel->loadActiveIntegrationByConsumerId($consumerId);
97 $this->assertEquals($integrationData, $this->integrationModel->getData());
102 $this->integrationModel->setStatus(1);
103 $this->assertEquals(1, $this->integrationModel->getStatus());
testLoadActiveIntegrationByConsumerId()