Skip to content

Commit

Permalink
update test
Browse files Browse the repository at this point in the history
  • Loading branch information
chaz6chez committed Oct 18, 2024
1 parent 249fef0 commit 0c2878a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
4 changes: 4 additions & 0 deletions tests/UtilsCase/Worker/ServerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ public function testServerUseFuncInit()
// init
$reflection = new \ReflectionClass(AbstractWorker::class);
$init = $reflection->getMethod('initWorkers');
$init->setAccessible(true);
$init->invoke(null);
// onWorkerStart
$start = $reflection->getProperty('onWorkerStart');
Expand Down Expand Up @@ -88,6 +89,7 @@ public function testServerUseFactoryInit()
// init
$reflection = new \ReflectionClass(AbstractWorker::class);
$init = $reflection->getMethod('initWorkers');
$init->setAccessible(true);
$init->invoke(null);
// onWorkerStart
$start = $reflection->getProperty('onWorkerStart');
Expand Down Expand Up @@ -134,6 +136,7 @@ public function testServerSetConnectionCoroutine()
// init
$reflection = new \ReflectionClass(AbstractWorker::class);
$init = $reflection->getMethod('initWorkers');
$init->setAccessible(true);
$init->invoke(null);
// onWorkerStart
$start = $reflection->getProperty('onWorkerStart');
Expand Down Expand Up @@ -199,6 +202,7 @@ public function testServerException()
// init
$reflection = new \ReflectionClass(AbstractWorker::class);
$init = $reflection->getMethod('initWorkers');
$init->setAccessible(true);
$init->invoke(null);

// onWorkerStart 阶段抛出异常
Expand Down
3 changes: 3 additions & 0 deletions tests/UtilsCase/Worker/WorkerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ public function testWorkerUseFuncInit()
// init
$reflection = new \ReflectionClass(AbstractWorker::class);
$init = $reflection->getMethod('initWorkers');
$init->setAccessible(true);
$init->invoke(null);
// onWorkerStart
$start = $reflection->getProperty('onWorkerStart');
Expand All @@ -59,6 +60,7 @@ public function testWorkerUseFactoryInit()
// init
$reflection = new \ReflectionClass(AbstractWorker::class);
$init = $reflection->getMethod('initWorkers');
$init->setAccessible(true);
$init->invoke(null);

$this->assertEquals($onWorkerStart, $worker->getParentOnWorkerStart());
Expand Down Expand Up @@ -87,6 +89,7 @@ public function testWorkerException()
// init
$reflection = new \ReflectionClass(AbstractWorker::class);
$init = $reflection->getMethod('initWorkers');
$init->setAccessible(true);
$init->invoke(null);

$className = $worker::class;
Expand Down

0 comments on commit 0c2878a

Please sign in to comment.