mainLogger = new MainLogger(tempnam(sys_get_temp_dir(), "pmlog")); $this->pool = new AsyncPool(2, 1024, new \BaseClassLoader(), $this->mainLogger); } public function tearDown() : void{ $this->pool->shutdown(); $this->mainLogger->shutdown(); $this->mainLogger->join(); } public function testTaskLeak() : void{ $start = microtime(true); $this->pool->submitTask(new LeakTestAsyncTask()); while(!LeakTestAsyncTask::$destroyed and microtime(true) < $start + 30){ usleep(50 * 1000); $this->pool->collectTasks(); } self::assertTrue(LeakTestAsyncTask::$destroyed, "Task was not destroyed after 30 seconds"); } public function testPublishProgressRace() : void{ $task = new PublishProgressRaceAsyncTask(); $this->pool->submitTask($task); while($this->pool->collectTasks()){ usleep(50 * 1000); } self::assertTrue(PublishProgressRaceAsyncTask::$success, "Progress was not reported before task completion"); } }