. */ namespace App\Tests\Exceptions; use App\Exceptions\TwigModeException; use PHPUnit\Framework\TestCase; use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase; use Twig\Error\Error; class TwigModeExceptionTest extends KernelTestCase { private string $projectPath; public function setUp(): void { self::bootKernel(); $this->projectPath = self::getContainer()->getParameter('kernel.project_dir'); } public function testGetSafeMessage(): void { $testException = new Error("Error at : " . $this->projectPath . "/src/dir/path/file.php"); $twigModeException = new TwigModeException($testException); $this->assertSame("Error at : " . $this->projectPath . "/src/dir/path/file.php", $testException->getMessage()); $this->assertSame("Error at : [Part-DB Root Folder]/src/dir/path/file.php", $twigModeException->getSafeMessage()); } }