From 46e20be983a3902ff8dac75d7b67569874439191 Mon Sep 17 00:00:00 2001 From: "J. King" Date: Tue, 6 Jul 2021 10:07:56 -0400 Subject: [PATCH] Test for service reloading --- lib/Service.php | 2 +- tests/cases/Service/TestService.php | 14 ++++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/lib/Service.php b/lib/Service.php index 4a7f1cdb..7eb31779 100644 --- a/lib/Service.php +++ b/lib/Service.php @@ -48,6 +48,7 @@ class Service { pcntl_signal_dispatch(); if ($this->reload) { $this->reload(); + fwrite(\STDERR, Arsse::$lang->msg("Service.Reload").\PHP_EOL); } } } while ($this->loop && $t->getTimestamp() > time()); @@ -62,7 +63,6 @@ class Service { Arsse::$user = Arsse::$db = Arsse::$conf = Arsse::$lang = Arsse::$obj = $this->drv = null; Arsse::bootstrap(); $this->__construct(); - fwrite(\STDERR, Arsse::$lang->msg("Service.Reload").\PHP_EOL); } public function checkIn(): bool { diff --git a/tests/cases/Service/TestService.php b/tests/cases/Service/TestService.php index 6c903583..277df8f1 100644 --- a/tests/cases/Service/TestService.php +++ b/tests/cases/Service/TestService.php @@ -88,4 +88,18 @@ class TestService extends \JKingWeb\Arsse\Test\AbstractTest { $this->dbMock->articleCleanup->called(); $this->dbMock->metaSet->calledWith("service_last_checkin", $this->anything(), "datetime"); } + + public function testReloadTheService(): void { + $u = Arsse::$user; + $l = Arsse::$lang; + $d = Arsse::$db; + $o = Arsse::$obj; + $c = Arsse::$conf; + $this->srv->reload(); + $this->assertNotSame($u, Arsse::$user); + $this->assertNotSame($l, Arsse::$lang); + $this->assertNotSame($d, Arsse::$db); + $this->assertNotSame($o, Arsse::$obj); + $this->assertNotSame($c, Arsse::$conf); + } }