1
|
|
|
<?php |
2
|
|
|
namespace ElevenLabs\ApiServiceBundle\Factory; |
3
|
|
|
|
4
|
|
|
use ElevenLabs\Api\Decoder\DecoderInterface; |
5
|
|
|
use ElevenLabs\Api\Factory\SchemaFactory; |
6
|
|
|
use ElevenLabs\Api\Schema; |
7
|
|
|
use ElevenLabs\Api\Service\ApiService; |
8
|
|
|
use Http\Client\HttpClient; |
9
|
|
|
use Http\Message\MessageFactory; |
10
|
|
|
use Http\Message\UriFactory; |
11
|
|
|
use JsonSchema\Validator; |
12
|
|
|
use PHPUnit\Framework\TestCase; |
13
|
|
|
use org\bovigo\vfs\vfsStream; |
|
|
|
|
14
|
|
|
use Rize\UriTemplate; |
15
|
|
|
use Symfony\Component\Serializer\SerializerInterface; |
16
|
|
|
|
17
|
|
|
class ServiceFactoryTest extends TestCase |
18
|
|
|
{ |
19
|
|
|
/** @test */ |
20
|
|
|
public function itShouldReturnAService() |
21
|
|
|
{ |
22
|
|
|
$aSchemaFile = 'schema.json'; |
23
|
|
|
|
24
|
|
|
$uriFactory = $this->prophesize(UriFactory::class); |
25
|
|
|
$uriTemplate = $this->prophesize(UriTemplate::class); |
26
|
|
|
$messageFactory = $this->prophesize(MessageFactory::class); |
27
|
|
|
$validator = $this->prophesize(Validator::class); |
28
|
|
|
$serializer = $this->prophesize(SerializerInterface::class); |
29
|
|
|
$decoder = $this->prophesize(DecoderInterface::class); |
30
|
|
|
|
31
|
|
|
$factory = new ServiceFactory( |
32
|
|
|
$uriFactory->reveal(), |
33
|
|
|
$uriTemplate->reveal(), |
34
|
|
|
$messageFactory->reveal(), |
35
|
|
|
$validator->reveal(), |
36
|
|
|
$serializer->reveal(), |
37
|
|
|
$decoder->reveal() |
38
|
|
|
); |
39
|
|
|
|
40
|
|
|
$httpClient = $this->prophesize(HttpClient::class); |
41
|
|
|
|
42
|
|
|
$schema = $this->prophesize(Schema::class); |
43
|
|
|
$schema->getSchemes()->willReturn(['http']); |
44
|
|
|
$schema->getHost()->willReturn('domain.tld'); |
45
|
|
|
|
46
|
|
|
$schemaFactory = $this->prophesize(SchemaFactory::class); |
47
|
|
|
$schemaFactory->createSchema($aSchemaFile)->shouldBeCalledTimes(1)->willReturn($schema); |
48
|
|
|
|
49
|
|
|
$service = $factory->getService( |
50
|
|
|
$httpClient->reveal(), |
51
|
|
|
$schemaFactory->reveal(), |
52
|
|
|
$aSchemaFile, |
53
|
|
|
$config = [] |
54
|
|
|
); |
55
|
|
|
|
56
|
|
|
self::assertInstanceOf(ApiService::class, $service); |
57
|
|
|
} |
58
|
|
|
} |
59
|
|
|
|
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"]
, you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths