1
0
mirror of https://github.com/danog/MadelineProto.git synced 2024-11-26 17:24:40 +01:00

Further improve tests

This commit is contained in:
Daniil Gentili 2023-11-30 17:58:48 +01:00
parent 01effbd42f
commit 4148d58c42
5 changed files with 42 additions and 62 deletions

View File

@ -57,3 +57,4 @@ steps:
- apk add bash
- tests/test.sh
- php tests/handshake.php
- composer test-light

View File

@ -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"]

25
phpunit-light.xml Normal file
View File

@ -0,0 +1,25 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd"
backupGlobals="false"
backupStaticAttributes="false"
bootstrap="vendor/autoload.php"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
>
<coverage>
<include>
<directory suffix=".php">src</directory>
</include>
</coverage>
<testsuites>
<testsuite name="Main">
<directory>tests</directory>
<exclude>tests/danog/MadelineProto/DataCenterTest.php</exclude>
<exclude>tests/danog/MadelineProto/FileIdTest.php</exclude>
</testsuite>
</testsuites>
</phpunit>

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<files psalm-version="dev-master@baa6d5dd7801e24d99d2f57995b58b79e8ad304a">
<files psalm-version="dev-master@efdf425983038f7ef6194df43f3dc18cde13d770">
<file src="src/API.php">
<ArgumentTypeCoercion>
<code>$settings</code>
@ -1067,6 +1067,7 @@
<code><![CDATA[$this->colors]]></code>
<code><![CDATA[$this->colors]]></code>
<code><![CDATA[$this->colors]]></code>
<code><![CDATA[$this->colors]]></code>
</UninitializedProperty>
</file>
<file src="src/Loop/Connection/CheckLoop.php">
@ -1838,58 +1839,6 @@
<code>$wrapper</code>
</PropertyNotSetInConstructor>
</file>
<file src="src/Ogg.php">
<InaccessibleProperty>
<code><![CDATA[$this->comments]]></code>
<code><![CDATA[$this->vendorString]]></code>
</InaccessibleProperty>
<PossiblyInvalidArgument>
<code>$offset</code>
<code>$offset</code>
<code>$offset</code>
<code>$offset</code>
<code>$offset</code>
<code>$offset</code>
<code>$size</code>
</PossiblyInvalidArgument>
<PossiblyInvalidPropertyAssignmentValue>
<code><![CDATA[$this->currentDuration += $frameDuration]]></code>
<code><![CDATA[$this->currentDuration += $totalDuration]]></code>
</PossiblyInvalidPropertyAssignmentValue>
<PossiblyNullArgument>
<code><![CDATA[($this->stream)($headers['number_page_segments'])]]></code>
<code><![CDATA[($this->stream)(23)]]></code>
</PossiblyNullArgument>
<PossiblyUndefinedVariable>
<code>$cancel</code>
</PossiblyUndefinedVariable>
<PropertyNotSetInConstructor>
<code>$comments</code>
<code>$streamCount</code>
<code>$vendorString</code>
</PropertyNotSetInConstructor>
<RedundantCondition>
<code>$state === self::STATE_READ_COMMENT</code>
</RedundantCondition>
<ReferenceConstraintViolation>
<code>$offset</code>
<code>$offset</code>
<code>$offset</code>
<code>$offset</code>
</ReferenceConstraintViolation>
<TooFewArguments>
<code><![CDATA[($this->stream)($headers['number_page_segments'])]]></code>
<code><![CDATA[($this->stream)($sizeAccumulated)]]></code>
<code><![CDATA[($this->stream)(23)]]></code>
<code><![CDATA[($this->stream)(4)]]></code>
</TooFewArguments>
<UndefinedClass>
<code>?FFI</code>
<code>FFI</code>
<code>FFI</code>
<code>int|CData $err</code>
</UndefinedClass>
</file>
<file src="src/PTSException.php">
<MissingParamType>
<code>$file</code>
@ -2375,6 +2324,7 @@
<file src="src/Tools.php">
<ArgumentTypeCoercion>
<code><![CDATA[static fn (ClassLike $c): bool => $c->name !== null]]></code>
<code><![CDATA[static fn (ClassLike $c): bool => $c->name !== null]]></code>
</ArgumentTypeCoercion>
<MissingClosureParamType>
<code>$val</code>

View File

@ -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',
];