From 89cfb7f1d0bd837fdc3daf3847d1c459852af5a7 Mon Sep 17 00:00:00 2001 From: Christophe Coevoet Date: Thu, 20 Jan 2022 02:05:14 +0100 Subject: [PATCH] Fix the specs to pass --- spec/Packagist/Api/ClientSpec.php | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/spec/Packagist/Api/ClientSpec.php b/spec/Packagist/Api/ClientSpec.php index a231fbd..886a6cc 100644 --- a/spec/Packagist/Api/ClientSpec.php +++ b/spec/Packagist/Api/ClientSpec.php @@ -102,13 +102,17 @@ public function it_gets_composer_package_details(HttpClient $client, Factory $fa $response->getBody()->shouldBeCalled()->willReturn($body); $body->getContents()->shouldBeCalled()->willReturn($data); - $client->request('GET', 'https://packagist.org/p/sylius/sylius.json') + $client->request('GET', 'https://packagist.org/p2/sylius/sylius~dev.json') ->shouldBeCalled() ->willReturn($response); - $factory->create(json_decode($data, true))->shouldBeCalled(); + $packages = [ + '1.0.0' => ['name' => 'sylius/sylius', 'version' => '1.0.0'] + ]; + + $factory->create(json_decode($data, true))->shouldBeCalled()->willReturn($packages); - $this->getComposer('sylius/sylius'); + $this->getComposer('sylius/sylius')->shouldBe($packages); } public function it_gets_composer_lite_package_details(HttpClient $client, Factory $factory, Response $response, Stream $body): void @@ -117,13 +121,17 @@ public function it_gets_composer_lite_package_details(HttpClient $client, Factor $response->getBody()->shouldBeCalled()->willReturn($body); $body->getContents()->shouldBeCalled()->willReturn($data); - $client->request('GET', 'https://packagist.org/p/sylius/sylius.json') + $client->request('GET', 'https://packagist.org/p2/sylius/sylius.json') ->shouldBeCalled() ->willReturn($response); - $factory->create(json_decode($data, true))->shouldBeCalled(); + $packages = [ + '1.0.0' => ['name' => 'sylius/sylius', 'version' => '1.0.0'] + ]; + + $factory->create(json_decode($data, true))->shouldBeCalled()->willReturn($packages); - $this->getComposerLite('sylius/sylius'); + $this->getComposerLite('sylius/sylius')->shouldBe($packages); } public function it_lists_all_package_names(HttpClient $client, Factory $factory, Response $response, Stream $body): void