42 $this->mockCurlRequest = \Mockery::mock(
'CurlRequest');
44 $this->mockCurlRequest->shouldReceive(
'setOptions')->once()->with(array(
45 CURLOPT_HEADER =>
true,
46 CURLOPT_RETURNTRANSFER =>
true,
47 CURLOPT_HTTPHEADER => array(
'User-Agent: fossology'),
50 $this->mockCurlRequest->shouldReceive(
'execute')->once()
51 ->andReturn(
'HEADER{"key": "value"}');
52 $this->mockCurlRequest->shouldReceive(
'getInfo')->once()
53 ->with(CURLINFO_HEADER_SIZE)->andReturn(6);
54 $this->mockCurlRequest->shouldReceive(
'close')->once();
75 $mockCurlRequestServer = \Mockery::mock(
'CurlRequestService');
76 $mockCurlRequestServer->shouldReceive(
'create')->once()
77 ->with(
'https://api.github.com/repos/fossology/fossology/releases/latest')
78 ->andReturn($this->mockCurlRequest);
81 $this->assertEquals(array(
'key' =>
'value'), $repositoryApi->getLatestRelease());
93 $mockCurlRequestServer = \Mockery::mock(
'CurlRequestServer');
94 $mockCurlRequestServer->shouldReceive(
'create')->once()
95 ->with(
'https://api.github.com/repos/fossology/fossology/commits?since=2018-06-28T12:00:00Z')
96 ->andReturn($this->mockCurlRequest);
99 $this->assertEquals(array(
'key' =>
'value'), $repositoryApi->getCommitsOfLastDays(60));
Helper class to get the latest release and commits from GitHub API.
Utility functions for specific applications.
tearDown()
Tear down mock objects.
testGetLatestRelease()
Test for RepositoryApi::getLatestRelease()
testGetCommitsOfLastDays()
Test for RepositoryApi::getCommitsOfLastDays()
setUp()
One time setup for test.