I have the following service which I want to test:
namespace App\Service;
class ApiManager
{
public function getProjects()
{
$projects = $this->pager->fetchAll(
$this->client->api('projects'),
'all',
[['simple' => true]]
);
}
}
The service makes use of the Gitlab API bundle for PHP. So the data in $projects looks like this:
[
0 => [
'id' => 1,
'title' => 'Project #1',
'description' => 'Project description...'
],
1 => [
'id' => 2,
'title' => 'Project #2',
'description' => 'Project description...'
],
]
Of course I don't want to test with real data from the API. How can I mock the data that gets returned from the HTTP request in getProjects?