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
12 changes: 1 addition & 11 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,11 @@ jobs:
- uses: ramsey/composer-install@v3

- run: composer pest:unit -- --coverage-clover coverage-unit.xml --ci --bail --stop-on-incomplete --fail-on-all-issues
- run: composer pest:feature -- --coverage-clover coverage-feature.xml --ci --bail --stop-on-incomplete --fail-on-all-issues

- uses: actions/upload-artifact@v4
with:
name: coverage
path: |
coverage-unit.xml
coverage-feature.xml
path: coverage-unit.xml

e2e:
needs: pest
Expand Down Expand Up @@ -70,10 +67,3 @@ jobs:
disable_search: true
files: coverage-unit.xml
flags: unit
- uses: codecov/codecov-action@v5
with:
use_oidc: true
fail_ci_if_error: true
disable_search: true
files: coverage-feature.xml
flags: feature
1 change: 0 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@
],
"pest": "pest",
"pest:e2e": "XDEBUG_MODE=off pest --group=e2e",
"pest:feature": "pest --group=feature",
"pest:unit": "pest --group=unit"
}
}
27 changes: 0 additions & 27 deletions tests/Feature/Releases/PhpNetReleasesTest.php

This file was deleted.

37 changes: 0 additions & 37 deletions tests/Feature/TestCase.php

This file was deleted.

7 changes: 0 additions & 7 deletions tests/Pest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
declare(strict_types=1);

use Tests\E2E\TestCase as E2ETestCase;
use Tests\Feature\TestCase as FeatureTestCase;
use Tests\Unit\TestCase as UnitTestCase;

/*
Expand All @@ -16,9 +15,6 @@
pest()->group('e2e')
->in('E2E');

pest()->group('feature')
->in('Feature');

pest()->group('unit')
->in('Unit');

Expand All @@ -36,9 +32,6 @@
pest()->extend(E2ETestCase::class)
->in('E2E');

pest()->extend(FeatureTestCase::class)
->in('Feature');

pest()->extend(UnitTestCase::class)
->in('Unit');

Expand Down
6 changes: 6 additions & 0 deletions tests/TestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@ abstract class TestCase extends BaseTestCase

protected const string ALL_VERSIONS_FILE = __DIR__.'/../resources/all-versions.json';

protected const array RELEASES_JSONS = [
self::DATA_DIR.'/releases-5.json',
self::DATA_DIR.'/releases-7.json',
self::DATA_DIR.'/releases-8.json',
];

/**
* @return string[]
*/
Expand Down
29 changes: 29 additions & 0 deletions tests/Unit/Releases/PhpNetReleasesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@

namespace Tests\Unit\Releases;

use GuzzleHttp\Client as Http;
use GuzzleHttp\Handler\MockHandler;
use GuzzleHttp\HandlerStack;
use GuzzleHttp\Psr7\Response;
use TypistTech\PhpMatrix\Releases\PhpNetReleases;
use TypistTech\PhpMatrix\Releases\ReleasesInterface;

Expand All @@ -15,4 +19,29 @@

expect($releases)->toBeInstanceOf(ReleasesInterface::class);
});

describe('::all()', static function (): void {
it('fetches all versions', function () {
$mock = new MockHandler;
foreach ($this::RELEASES_JSONS as $json) {
$body = file_get_contents($json);
$mock->append(
new Response(202, [], $body),
);
}
$handlerStack = HandlerStack::create($mock);
$http = new Http(['handler' => $handlerStack]);

$releases = new PhpNetReleases($http);

$actual = $releases->all();

expect($actual)->each->toBeString();

$expected = $this->allVersions();

expect($actual)->toContain(...$expected);
expect($expected)->toContain(...$actual);
});
});
});