Skip to content

Commit

Permalink
Update test tools
Browse files Browse the repository at this point in the history
  • Loading branch information
tomas-novotny committed Apr 20, 2024
1 parent 9417ab7 commit 97fe0d8
Show file tree
Hide file tree
Showing 8 changed files with 46 additions and 43 deletions.
1 change: 1 addition & 0 deletions .github/workflows/master.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ jobs:
run: |
vendor/bin/phpcs src tests
vendor/bin/phpstan analyse -c phpstan.neon
vendor/bin/composer-dependency-analyser
- name: Run tests
run: |
vendor/bin/phpunit --coverage-text --coverage-clover=coverage.clover
Expand Down
17 changes: 17 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,23 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.


## [Unreleased](https://github.com/inspirum/balikobot-php/compare/v7.8.0...master)
### Added
- Added support for new options from documentation **v1.991** (2024-01-04)
- Added **customs_indicator** attributes
- Added **ZASILKOVNA_EE_VENIPAK_HD** service type
- Added **ZASILKOVNA_EE_VENIPAK_PP** service type
- Added **ZASILKOVNA_EE_VENIPAK_BOX** service type
- Added **ZASILKOVNA_FI_MATKAHUOLTO_HD** service type
- Added **ZASILKOVNA_FI_MATKAHUOLTO_PP** service type
- Added **ZASILKOVNA_FI_MATKAHUOLTO_BOX** service type
- Added **ZASILKOVNA_LV_VENIPAK_HD** service type
- Added **ZASILKOVNA_LV_VENIPAK_PP** service type
- Added **ZASILKOVNA_LV_VENIPAK_BOX** service type
- Added **ZASILKOVNA_LT_VENIPAK_HD** service type
- Added **ZASILKOVNA_LT_VENIPAK_PP** service type
- Added **ZASILKOVNA_LT_VENIPAK_BOX** service type
### Changed
- Changed **ZASILKOVNA_HU_EXPRESS_ONE_HD** service type value


## [v7.8.0 (2024-04-04)](https://github.com/inspirum/balikobot-php/compare/v7.7.0...v7.8.0)
Expand Down
20 changes: 6 additions & 14 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@
"require-dev": {
"inspirum/coding-standard": "^1.4",
"phpstan/phpstan": "^1.10",
"phpunit/phpunit": "^10.5",
"phpunit/phpunit": "^10.3",
"shipmonk/composer-dependency-analyser": "^1.5",
"squizlabs/php_codesniffer": "^3.9"
},
"autoload": {
Expand All @@ -52,8 +53,7 @@
"@test:unit",
"@style:phpstan",
"@test:integration",
"@check:requirement",
"@check:unused"
"@check:dependency"
],
"test:test": [
"@test:unit",
Expand All @@ -71,9 +71,6 @@
"test:unit:coverage": [
"@phpunit --testsuite=Unit --coverage-text --coverage-html=var/phpunit/coverage"
],
"test:infection": [
"@infection"
],
"style:phpcs": [
"@phpcs"
],
Expand All @@ -87,18 +84,13 @@
"style:fix": [
"@phpcbf src tests"
],
"check:requirement": [
"@composerRequireChecker"
],
"check:unused": [
"@composerUnused"
"check:dependency": [
"@composer-dependency-analyser"
],
"phpunit": "./vendor/bin/phpunit",
"phpcs": "./vendor/bin/phpcs -p -s --extensions=php --colors --report-width=140",
"phpstan": "./vendor/bin/phpstan analyse -c phpstan.neon",
"phpcbf": "./vendor/bin/phpcbf -p --extensions=php",
"infection": "./tools/infection",
"composerRequireChecker": "./tools/composer-require-checker check",
"composerUnused": "./tools/composer-unused"
"composer-dependency-analyser": "./vendor/bin/composer-dependency-analyser"
}
}
6 changes: 0 additions & 6 deletions phive.xml

This file was deleted.

