log('[Unit] sample message', ['foo' => 'bar']); $logFile = storage_path(HelloLogService::LOG_FILE); $this->assertFileExists($logFile, 'hello-plugin.log 파일이 생성되어야 합니다.'); $contents = file_get_contents($logFile); $this->assertStringContainsString('[Unit] sample message', $contents); $this->assertStringContainsString('foo', $contents); } /** * 여러 번 호출하면 모든 메시지가 추가 기록되어야 합니다. */ public function test_log_appends_multiple_messages(): void { /** @var HelloLogService $service */ $service = app(HelloLogService::class); $service->log('first message'); $service->log('second message'); $contents = file_get_contents(storage_path(HelloLogService::LOG_FILE)); $this->assertStringContainsString('first message', $contents); $this->assertStringContainsString('second message', $contents); } }