Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions .github/workflows/grumphp.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ jobs:
strategy:
matrix:
operating-system: [ubuntu-latest]
php-versions: ['8.2', '8.3']
php-versions: ['8.3', '8.4', '8.5']
composer-options: ['', '--prefer-lowest']
fail-fast: false
name: PHP ${{ matrix.php-versions }} @ ${{ matrix.operating-system }} with ${{ matrix.composer-options }}
Expand Down Expand Up @@ -36,12 +36,15 @@ jobs:
restore-keys: ${{ runner.os }}-composer-
- name: Install dependencies
run: composer update --prefer-dist --no-progress --no-suggest ${{ matrix.composer-options }}
env:
COMPOSER_IGNORE_PLATFORM_REQ: php+
- name: Set git variables
run: |
git config --global user.email "[email protected]"
git config --global user.name "Your Name"
- name: Run the tests
run: php vendor/bin/grumphp run --no-interaction
run: ./vendor/bin/grumphp run --no-interaction
continue-on-error: ${{ matrix.php-versions == '8.5' }}
env:
PHP_CS_FIXER_IGNORE_ENV: 1
BOX_REQUIREMENT_CHECKER: 0
13 changes: 8 additions & 5 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@
}
],
"require": {
"php": "~8.2.0 || ~8.3.0 || ~8.4.0",
"php": "~8.3.0 || ~8.4.0 || ~8.5.0",
"ext-json": "*",
"azjezz/psl": "^3.1",
"azjezz/psl": "^3.1 || ^4.0",
"cardinalby/content-disposition": "^1.1",
"league/uri": "^7.3",
"php-http/client-common": "^2.7",
Expand All @@ -36,15 +36,18 @@
"require-dev": {
"guzzlehttp/guzzle": "^7.8",
"nyholm/psr7": "^1.8",
"php-cs-fixer/shim": "~3.88",
"php-http/message-factory": "1.1.0",
"php-http/mock-client": "^1.6",
"php-http/vcr-plugin": "^1.2",
"phpro/grumphp-shim": "^2.1",
"phpro/grumphp-shim": "^2.17",
"phpunit/phpunit": "~12.4",
"symfony/http-client": "^5.4.26 || ^6.0 || ^7.0",
"symfony/mime": "^6.0 || ^7.0",
"symfony/property-access": "^5.4 || ^6.0 || ^7.0",
"symfony/options-resolver": "^5.4 || ^6.0 || ^7.0",
"symfony/serializer": "^5.4 || ^6.0 || ^7.0"
"symfony/property-access": "^5.4 || ^6.0 || ^7.0",
"symfony/serializer": "^5.4 || ^6.0 || ^7.0",
"vimeo/psalm": "~6.13"
},
"suggest": {
"symfony/http-client": "If you want to use the built-in symfony/http-client tools.",
Expand Down
6 changes: 0 additions & 6 deletions phive.xml

This file was deleted.

6 changes: 4 additions & 2 deletions phpunit.xml
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/11.5/phpunit.xsd"
xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd"
bootstrap="tests/bootstrap.php"
executionOrder="depends,defects"
beStrictAboutOutputDuringTests="true"
displayDetailsOnTestsThatTriggerWarnings="true"
failOnRisky="true"
failOnWarning="true"
failOnPhpunitWarning="true"
>
<testsuites>
<testsuite name="default">
Expand All @@ -19,7 +21,7 @@
</include>
</source>

<coverage>
<coverage includeUncoveredFiles="true">
<report>
<clover outputFile="coverage/clover.xml" />
<html outputDirectory="coverage/report" lowUpperBound="99" highLowerBound="99" />
Expand Down
1 change: 1 addition & 0 deletions psalm.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd"
findUnusedBaselineEntry="true"
findUnusedCode="false"
ensureOverrideAttribute="false"
>
<projectFiles>
<directory name="src" />
Expand Down
2 changes: 1 addition & 1 deletion src/Test/UseMockClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ trait UseMockClient
private function mockClient(?callable $configurator = null): Client
{
MockClientDependency::guard();
$configurator ??= fn (Client $client) => $client;
$configurator ??= fn (Client $client): Client => $client;

return $configurator(new Client());
}
Expand Down
9 changes: 4 additions & 5 deletions tests/Functional/Client/Factory/FactoriesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
use Phpro\HttpTools\Client\Factory\SymfonyClientFactory;
use Phpro\HttpTools\Test\UseVcrClient;
use Phpro\HttpTools\Tests\Helper\Vcr\FactoryAwareNamingStrategy;
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\Attributes\Test;
use PHPUnit\Framework\TestCase;
use Psl\Json;
use Psr\Http\Message\RequestInterface;
Expand All @@ -20,11 +22,8 @@ final class FactoriesTest extends TestCase
{
use UseVcrClient;

/**
* @test
*
* @dataProvider provideFactories
*/
#[DataProvider('provideFactories')]
#[Test]
public function it_can_use_http_factories(string $factoryName, callable $factory): void
{
$client = PluginsConfigurator::configure($factory(), [
Expand Down
5 changes: 3 additions & 2 deletions tests/Unit/Client/Factory/LazyClientLoaderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,13 @@
use Phpro\HttpTools\Client\Factory\AutoDiscoveredClientFactory;
use Phpro\HttpTools\Client\Factory\FactoryInterface;
use Phpro\HttpTools\Client\Factory\LazyClientLoader;
use PHPUnit\Framework\Attributes\Test;
use PHPUnit\Framework\TestCase;
use stdClass;

final class LazyClientLoaderTest extends TestCase
{
/** @test */
#[Test]
public function it_can_not_load_invalid_class(): void
{
$this->expectException(InvalidArgumentException::class);
Expand All @@ -23,7 +24,7 @@ public function it_can_not_load_invalid_class(): void
$loader->load();
}

/** @test */
#[Test]
public function it_only_loads_the_client_once(): void
{
$loader = new LazyClientLoader(AutoDiscoveredClientFactory::class, [], []);
Expand Down
9 changes: 4 additions & 5 deletions tests/Unit/Encoding/Binary/BinaryFileDecoderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,17 @@
use Phpro\HttpTools\Encoding\Binary\BinaryFile;
use Phpro\HttpTools\Encoding\Binary\BinaryFileDecoder;
use Phpro\HttpTools\Test\UseHttpFactories;
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\Attributes\Test;
use PHPUnit\Framework\TestCase;
use Psr\Http\Message\ResponseInterface;

final class BinaryFileDecoderTest extends TestCase
{
use UseHttpFactories;

/**
* @test
*
* @dataProvider provideCases
*/
#[DataProvider('provideCases')]
#[Test]
public function it_can_decode_binary_files(
BinaryFileDecoder $decoder,
ResponseInterface $response,
Expand Down
3 changes: 2 additions & 1 deletion tests/Unit/Encoding/Binary/BinaryFileTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,14 @@

use Phpro\HttpTools\Encoding\Binary\BinaryFile;
use Phpro\HttpTools\Test\UseHttpFactories;
use PHPUnit\Framework\Attributes\Test;
use PHPUnit\Framework\TestCase;

final class BinaryFileTest extends TestCase
{
use UseHttpFactories;

/** @test */
#[Test]
public function it_is_a_dto(): void
{
$dto = new BinaryFile(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,17 @@

use Phpro\HttpTools\Encoding\Binary\Extractor\ExtensionExtractor;
use Phpro\HttpTools\Test\UseHttpFactories;
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\Attributes\Test;
use PHPUnit\Framework\TestCase;
use Psr\Http\Message\ResponseInterface;

final class ExtensionExtractorTest extends TestCase
{
use UseHttpFactories;

/**
* @test
*
* @dataProvider provideCases
*/
#[DataProvider('provideCases')]
#[Test]
public function it_can_extract_extension(ResponseInterface $response, ?string $expected): void
{
$extractor = new ExtensionExtractor();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,17 @@

use Phpro\HttpTools\Encoding\Binary\Extractor\FilenameExtractor;
use Phpro\HttpTools\Test\UseHttpFactories;
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\Attributes\Test;
use PHPUnit\Framework\TestCase;
use Psr\Http\Message\ResponseInterface;

final class FilenameExtractorTest extends TestCase
{
use UseHttpFactories;

/**
* @test
*
* @dataProvider provideCases
*/
#[DataProvider('provideCases')]
#[Test]
public function it_can_extract_filenames(ResponseInterface $response, ?string $expected): void
{
$extractor = new FilenameExtractor();
Expand Down
9 changes: 4 additions & 5 deletions tests/Unit/Encoding/Binary/Extractor/HashExtractorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@

use Phpro\HttpTools\Encoding\Binary\Extractor\HashExtractor;
use Phpro\HttpTools\Test\UseHttpFactories;
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\Attributes\Test;
use PHPUnit\Framework\TestCase;
use Psl\Hash\Algorithm;

Expand All @@ -17,11 +19,8 @@ final class HashExtractorTest extends TestCase
{
use UseHttpFactories;

/**
* @test
*
* @dataProvider provideCases
*/
#[DataProvider('provideCases')]
#[Test]
public function it_can_extract_hash(ResponseInterface $response, string $expected, int $endPosition = 0): void
{
$extractor = new HashExtractor(Algorithm::Md5);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,17 @@

use Phpro\HttpTools\Encoding\Binary\Extractor\MimeTypeExtractor;
use Phpro\HttpTools\Test\UseHttpFactories;
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\Attributes\Test;
use PHPUnit\Framework\TestCase;
use Psr\Http\Message\ResponseInterface;

final class MimeTypeExtractorTest extends TestCase
{
use UseHttpFactories;

/**
* @test
*
* @dataProvider provideCases
*/
#[DataProvider('provideCases')]
#[Test]
public function it_can_extract_mime_type(ResponseInterface $response, ?string $expected): void
{
$extractor = new MimeTypeExtractor();
Expand Down
8 changes: 4 additions & 4 deletions tests/Unit/Encoding/Binary/Extractor/SizeExtractorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@

use Phpro\HttpTools\Encoding\Binary\Extractor\SizeExtractor;
use Phpro\HttpTools\Test\UseHttpFactories;
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\Attributes\Test;
use PHPUnit\Framework\MockObject\MockObject;
use PHPUnit\Framework\TestCase;
use Psr\Http\Message\ResponseInterface;
Expand All @@ -16,12 +18,10 @@ final class SizeExtractorTest extends TestCase
use UseHttpFactories;

/**
* @test
*
* @param callable<ResponseInterface> $response
*
* @dataProvider provideCases
*/
#[DataProvider('provideCases')]
#[Test]
public function it_can_extract_size(callable $response, ?int $expected): void
{
$extractor = new SizeExtractor();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,14 @@

use Phpro\HttpTools\Encoding\FormUrlencoded\FormUrlencodedDecoder;
use Phpro\HttpTools\Test\UseHttpFactories;
use PHPUnit\Framework\Attributes\Test;
use PHPUnit\Framework\TestCase;

final class FormUrlencodedDecoderTest extends TestCase
{
use UseHttpFactories;

/** @test */
#[Test]
public function it_can_decode_form_url_encoded_to_array(): void
{
$decoder = FormUrlencodedDecoder::createWithAutodiscoveredPsrFactories();
Expand All @@ -23,7 +24,7 @@ public function it_can_decode_form_url_encoded_to_array(): void
self::assertSame(['hello' => 'world', 'foo' => 'bar'], $decoded);
}

/** @test */
#[Test]
public function it_can_decode_empty_body_to_empty_array(): void
{
$decoder = FormUrlencodedDecoder::createWithAutodiscoveredPsrFactories();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,14 @@

use Phpro\HttpTools\Encoding\FormUrlencoded\FormUrlencodedEncoder;
use Phpro\HttpTools\Test\UseHttpFactories;
use PHPUnit\Framework\Attributes\Test;
use PHPUnit\Framework\TestCase;

final class FormUrlencodedEncoderTest extends TestCase
{
use UseHttpFactories;

/** @test */
#[Test]
public function it_can_encode_array_to_url_encoded(): void
{
$data = ['hello' => 'world'];
Expand All @@ -27,7 +28,7 @@ public function it_can_encode_array_to_url_encoded(): void
self::assertSame(['application/x-www-form-urlencoded'], $actual->getHeader('Content-Type'));
}

/** @test */
#[Test]
public function it_can_encode_null_to_empty_body(): void
{
$data = null;
Expand Down
5 changes: 3 additions & 2 deletions tests/Unit/Encoding/Json/JsonDecoderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,14 @@

use Phpro\HttpTools\Encoding\Json\JsonDecoder;
use Phpro\HttpTools\Test\UseHttpFactories;
use PHPUnit\Framework\Attributes\Test;
use PHPUnit\Framework\TestCase;

final class JsonDecoderTest extends TestCase
{
use UseHttpFactories;

/** @test */
#[Test]
public function it_can_decode_json_to_array(): void
{
$decoder = JsonDecoder::createWithAutodiscoveredPsrFactories();
Expand All @@ -23,7 +24,7 @@ public function it_can_decode_json_to_array(): void
self::assertSame(['hello' => 'world'], $decoded);
}

/** @test */
#[Test]
public function it_can_decode_empty_body_to_empty_array(): void
{
$decoder = JsonDecoder::createWithAutodiscoveredPsrFactories();
Expand Down
Loading
Loading