Skip to content

Commit

Permalink
Merge pull request #68 from GrahamCampbell/patch-1
Browse files Browse the repository at this point in the history
Support Guzzle 7 and PHP 8
  • Loading branch information
robbieaverill committed Nov 28, 2020
2 parents 56fb1c6 + 9f4259e commit d1fa623
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 17 deletions.
7 changes: 4 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
dist: trusty
sudo: false
dist: bionic

language: php

php:
- '7.1'
- '7.2'
- '7.3'
- '7.4'
- '8.0snapshot'

before_script:
- composer install --dev
- composer update --no-interaction --no-progress

script:
- php bin/phpspec run -f pretty
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Simple object oriented wrapper for Packagist API.

## Requirements

* PHP ^7.1
* PHP `^7.1 || ^8.0`

## Installation

Expand Down
8 changes: 4 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@
}
],
"require": {
"php": ">=7.1",
"guzzlehttp/guzzle": "~6.0",
"doctrine/inflector": "~1.0 || ~2.0"
"php": "^7.1 || ^8.0",
"guzzlehttp/guzzle": "^6.0 || ^7.0",
"doctrine/inflector": "^1.0 || ^2.0"
},
"require-dev": {
"phpspec/phpspec": "~5.1 || ~6.0",
"phpspec/phpspec": "^5.1 || ^6.0 || ^7.0",
"squizlabs/php_codesniffer": "^3.0"
},
"config": {
Expand Down
16 changes: 8 additions & 8 deletions spec/Packagist/Api/ClientSpec.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ function it_search_for_packages(HttpClient $client, Factory $factory, Response $
$data = file_get_contents('spec/Packagist/Api/Fixture/search.json');
$response->getBody()->shouldBeCalled()->willReturn($data);

$client->request('get', 'https://packagist.org/search.json?q=sylius')->shouldBeCalled()->willReturn($response);
$client->request('GET', 'https://packagist.org/search.json?q=sylius')->shouldBeCalled()->willReturn($response);
$factory->create(json_decode($data, true))->shouldBeCalled()->willReturn(array());

$this->search('sylius');
Expand All @@ -39,7 +39,7 @@ function it_search_for_packages_with_limit(HttpClient $client, Factory $factory,
$data = file_get_contents('spec/Packagist/Api/Fixture/search.json');
$response->getBody()->shouldBeCalled()->willReturn($data);

$client->request('get', 'https://packagist.org/search.json?q=sylius')->shouldBeCalled()->willReturn($response);
$client->request('GET', 'https://packagist.org/search.json?q=sylius')->shouldBeCalled()->willReturn($response);
$factory->create(json_decode($data, true))->shouldBeCalled()->willReturn(array());

$this->search('sylius', [], 2);
Expand All @@ -50,7 +50,7 @@ function it_searches_for_packages_with_filters(HttpClient $client, Factory $fact
$data = file_get_contents('spec/Packagist/Api/Fixture/search.json');
$response->getBody()->shouldBeCalled()->willReturn($data);

$client->request('get', 'https://packagist.org/search.json?tag=storage&q=sylius')->shouldBeCalled()->willReturn($response);
$client->request('GET', 'https://packagist.org/search.json?tag=storage&q=sylius')->shouldBeCalled()->willReturn($response);

$factory->create(json_decode($data, true))->shouldBeCalled()->willReturn(array());

Expand All @@ -62,7 +62,7 @@ function it_gets_popular_packages(HttpClient $client, Factory $factory, Response
$data = file_get_contents('spec/Packagist/Api/Fixture/popular.json');
$response->getBody()->shouldBeCalled()->willReturn($data);

$client->request('get', 'https://packagist.org/explore/popular.json?page=1')->shouldBeCalled()->willReturn($response);
$client->request('GET', 'https://packagist.org/explore/popular.json?page=1')->shouldBeCalled()->willReturn($response);

$factory->create(json_decode($data, true))->shouldBeCalled()->willReturn(array_pad(array(), 5, null));

Expand All @@ -74,7 +74,7 @@ function it_gets_package_details(HttpClient $client, Factory $factory, Response
$data = file_get_contents('spec/Packagist/Api/Fixture/get.json');
$response->getBody()->shouldBeCalled()->willReturn($data);

$client->request('get', 'https://packagist.org/packages/sylius/sylius.json')->shouldBeCalled()->willReturn($response);
$client->request('GET', 'https://packagist.org/packages/sylius/sylius.json')->shouldBeCalled()->willReturn($response);

$factory->create(json_decode($data, true))->shouldBeCalled();

Expand All @@ -86,7 +86,7 @@ function it_lists_all_package_names(HttpClient $client, Factory $factory, Respon
$data = file_get_contents('spec/Packagist/Api/Fixture/all.json');
$response->getBody()->shouldBeCalled()->willReturn($data);

$client->request('get', 'https://packagist.org/packages/list.json')->shouldBeCalled()->willReturn($response);
$client->request('GET', 'https://packagist.org/packages/list.json')->shouldBeCalled()->willReturn($response);

$factory->create(json_decode($data, true))->shouldBeCalled();

Expand All @@ -98,7 +98,7 @@ function it_filters_package_names_by_type(HttpClient $client, Factory $factory,
$data = file_get_contents('spec/Packagist/Api/Fixture/all.json');
$response->getBody()->shouldBeCalled()->willReturn($data);

$client->request('get', 'https://packagist.org/packages/list.json?type=library')->shouldBeCalled()->willReturn($response);
$client->request('GET', 'https://packagist.org/packages/list.json?type=library')->shouldBeCalled()->willReturn($response);

$factory->create(json_decode($data, true))->shouldBeCalled();

Expand All @@ -110,7 +110,7 @@ function it_filters_package_names_by_vendor(HttpClient $client, Factory $factory
$data = file_get_contents('spec/Packagist/Api/Fixture/all.json');
$response->getBody()->shouldBeCalled()->willReturn($data);

$client->request('get', 'https://packagist.org/packages/list.json?vendor=sylius')->shouldBeCalled()->willReturn($response);
$client->request('GET', 'https://packagist.org/packages/list.json?vendor=sylius')->shouldBeCalled()->willReturn($response);

$factory->create(json_decode($data, true))->shouldBeCalled();

Expand Down
2 changes: 1 addition & 1 deletion src/Packagist/Api/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ protected function request($url)
}

return $this->httpClient
->request('get', $url)
->request('GET', $url)
->getBody();
}

Expand Down

0 comments on commit d1fa623

Please sign in to comment.