diff --git a/tests/php/BackgroundJob/LockInactiveRoomsTest.php b/tests/php/BackgroundJob/LockInactiveRoomsTest.php index 75b83fd0b3f..e0e02d720d7 100644 --- a/tests/php/BackgroundJob/LockInactiveRoomsTest.php +++ b/tests/php/BackgroundJob/LockInactiveRoomsTest.php @@ -39,11 +39,12 @@ public function setUp(): void { } public function testNotEnabled(): void { - $this->appConfig->expects(self::exactly(2)) - ->willReturnMap([ - 0, - false - ]); + $this->appConfig->expects(self::once()) + ->method('getInactiveLockTime') + ->willReturn(0); + $this->appConfig->expects(self::once()) + ->method('enableLobbyOnLockedRooms') + ->willReturn(false); $this->timeFactory->expects(self::never()) ->method(self::anything()); $this->roomService->expects(self::never()) @@ -51,15 +52,16 @@ public function testNotEnabled(): void { $this->logger->expects(self::never()) ->method(self::anything()); - $this->job->run(); + $this->job->run('t'); } public function testNoRooms(): void { - $this->appConfig->expects(self::exactly(2)) - ->willReturnMap([ - 'getInactiveLockTime', 365, - 'enableLobbyOnLockedRooms', false - ]); + $this->appConfig->expects(self::once()) + ->method('getInactiveLockTime') + ->willReturn(123); + $this->appConfig->expects(self::once()) + ->method('enableLobbyOnLockedRooms') + ->willReturn(false); $this->timeFactory->expects(self::once()) ->method('getTime'); $this->timeFactory->expects(self::once()) @@ -74,26 +76,28 @@ public function testNoRooms(): void { $this->logger->expects(self::never()) ->method(self::anything()); - $this->job->run(); + $this->job->run('t'); + } public function testLockRooms(): void { $rooms = [ $this->createConfiguredMock(Room::class, [ - 'getReadOnly' => false, + 'getReadOnly' => 0, 'getType' => Room::TYPE_PUBLIC, ]), $this->createConfiguredMock(Room::class, [ - 'getReadOnly' => false, + 'getReadOnly' => 0, 'getType' => Room::TYPE_GROUP, ]), ]; - $this->appConfig->expects(self::exactly(2)) - ->willReturnMap([ - 365, - false - ]); + $this->appConfig->expects(self::once()) + ->method('getInactiveLockTime') + ->willReturn(123); + $this->appConfig->expects(self::once()) + ->method('enableLobbyOnLockedRooms') + ->willReturn(false); $this->timeFactory->expects(self::once()) ->method('getTime'); $this->timeFactory->expects(self::once()) @@ -108,29 +112,31 @@ public function testLockRooms(): void { $this->logger->expects(self::exactly(2)) ->method('debug'); - $this->job->run(); + $this->job->run('t'); + } public function testLockRoomsAndEnableLobby(): void { $rooms = [ $this->createConfiguredMock(Room::class, [ - 'getReadOnly' => false, + 'getReadOnly' => 0, 'getType' => Room::TYPE_PUBLIC, ]), $this->createConfiguredMock(Room::class, [ - 'getReadOnly' => false, + 'getReadOnly' => 0, 'getType' => Room::TYPE_GROUP, ]), ]; - $this->appConfig->expects(self::exactly(2)) - ->willReturnMap([ - 365, - true - ]); + $this->appConfig->expects(self::once()) + ->method('getInactiveLockTime') + ->willReturn(123); + $this->appConfig->expects(self::once()) + ->method('enableLobbyOnLockedRooms') + ->willReturn(true); $this->timeFactory->expects(self::once()) ->method('getTime'); - $this->timeFactory->expects(self::once()) + $this->timeFactory->expects(self::any()) ->method('getDateTime'); $this->roomService->expects(self::once()) ->method('getInactiveRooms') @@ -142,6 +148,6 @@ public function testLockRoomsAndEnableLobby(): void { $this->logger->expects(self::exactly(4)) ->method('debug'); - $this->job->run(); + $this->job->run('t'); } }