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
23 changes: 6 additions & 17 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,28 +11,17 @@ jobs:
strategy:
fail-fast: true
matrix:
php: [8.0, 8.1, 8.2]
laravel: ['9.*', '10.*', '11.*', '12.*']
php: [8.3, 8.4, 8.5]
laravel: ['10.*', '11.*', '12.*', '13.*']
include:
- laravel: 13.*
testbench: 11.*
- laravel: 12.*
testbench: 10.*
- laravel: 11.*
testbench: 9.*
- laravel: 10.*
testbench: 8.*
- laravel: 9.*
testbench: 7.*
- laravel: 12.*
testbench: 10.*
exclude:
- php: 8.0
laravel: 10.*
- laravel: 11.*
php: 8.0
- laravel: 11.*
php: 8.1
- laravel: 12.*
php: 8.0
- laravel: 12.*
php: 8.1

name: PHP ${{ matrix.php }} - Laravel ${{ matrix.laravel }}

Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ composer.lock
.vscode
.php_cs.cache
build/*
.phpunit.cache
6 changes: 3 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,15 @@
],
"require": {
"php": "^8.0",
"illuminate/support": "^9.0|^10.0|^11.0|^12.0",
"illuminate/support": "^10.0|^11.0|^12.0|^13.0",
"league/openapi-psr7-validator": "^0.14|^0.15|^0.16|^0.17|^0.18|^0.19|^0.20|^0.21|^0.22",
"nyholm/psr7": "^1.3",
"symfony/psr-http-message-bridge": "^2.0|^7.0"
},
"require-dev": {
"orchestra/testbench": "7.*|^8.0|^9.0|^10.0",
"orchestra/testbench": "^8.0|^9.0|^10.0|^11.0",
"mockery/mockery": "^1.3.1",
"phpunit/phpunit": "^9.0|^10.5|^11.5.3",
"phpunit/phpunit": "^10.5|^11.5.3|^12.5|^13.0",
"fakerphp/faker": "^1.9.1"
},
"autoload": {
Expand Down
8 changes: 4 additions & 4 deletions tests/ValidatesRequestsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
use League\OpenAPIValidation\PSR7\Exception\NoPath;
use League\OpenAPIValidation\PSR7\OperationAddress;
use Orchestra\Testbench\TestCase;
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\Attributes\Test;
use Symfony\Component\HttpFoundation\Request as SymfonyRequest;

class ValidatesRequestsTest extends TestCase
Expand All @@ -24,10 +26,8 @@ protected function setUp(): void
$this->app['config']->set('openapi_validator.spec_path', __DIR__.'/fixtures/OpenAPI.yaml');
}

/**
* @test
* @dataProvider provideValidationScenarios
*/
#[Test]
#[DataProvider('provideValidationScenarios')]
public function testValidatesRequests(array $requestData, bool $expectSuccess, ?string $expectedException = null)
{
extract($requestData);
Expand Down
8 changes: 4 additions & 4 deletions tests/ValidatesRequestsWithSkipTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
use League\OpenAPIValidation\PSR7\Exception\NoPath;
use League\OpenAPIValidation\PSR7\OperationAddress;
use Orchestra\Testbench\TestCase;
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\Attributes\Test;
use Symfony\Component\HttpFoundation\Request as SymfonyRequest;

class ValidatesRequestsWithSkipTest extends TestCase
Expand All @@ -24,10 +26,8 @@ protected function setUp(): void
$this->app['config']->set('openapi_validator.spec_path', __DIR__.'/fixtures/OpenAPI.yaml');
}

/**
* @test
* @dataProvider provideValidationScenarios
*/
#[Test]
#[DataProvider('provideValidationScenarios')]
public function testValidatesRequests(array $requestData, bool $expectSuccess, ?string $expectedException = null)
{
extract($requestData);
Expand Down
8 changes: 4 additions & 4 deletions tests/ValidatesResponsesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
use League\OpenAPIValidation\PSR7\OperationAddress;
use Orchestra\Testbench\TestCase;
use PHPUnit\Framework\AssertionFailedError;
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\Attributes\Test;

class ValidatesResponsesTest extends TestCase
{
Expand All @@ -24,10 +26,8 @@ protected function setUp(): void
$this->app['config']->set('openapi_validator.spec_path', __DIR__.'/fixtures/OpenAPI.yaml');
}

/**
* @test
* @dataProvider provideValidationScenarios
*/
#[Test]
#[DataProvider('provideValidationScenarios')]
public function testValidatesResponses(OperationAddress $address, array $responseData, bool $expectSuccess, ?string $expectedException = null)
{
extract($responseData);
Expand Down
36 changes: 12 additions & 24 deletions tests/ValidatorBuildAndSetupTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
use Mockery;
use Mockery\Adapter\Phpunit\MockeryPHPUnitIntegration;
use Orchestra\Testbench\TestCase;
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\Attributes\Test;
use Symfony\Component\HttpFoundation\Request as SymfonyRequest;

class ValidatorBuildAndSetupTest extends TestCase
Expand All @@ -18,10 +20,8 @@ class ValidatorBuildAndSetupTest extends TestCase
use MockeryPHPUnitIntegration;
use WithFaker;

/**
* @test
* @dataProvider provideSpecFormats
*/
#[Test]
#[DataProvider('provideSpecFormats')]
public function testGetsOpenApiValidatorBuilder(string $extension)
{
$this->app['config']->set('openapi_validator.spec_path', __DIR__."/fixtures/OpenAPI.{$extension}");
Expand All @@ -38,10 +38,8 @@ public static function provideSpecFormats()
];
}

/**
* @test
* @dataProvider provideSpecUnknownFormats
*/
#[DataProvider('provideSpecUnknownFormats')]
#[Test]
public function testThrowsExceptionForUnknownFormat(string $extension)
{
$this->app['config']->set('openapi_validator.spec_path', __DIR__ . "/fixtures/OpenAPI.{$extension}");
Expand Down Expand Up @@ -72,19 +70,15 @@ public function testSkipsRequestValidation()
$this->assertTrue($this->shouldSkipRequestValidation());
}

/**
* @test
*/
#[Test]
public function testSkipsResponseValidation()
{
$this->withoutResponseValidation();

$this->assertTrue($this->shouldSkipResponseValidation(Mockery::mock(Response::class)));
}

/**
* @test
*/
#[Test]
public function testSkipsValidation()
{
$this->withoutValidation();
Expand All @@ -94,10 +88,8 @@ public function testSkipsValidation()
$this->assertTrue($this->shouldSkipResponseValidation(Mockery::mock(Response::class)));
}

/**
* @test
* @dataProvider provideResponseCodes
*/
#[DataProvider('provideResponseCodes')]
#[Test]
public function testSkipsResponseCodes($responseCode, $codesToSkip, bool $expected)
{
if (is_callable($responseCode)) {
Expand Down Expand Up @@ -158,9 +150,7 @@ function ($faker) {
yield 'Doesn\'t skip valid regex' => [206, '2[1-9]6', false];
}

/**
* @test
*/
#[Test]
public function testBypassesAuthenticationInRequests()
{
$originRequest = new SymfonyRequest();
Expand All @@ -169,9 +159,7 @@ public function testBypassesAuthenticationInRequests()
$this->assertNotSame($originRequest, $request);
}

/**
* @test
*/
#[Test]
public function testDontSpoofAuthenticationInRequests()
{
$originRequest = new SymfonyRequest();
Expand Down
Loading