2 changes: 1 addition & 1 deletion phpstan.neon
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ parameters:
count: 1
path: src/Model/BasePerCarrierCollection.php
-
message: '#^Parameter \#1 \$ of callable callable\(TValue\): bool expects TValue of Inspirum\\Arrayable\\Arrayable<TItemKey of \(int\|string\), TItemValue>&Inspirum\\Balikobot\\Model\\WithCarrierId, Inspirum\\Arrayable\\Arrayable<TItemKey of \(int\|string\), TItemValue>&Inspirum\\Balikobot\\Model\\WithCarrierId given\.$#'
message: '#^Parameter \#1 of callable callable\(TValue\): bool expects TValue of Inspirum\\Arrayable\\Arrayable<TItemKey of \(int\|string\), TItemValue>&Inspirum\\Balikobot\\Model\\WithCarrierId, Inspirum\\Arrayable\\Arrayable<TItemKey of \(int\|string\), TItemValue>&Inspirum\\Balikobot\\Model\\WithCarrierId given\.$#'
count: 1
path: src/Model/BasePerCarrierCollection.php
-
Expand Down
2 changes: 1 addition & 1 deletion tests/Integration/ChangesSupportTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public function testLatestChangesSupport(): void

$changelog = $infoService->getChangelog();

$expected = (float) '1.990';
$expected = (float) '1.996';
$actual = (float) $changelog->getLatestVersion();

if ($actual > $expected) {
Expand Down
1 change: 0 additions & 1 deletion tests/Unit/Client/DefaultClientTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,6 @@ public static function providesTestCall(): iterable
'test' => 1596,
],
'gzip' => true,
'warning' => 'Unsupported decompression (update to "guzzlehttp/psr7:^2.0")',
];

