2 # SPDX-FileCopyrightText: © Fossology contributors 
    4 # SPDX-License-Identifier: GPL-2.0-only 
   29   protected function setUp() : void
 
   31     $this->mockCurlRequest = \Mockery::mock(
'CurlRequest');
 
   33     $this->mockCurlRequest->shouldReceive(
'setOptions')->once()->with(array(
 
   34       CURLOPT_HEADER         => 
true,
 
   35       CURLOPT_RETURNTRANSFER => 
true,
 
   36       CURLOPT_HTTPHEADER     => array(
'User-Agent: fossology'),
 
   39     $this->mockCurlRequest->shouldReceive(
'execute')->once()
 
   40       ->andReturn(
'HEADER{"key": "value"}');
 
   41     $this->mockCurlRequest->shouldReceive(
'getInfo')->once()
 
   42       ->with(CURLINFO_HEADER_SIZE)->andReturn(6);
 
   43     $this->mockCurlRequest->shouldReceive(
'close')->once();
 
   64     $mockCurlRequestServer = \Mockery::mock(
'CurlRequestService');
 
   65     $mockCurlRequestServer->shouldReceive(
'create')->once()
 
   66       ->with(
'https://api.github.com/repos/fossology/fossology/releases/latest')
 
   67       ->andReturn($this->mockCurlRequest);
 
   70     $this->assertEquals(array(
'key' => 
'value'), $repositoryApi->getLatestRelease());
 
   82     $mockCurlRequestServer = \Mockery::mock(
'CurlRequestServer');
 
   83     $mockCurlRequestServer->shouldReceive(
'create')->once()
 
   84       ->with(
'https://api.github.com/repos/fossology/fossology/commits?since=2018-06-28T12:00:00Z')
 
   85       ->andReturn($this->mockCurlRequest);
 
   88     $this->assertEquals(array(
'key' => 
'value'), $repositoryApi->getCommitsOfLastDays(60));
 
setUp()
One time setup for test.
testGetCommitsOfLastDays()
Test for RepositoryApi::getCommitsOfLastDays()
tearDown()
Tear down mock objects.
testGetLatestRelease()
Test for RepositoryApi::getLatestRelease()
Helper class to get the latest release and commits from GitHub API.
Utility functions for specific applications.