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

Fix race condition in tests

This commit is contained in:
Daniil Gentili 2023-11-30 22:52:39 +01:00
parent 9b637d3118
commit bfd8a6b0b0
2 changed files with 3 additions and 58 deletions

View File

@ -7,6 +7,7 @@ namespace danog\MadelineProto\Test;
use danog\MadelineProto\API;
use danog\MadelineProto\Logger;
use danog\MadelineProto\Settings;
use danog\MadelineProto\Tools;
use PHPUnit\Framework\TestCase;
/** @internal */
@ -32,7 +33,9 @@ abstract class MadelineTestCase extends TestCase
'testing.madeline',
$settings
);
$unlock = Tools::flock('/tmp/login.flock', LOCK_EX);
self::$MadelineProto->botLogin(getenv('BOT_TOKEN'));
$unlock();
}
/**

View File

@ -1,58 +0,0 @@
#!/bin/bash -e
madelinePath=$PWD
tempDir=/tmp/tempConv$1
rm -rf $tempDir
mkdir $tempDir
cd $tempDir
pwd
echo '{
"name": "danog/madelineprototests",
"minimum-stability":"dev",
"require": {
"danog/madelineproto": "dev-master",
"amphp/dns": "dev-master#ecbeca2ae0e93c08e8150a92810a3961fad8ecbe as v1"
},
"require-dev": {
"vlucas/phpdotenv": "^3"
},
"repositories": [
{
"type": "path",
"url": "'$madelinePath'",
"options": {
"symlink": false
}
}
],
"authors": [
{
"name": "Daniil Gentili",
"email": "daniil@daniil.it"
}
]
}' > composer.json
composer config platform.php "7.4"
#composer clearcache
composer update
composer dumpautoload --optimize
$madelinePath/tests/conversion/prepare-$1.sh
$madelinePath/vendor/bin/php7to$1 convert --copy-all vendor newVendor
rm -rf vendor
mv newVendor vendor
$madelinePath/tests/conversion/after-$1.sh
cd $madelinePath
if [ $1 -eq 5 ];then
php5.6 tests/testing.php $1
else
php7.0 tests/testing.php $1
fi