1
1
Fork 0
mirror of https://code.mensbeam.com/MensBeam/Arsse.git synced 2024-12-22 21:22:40 +00:00

Test for service reloading

This commit is contained in:
J. King 2021-07-06 10:07:56 -04:00
parent ad32bf3340
commit 46e20be983
2 changed files with 15 additions and 1 deletions

View file

@ -48,6 +48,7 @@ class Service {
pcntl_signal_dispatch(); pcntl_signal_dispatch();
if ($this->reload) { if ($this->reload) {
$this->reload(); $this->reload();
fwrite(\STDERR, Arsse::$lang->msg("Service.Reload").\PHP_EOL);
} }
} }
} while ($this->loop && $t->getTimestamp() > time()); } 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::$user = Arsse::$db = Arsse::$conf = Arsse::$lang = Arsse::$obj = $this->drv = null;
Arsse::bootstrap(); Arsse::bootstrap();
$this->__construct(); $this->__construct();
fwrite(\STDERR, Arsse::$lang->msg("Service.Reload").\PHP_EOL);
} }
public function checkIn(): bool { public function checkIn(): bool {

View file

@ -88,4 +88,18 @@ class TestService extends \JKingWeb\Arsse\Test\AbstractTest {
$this->dbMock->articleCleanup->called(); $this->dbMock->articleCleanup->called();
$this->dbMock->metaSet->calledWith("service_last_checkin", $this->anything(), "datetime"); $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);
}
} }