mirror of
https://github.com/danog/MadelineProto.git
synced 2024-11-30 04:59:00 +01:00
Further improve tests
This commit is contained in:
parent
be6632083b
commit
999500eaf3
@ -115,8 +115,7 @@
|
||||
"@psalm"
|
||||
],
|
||||
"test": [
|
||||
"@paratest",
|
||||
"@phpunit"
|
||||
"@paratest"
|
||||
],
|
||||
"test-light": [
|
||||
"@paratest-light"
|
||||
@ -125,9 +124,8 @@
|
||||
"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 -c phpunit-noparallel.xml",
|
||||
"paratest": "@php -dzend.assertions=1 ./vendor/bin/paratest -f",
|
||||
"paratest-light": "@php -dzend.assertions=1 ./vendor/bin/paratest -f -c phpunit-light.xml",
|
||||
"paratest": "@php -dzend.assertions=1 ./vendor/bin/paratest -fv",
|
||||
"paratest-light": "@php -dzend.assertions=1 ./vendor/bin/paratest -fvc phpunit-light.xml",
|
||||
"bin": "echo 'bin not installed'",
|
||||
"post-install-cmd": ["@composer bin all install --ansi"],
|
||||
"post-update-cmd": ["@composer bin all update --ansi"]
|
||||
|
@ -1,23 +0,0 @@
|
||||
<?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">
|
||||
<file>tests/danog/MadelineProto/DataCenterTest.php</file>
|
||||
</testsuite>
|
||||
</testsuites>
|
||||
</phpunit>
|
@ -66,7 +66,7 @@ final class DataCenterTest extends AsyncTestCase
|
||||
self::$proxyEndpoint = InternetAddress::fromString(str_replace('tcp://', '', $addr));
|
||||
|
||||
self::$main = new API(
|
||||
sys_get_temp_dir().'/testing_datacenter_main.madeline',
|
||||
sys_get_temp_dir(). '/'.random_int(0, PHP_INT_MAX).'_'.getmypid().'testing_datacenter_main.madeline',
|
||||
self::getBaseSettings(false)
|
||||
);
|
||||
/*self::$test = new API(
|
||||
|
@ -22,7 +22,7 @@ class FileIdTest extends MadelineTestCase
|
||||
*/
|
||||
public static function stripFileReference(string $fileId): string
|
||||
{
|
||||
return (string) FileId::fromBotAPI($fileId)->setFileReference('');
|
||||
return (string) FileId::fromBotAPI($fileId)->setFileReference('')->setVersion(0);
|
||||
}
|
||||
/**
|
||||
* Strip access hash (and possibly ID) from file ID.
|
||||
@ -87,14 +87,10 @@ class FileIdTest extends MadelineTestCase
|
||||
$this->expectExceptionMessage("Chat photo file IDs can't be reused to resend chat photos, please use getPwrChat()['photo'], instead");
|
||||
}
|
||||
$res = self::$MadelineProto->messages->sendMedia(
|
||||
[
|
||||
'peer' => getenv('DEST'),
|
||||
'media' => $fileIdStr,
|
||||
],
|
||||
[
|
||||
'botAPI' => true,
|
||||
],
|
||||
peer: getenv('DEST'),
|
||||
media: $fileIdStr,
|
||||
);
|
||||
$res = self::$MadelineProto->MTProtoToBotAPI($res);
|
||||
if ($type === 'thumbnail') {
|
||||
$this->assertArrayHasKey($fullInfo[0], $res);
|
||||
$res = $res[$fullInfo[0]];
|
||||
|
Loading…
Reference in New Issue
Block a user