selectMock = $this->createMock(Select::class); $this->selectMock->expects($this->any())->method('from')->willReturn($this->selectMock); $this->selectMock->expects($this->any())->method('where')->willReturn($this->selectMock); $this->connectionMock = $this->createMock(Mysql::class); $this->connectionMock->expects($this->any())->method('select')->willReturn($this->selectMock); $this->resourceMock = $this->createMock(ResourceConnection::class); $this->resourceMock->expects($this->any())->method('getConnection')->willReturn($this->connectionMock); $this->contextMock = $this->createMock(Context::class); $this->contextMock->expects($this->once())->method('getResources')->willReturn($this->resourceMock); $this->integrationResourceModel = new Integration($this->contextMock); } public function testSelectActiveIntegrationByConsumerId() { $consumerId = 1; $this->connectionMock->expects($this->once())->method('fetchRow')->with($this->selectMock); $this->integrationResourceModel->selectActiveIntegrationByConsumerId($consumerId); } }