yield 'compressed_gz_error' => [
Expand Down
40 changes: 20 additions & 20 deletions tests/Unit/Model/Status/DefaultStatusFactoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@
final class DefaultStatusFactoryTest extends BaseTestCase
{
/**
* @param array<string> $carrierId
* @param array<string> $carrierIds
* @param array<string,mixed> $data
*/
#[DataProvider('providesTestCreateCollection')]
public function testCreateCollection(string $carrier, array $carrierId, array $data, StatusesCollection|Throwable $result): void
public function testCreateCollection(string $carrier, array $carrierIds, array $data, StatusesCollection|Throwable $result): void
{
if ($result instanceof Throwable) {
$this->expectException($result::class);
Expand All @@ -36,7 +36,7 @@ public function testCreateCollection(string $carrier, array $carrierId, array $d

$factory = $this->newDefaultStatusFactory();

$collection = $factory->createCollection($carrier, $carrierId, $data);
$collection = $factory->createCollection($carrier, $carrierIds, $data);

self::assertEquals($result, $collection);
}
Expand Down Expand Up @@ -162,7 +162,7 @@ public static function providesTestCreateCollection(): iterable
yield 'package_index_error' => [
'carrier' => 'cp',
'carrierIds' => ['3', '4', '5'],
'response' => [
'data' => [
'packages' => [
0 => [
'carrier_id' => '3',
Expand Down Expand Up @@ -223,7 +223,7 @@ public static function providesTestCreateCollection(): iterable
yield 'package_index_missing_error' => [
'carrier' => 'ppl',
'carrierIds' => ['1', '3'],
'response' => [
'data' => [
'status' => 200,
'packages' => [
1 => [
Expand All @@ -249,7 +249,7 @@ public static function providesTestCreateCollection(): iterable
yield 'package_status_error' => [
'carrier' => 'ppl',
'carrierIds' => ['1', '3'],
'response' => [
'data' => [
'status' => 200,
'packages' => [
0 => [
Expand Down Expand Up @@ -280,7 +280,7 @@ public static function providesTestCreateCollection(): iterable
yield 'package_status_data_error' => [
'carrier' => 'cp',
'carrierIds' => ['1', '2'],
'response' => [
'data' => [
'status' => 200,
'packages' => [
0 => [
Expand Down Expand Up @@ -317,11 +317,11 @@ public static function providesTestCreateCollection(): iterable
}

/**
* @param array<string> $carrierId
* @param array<string> $carrierIds
* @param array<string,mixed> $data
*/
#[DataProvider('providesTestCreateLastStatusCollection')]
public function testCreateLastStatusCollection(string $carrier, array $carrierId, array $data, StatusCollection|Throwable $result): void
public function testCreateLastStatusCollection(string $carrier, array $carrierIds, array $data, StatusCollection|Throwable $result): void
{
if ($result instanceof Throwable) {
$this->expectException($result::class);
Expand All @@ -330,7 +330,7 @@ public function testCreateLastStatusCollection(string $carrier, array $carrierId

$factory = $this->newDefaultStatusFactory();

$collection = $factory->createLastStatusCollection($carrier, $carrierId, $data);
$collection = $factory->createLastStatusCollection($carrier, $carrierIds, $data);

self::assertEquals($result, $collection);
}
Expand All @@ -343,7 +343,7 @@ public static function providesTestCreateLastStatusCollection(): iterable
yield 'valid' => [
'carrier' => 'cp',
'carrierIds' => ['1', '2'],
'response' => [
'data' => [
'packages' => [
0 => [
'carrier_id' => '1',
Expand Down Expand Up @@ -387,7 +387,7 @@ public static function providesTestCreateLastStatusCollection(): iterable
yield 'missing_data_error' => [
'carrier' => 'cp',
'carrierIds' => ['1', '2'],
'response' => [
'data' => [
'status' => 200,
],
'result' => new BadRequestException([], 400),
Expand All @@ -396,7 +396,7 @@ public static function providesTestCreateLastStatusCollection(): iterable
yield 'package_index_error' => [
'carrier' => 'cp',
'carrierIds' => ['3', '4'],
'response' => [
'data' => [
'packages' => [
0 => [
'carrier_id' => '1',
Expand All @@ -418,7 +418,7 @@ public static function providesTestCreateLastStatusCollection(): iterable
yield 'package_index_missing_error' => [
'carrier' => 'ppl',
'carrierIds' => ['1', '3'],
'response' => [
'data' => [
'status' => 200,
'packages' => [
0 => [
Expand All @@ -435,7 +435,7 @@ public static function providesTestCreateLastStatusCollection(): iterable
yield 'package_status_error' => [
'carrier' => 'ppl',
'carrierIds' => ['1', '3'],
'response' => [
'data' => [
'status' => 200,
'packages' => [
0 => [
Expand Down Expand Up @@ -480,7 +480,7 @@ public static function providesTestCreate(): iterable
yield 'v2' => [
'carrier' => 'cp',
'carrierId' => '1',
'data' => [
'data' => [
'date' => '2018-11-07 14:15:01',
'name' => 'Doručení',
'name_internal' => 'Zásilka byla doručena příjemci.',
Expand All @@ -501,7 +501,7 @@ public static function providesTestCreate(): iterable
yield 'missing_data' => [
'carrier' => 'cp',
'carrierId' => '2',
'data' => [
'data' => [
'name' => 'Doručení',
'status_id' => 2,
],
Expand All @@ -519,7 +519,7 @@ public static function providesTestCreate(): iterable
yield 'v3' => [
'carrier' => 'cp',
'carrierId' => '3',
'data' => [
'data' => [
'date' => '2018-11-08 14:18:01',
'name' => 'Doručení',
'name_balikobot' => 'Zásilka byla doručena příjemci.',
Expand Down Expand Up @@ -564,7 +564,7 @@ public static function providesTestCreateLastStatus(): iterable
{
yield 'valid' => [
'carrier' => 'cp',
'data' => [
'data' => [
'carrier_id' => '1',
'status' => 200,
'status_id' => 1.2,
Expand All @@ -583,7 +583,7 @@ public static function providesTestCreateLastStatus(): iterable

yield 'invalid' => [
'carrier' => 'cp',
'data' => [
'data' => [
'status' => 200,
],
'result' => new BadRequestException([], 400),
Expand Down

0 comments on commit 97fe0d8

Please sign in to comment.