From 44b83e2ed03f31e478a0104dc564de3c2fa3bc1c Mon Sep 17 00:00:00 2001 From: Daniil Gentili Date: Mon, 1 Apr 2024 17:39:42 +0200 Subject: [PATCH] Fixup --- .gitignore | 1 + composer.json | 2 +- phpunit.xml.dist | 31 +++++++++++++++++-------------- tests/IntegrationTest.php | 15 +++++++-------- 4 files changed, 26 insertions(+), 23 deletions(-) diff --git a/.gitignore b/.gitignore index ea71c99..1088a3b 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ +.phpunit.cache MadelineProtoPhar JSON.sh halloween diff --git a/composer.json b/composer.json index dacd64a..c1c10f3 100644 --- a/composer.json +++ b/composer.json @@ -14,7 +14,7 @@ "php-64bit": ">=8.1" }, "require-dev": { - "phpunit/phpunit": "^9", + "phpunit/phpunit": "^11", "amphp/php-cs-fixer-config": "^2", "vimeo/psalm": "dev-master" }, diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 85a8d8b..fe6cf5b 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -1,20 +1,23 @@ - + - + tests + + + + src + + diff --git a/tests/IntegrationTest.php b/tests/IntegrationTest.php index bd67672..98bced3 100644 --- a/tests/IntegrationTest.php +++ b/tests/IntegrationTest.php @@ -6,14 +6,13 @@ use CURLFile; use danog\Decoder\FileId; use danog\Decoder\FileIdType; use danog\Decoder\UniqueFileId; +use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; /** @api */ class IntegrationTest extends TestCase { - /** - * @dataProvider provideFileIdsAndType - */ + #[DataProvider('provideFileIdsAndType')] public function testAll(FileIdType $type, string $fileIdStr, string $uniqueFileIdStr): void { $fileId = FileId::fromBotAPI($fileIdStr); @@ -29,7 +28,7 @@ class IntegrationTest extends TestCase } /** @psalm-suppress MixedArrayAccess, MixedAssignment, PossiblyInvalidArgument, MixedArgument */ - public function provideFileIdsAndType(): \Generator + public static function provideFileIdsAndType(): \Generator { foreach (['CAADBAADwwADmFmqDf6xBrPTReqHFgQ', 'CAACAgQAAxkBAAIC4l9CWDGzVUcDejU0TETLWbOdfsCoAALDAAOYWaoN_rEGs9NF6ocbBA', 'CAADBAADwwADmFmqDf6xBrPTReqHAg'] as $fileId) { yield [ @@ -41,7 +40,7 @@ class IntegrationTest extends TestCase $dest = \getenv('DEST'); $token = \getenv('TOKEN'); - foreach ($this->provideChats() as $chat) { + foreach (self::provideChats() as $chat) { /** * @var array{ * small_file_id: string, @@ -62,7 +61,7 @@ class IntegrationTest extends TestCase $result['big_file_unique_id'], ]; } - foreach ($this->provideUrls() as $type => $url) { + foreach (self::provideUrls() as $type => $url) { if ($type === 'video_note') { \copy($url, \basename($url)); @@ -104,11 +103,11 @@ class IntegrationTest extends TestCase * @psalm-suppress InvalidReturnStatement, InvalidReturnType * @return list */ - public function provideChats(): array + public static function provideChats(): array { return [\getenv('DEST'), '@MadelineProto']; } - public function provideUrls(): array + public static function provideUrls(): array { return [ 'sticker' => 'https://github.com/danog/MadelineProto/raw/v8/tests/lel.webp?raw=true',