Решил так
<?php
namespace App\Tests;
use ApiPlatform\Core\Bridge\Symfony\Bundle\Test\ApiTestCase;
use App\Service\DaDataService;
use Mockery;
class ApiTest extends ApiTestCase
{
public function testDaDataRequest(): void
{
$client = static::createClient();
/* $mock = $this->getMockBuilder(DaDataService::class)
->disableOriginalConstructor()
->getMock();
$mock->expects($this->once())
->method('getDaData')
->willReturn(20);*/
$mock = Mockery::mock(DaDataService::class);
$mock->shouldReceive('getDaData')
->zeroOrMoreTimes()
->andReturn(7);
$client->getContainer()->set(DaDataService::class, $mock);
$response = $client->request('GET', '/test');
$content = json_decode($response->getContent(), true);
self::assertEquals(7, $content['returnTest']);
self::assertResponseIsSuccessful();
}
}