time() - 1000]; // When $canSendMsg = $mailService->canSendMsg(self::MSG_KEY); // Then $this->assertTrue($canSendMsg); } public function test_should_not_send_2_mails_in_a_short_interval(): void { // Given $mailService = new MailService(true); $_SESSION[MailService::MAILSERVICE_KEY] = [self::MSG_KEY => time()]; // When $canSendMsg = $mailService->canSendMsg(self::MSG_KEY); // Then $this->assertFalse($canSendMsg); } }