From 4148d58c4206cf5c93b648f0af95fa3502f05716 Mon Sep 17 00:00:00 2001 From: Daniil Gentili Date: Thu, 30 Nov 2023 17:58:48 +0100 Subject: [PATCH] Further improve tests --- .woodpecker/.test.yml | 1 + composer.json | 12 +++-- phpunit-light.xml | 25 +++++++++++ psalm-baseline.xml | 56 ++---------------------- tests/danog/MadelineProto/FileIdTest.php | 10 ++--- 5 files changed, 42 insertions(+), 62 deletions(-) create mode 100644 phpunit-light.xml diff --git a/.woodpecker/.test.yml b/.woodpecker/.test.yml index fd8c9d075..0d5265b41 100644 --- a/.woodpecker/.test.yml +++ b/.woodpecker/.test.yml @@ -57,3 +57,4 @@ steps: - apk add bash - tests/test.sh - php tests/handshake.php + - composer test-light diff --git a/composer.json b/composer.json index 3095b589a..5ceddd5d0 100644 --- a/composer.json +++ b/composer.json @@ -115,15 +115,19 @@ "@psalm" ], "test": [ - "paratest", - "phpunit" + "@paratest", + "@phpunit" + ], + "test-light": [ + "@paratest-light" ], "cs-fix": "PHP_CS_FIXER_IGNORE_ENV=1 php -d pcre.jit=0 vendor/bin/php-cs-fixer fix -v", "psalm": "psalm --no-cache --threads=10", "docs": "php tools/build_docs.php", "docs-fix": "tools/fix_docs.sh", - "phpunit": "@php -dzend.assertions=1 ./vendor/bin/phpunit --coverage-text -c phpunit-noparallel.xml", - "paratest": "@php -dzend.assertions=1 ./vendor/bin/paratest --coverage-text", + "phpunit": "@php -dzend.assertions=1 ./vendor/bin/phpunit -c phpunit-noparallel.xml", + "paratest": "@php -dzend.assertions=1 ./vendor/bin/paratest", + "paratest-light": "@php -dzend.assertions=1 ./vendor/bin/paratest -c phpunit-light.xml", "bin": "echo 'bin not installed'", "post-install-cmd": ["@composer bin all install --ansi"], "post-update-cmd": ["@composer bin all update --ansi"] diff --git a/phpunit-light.xml b/phpunit-light.xml new file mode 100644 index 000000000..3a8dbdad0 --- /dev/null +++ b/phpunit-light.xml @@ -0,0 +1,25 @@ + + + + + src + + + + + tests + tests/danog/MadelineProto/DataCenterTest.php + tests/danog/MadelineProto/FileIdTest.php + + + diff --git a/psalm-baseline.xml b/psalm-baseline.xml index 6301c045b..28d48807b 100644 --- a/psalm-baseline.xml +++ b/psalm-baseline.xml @@ -1,5 +1,5 @@ - + $settings @@ -1067,6 +1067,7 @@ colors]]> colors]]> colors]]> + colors]]> @@ -1838,58 +1839,6 @@ $wrapper - - - comments]]> - vendorString]]> - - - $offset - $offset - $offset - $offset - $offset - $offset - $size - - - currentDuration += $frameDuration]]> - currentDuration += $totalDuration]]> - - - stream)($headers['number_page_segments'])]]> - stream)(23)]]> - - - $cancel - - - $comments - $streamCount - $vendorString - - - $state === self::STATE_READ_COMMENT - - - $offset - $offset - $offset - $offset - - - stream)($headers['number_page_segments'])]]> - stream)($sizeAccumulated)]]> - stream)(23)]]> - stream)(4)]]> - - - ?FFI - FFI - FFI - int|CData $err - - $file @@ -2375,6 +2324,7 @@ $c->name !== null]]> + $c->name !== null]]> $val diff --git a/tests/danog/MadelineProto/FileIdTest.php b/tests/danog/MadelineProto/FileIdTest.php index f614fbe0b..c85e845dc 100644 --- a/tests/danog/MadelineProto/FileIdTest.php +++ b/tests/danog/MadelineProto/FileIdTest.php @@ -196,11 +196,11 @@ class FileIdTest extends MadelineTestCase public function provideUrls(): array { $res = [ - 'sticker' => 'https://github.com/danog/MadelineProto/blob/master/tests/lel.webp?raw=true', - 'photo' => 'https://github.com/danog/MadelineProto/blob/master/tests/faust.jpg', - 'audio' => 'https://github.com/danog/MadelineProto/blob/master/tests/mosconi.mp3?raw=true', - 'video' => 'https://github.com/danog/MadelineProto/blob/master/tests/swing.mp4?raw=true', - 'animation' => 'https://github.com/danog/MadelineProto/blob/master/tests/pony.mp4?raw=true', + 'sticker' => 'https://github.com/danog/MadelineProto/raw/v8/tests/lel.webp?raw=true', + 'photo' => 'https://github.com/danog/MadelineProto/raw/v8/tests/faust.jpg', + 'audio' => 'https://github.com/danog/MadelineProto/raw/v8/tests/mosconi.mp3?raw=true', + 'video' => 'https://github.com/danog/MadelineProto/raw/v8/tests/swing.mp4?raw=true', + 'animation' => 'https://github.com/danog/MadelineProto/raw/v8/tests/pony.mp4?raw=true', 'document' => 'https://github.com/danog/danog.github.io/raw/master/lol/index_htm_files/0.gif', 'voice' => 'https://daniil.it/audio_2020-02-01_18-09-08.ogg', ];