setTestPath(DirectoryList::VAR_DIR, '/var/magento/var'); $dir->setTestPath(DirectoryList::LOG, '/var/magento/var/log'); $paths = new TunnelProcessPaths($dir); self::assertSame( '/var/magento/var/magesail_tunnels/tunnel1.pid', $paths->getPidFilePath('tunnel1') ); } public function testSanitizeIdStripsUnsafeCharacters(): void { $dir = new DirectoryList(); $dir->setTestPath(DirectoryList::VAR_DIR, '/v'); $dir->setTestPath(DirectoryList::LOG, '/v/log'); $paths = new TunnelProcessPaths($dir); self::assertStringContainsString( '/magesail_tunnels/ab.pid', $paths->getPidFilePath('a!@#b') ); } public function testSanitizeIdFallsBackToInvalidWhenEmpty(): void { $dir = new DirectoryList(); $dir->setTestPath(DirectoryList::VAR_DIR, '/v'); $dir->setTestPath(DirectoryList::LOG, '/v/log'); $paths = new TunnelProcessPaths($dir); self::assertStringEndsWith( '/magesail_tunnels/invalid.pid', $paths->getPidFilePath('!!!') ); } public function testLegacyPaths(): void { $dir = new DirectoryList(); $dir->setTestPath(DirectoryList::VAR_DIR, '/v'); $dir->setTestPath(DirectoryList::LOG, '/v/log'); $paths = new TunnelProcessPaths($dir); self::assertSame('/v/magesail.pid', $paths->getLegacyPidFilePath()); self::assertSame('/v/magesail.key', $paths->getLegacyKeyFilePath()); self::assertSame('/v/log/magesail_tunnel.log', $paths->getLegacyLogFilePath()); } }