mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-07 10:22:56 +00:00
Merge branch 'stable' into master
# Conflicts: # composer.lock # resources/vanilla # src/entity/Living.php # src/pocketmine/Player.php # src/pocketmine/VersionInfo.php # src/pocketmine/block/Potato.php # src/pocketmine/block/Sugarcane.php # src/pocketmine/entity/Entity.php # src/pocketmine/item/Item.php # src/pocketmine/level/format/Chunk.php # src/pocketmine/level/format/io/leveldb/LevelDB.php # src/world/generator/GeneratorRegisterTask.php # tests/phpstan/configs/check-explicit-mixed-baseline.neon # tests/phpstan/configs/l7-baseline.neon # tests/phpstan/configs/l8-baseline.neon # tests/plugins/TesterPlugin/src/pmmp/TesterPlugin/tests/AsyncTaskMainLoggerTest.php # tests/plugins/TesterPlugin/src/pmmp/TesterPlugin/tests/AsyncTaskMemoryLeakTest.php # tests/plugins/TesterPlugin/src/pmmp/TesterPlugin/tests/AsyncTaskPublishProgressRaceTest.php
This commit is contained in:
@ -115,11 +115,6 @@ parameters:
|
||||
count: 1
|
||||
path: ../../../src/command/defaults/SetWorldSpawnCommand.php
|
||||
|
||||
-
|
||||
message: "#^Parameter \\#1 \\$name of method pocketmine\\\\Server\\:\\:getPlayer\\(\\) expects string, string\\|null given\\.$#"
|
||||
count: 1
|
||||
path: ../../../src/command/defaults/TellCommand.php
|
||||
|
||||
-
|
||||
message: "#^Cannot call method getTime\\(\\) on pocketmine\\\\world\\\\World\\|null\\.$#"
|
||||
count: 1
|
||||
@ -417,11 +412,6 @@ parameters:
|
||||
|
||||
-
|
||||
message: "#^Parameter \\#1 \\$str of function trim expects string, string\\|null given\\.$#"
|
||||
count: 4
|
||||
path: ../../../src/permission/BanEntry.php
|
||||
|
||||
-
|
||||
message: "#^Parameter \\#1 \\$date of static method pocketmine\\\\permission\\\\BanEntry\\:\\:parseDate\\(\\) expects string, string\\|null given\\.$#"
|
||||
count: 1
|
||||
path: ../../../src/permission/BanEntry.php
|
||||
|
||||
@ -961,7 +951,7 @@ parameters:
|
||||
path: ../../phpunit/event/HandlerListManagerTest.php
|
||||
|
||||
-
|
||||
message: "#^Property pocketmine\\\\network\\\\mcpe\\\\handler\\\\StupidJsonDecodeTest\\:\\:\\$stupidJsonDecodeFunc \\(Closure\\) does not accept Closure\\|null\\.$#"
|
||||
message: "#^Cannot call method cancel\\(\\) on pocketmine\\\\scheduler\\\\TaskHandler\\|null\\.$#"
|
||||
count: 1
|
||||
path: ../../phpunit/network/mcpe/handler/StupidJsonDecodeTest.php
|
||||
path: ../../plugins/TesterPlugin/src/pmmp/TesterPlugin/CheckTestCompletionTask.php
|
||||
|
||||
|
@ -10,3 +10,8 @@ parameters:
|
||||
count: 1
|
||||
path: ../../phpunit/network/mcpe/handler/StupidJsonDecodeTest.php
|
||||
|
||||
-
|
||||
message: "#^Property pocketmine\\\\network\\\\mcpe\\\\handler\\\\StupidJsonDecodeTest\\:\\:\\$stupidJsonDecodeFunc \\(Closure\\(string, bool\\)\\: mixed\\) does not accept Closure\\|null\\.$#"
|
||||
count: 1
|
||||
path: ../../phpunit/network/mcpe/handler/StupidJsonDecodeTest.php
|
||||
|
||||
|
@ -26,7 +26,10 @@ namespace pocketmine\network\mcpe\handler;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
class StupidJsonDecodeTest extends TestCase{
|
||||
/** @var \Closure */
|
||||
/**
|
||||
* @var \Closure
|
||||
* @phpstan-var \Closure(string $json, bool $assoc=) : mixed
|
||||
*/
|
||||
private $stupidJsonDecodeFunc;
|
||||
|
||||
public function setUp() : void{
|
||||
|
@ -38,14 +38,14 @@ class Main extends PluginBase implements Listener{
|
||||
/** @var int */
|
||||
protected $currentTestNumber = 0;
|
||||
|
||||
public function onEnable(){
|
||||
public function onEnable() : void{
|
||||
$this->getServer()->getPluginManager()->registerEvents($this, $this);
|
||||
$this->getScheduler()->scheduleRepeatingTask(new CheckTestCompletionTask($this), 10);
|
||||
|
||||
$this->waitingTests = [];
|
||||
}
|
||||
|
||||
public function onServerCommand(CommandEvent $event){
|
||||
public function onServerCommand(CommandEvent $event) : void{
|
||||
//The CI will send this command as a failsafe to prevent the build from hanging if the tester plugin failed to
|
||||
//run. However, if the plugin loaded successfully we don't want to allow this to stop the server as there may
|
||||
//be asynchronous tests running. Instead we cancel this and stop the server of our own accord once all tests
|
||||
@ -55,10 +55,7 @@ class Main extends PluginBase implements Listener{
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Test|null
|
||||
*/
|
||||
public function getCurrentTest(){
|
||||
public function getCurrentTest() : ?Test{
|
||||
return $this->currentTest;
|
||||
}
|
||||
|
||||
@ -73,7 +70,7 @@ class Main extends PluginBase implements Listener{
|
||||
return false;
|
||||
}
|
||||
|
||||
public function onTestCompleted(Test $test){
|
||||
public function onTestCompleted(Test $test) : void{
|
||||
$message = "Finished test #" . $this->currentTestNumber . " (" . $test->getName() . "): ";
|
||||
switch($test->getResult()){
|
||||
case Test::RESULT_OK:
|
||||
@ -99,7 +96,7 @@ class Main extends PluginBase implements Listener{
|
||||
$this->currentTest = null;
|
||||
}
|
||||
|
||||
public function onAllTestsCompleted(){
|
||||
public function onAllTestsCompleted() : void{
|
||||
$this->getLogger()->notice("All tests finished, stopping the server");
|
||||
$this->getServer()->shutdown();
|
||||
}
|
||||
|
@ -29,9 +29,13 @@ abstract class Test{
|
||||
const RESULT_FAILED = 1;
|
||||
const RESULT_ERROR = 2;
|
||||
|
||||
/** @var Main */
|
||||
private $plugin;
|
||||
/** @var int */
|
||||
private $result = Test::RESULT_WAITING;
|
||||
/** @var int */
|
||||
private $startTime;
|
||||
/** @var int */
|
||||
private $timeout = 60; //seconds
|
||||
|
||||
public function __construct(Main $plugin){
|
||||
@ -42,7 +46,7 @@ abstract class Test{
|
||||
return $this->plugin;
|
||||
}
|
||||
|
||||
final public function start(){
|
||||
final public function start() : void{
|
||||
$this->startTime = time();
|
||||
try{
|
||||
$this->run();
|
||||
@ -55,11 +59,11 @@ abstract class Test{
|
||||
}
|
||||
}
|
||||
|
||||
public function tick(){
|
||||
public function tick() : void{
|
||||
|
||||
}
|
||||
|
||||
abstract public function run();
|
||||
abstract public function run() : void;
|
||||
|
||||
public function isFinished() : bool{
|
||||
return $this->result !== Test::RESULT_WAITING;
|
||||
@ -69,7 +73,7 @@ abstract class Test{
|
||||
return !$this->isFinished() and time() - $this->timeout > $this->startTime;
|
||||
}
|
||||
|
||||
protected function setTimeout(int $timeout){
|
||||
protected function setTimeout(int $timeout) : void{
|
||||
$this->timeout = $timeout;
|
||||
}
|
||||
|
||||
@ -77,7 +81,7 @@ abstract class Test{
|
||||
return $this->result;
|
||||
}
|
||||
|
||||
public function setResult(int $result){
|
||||
public function setResult(int $result) : void{
|
||||
$this->result = $result;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user