framework icon indicating copy to clipboard operation
framework copied to clipboard

Xdebug throws “ParseError: Unclosed '('” after marking test as incomplete when running PHPUnit inside Laravel Sail

Open vwinck-dev opened this issue 1 month ago • 1 comments

Laravel Version

12.34.0

PHP Version

8.3.25

Database Driver & Version

MySQL 8.0 on Windows 11 (WSL + Laravel Sail)

Description

When running tests inside Laravel Sail with Xdebug enabled, marking a test as incomplete with $this->markTestIncomplete() triggers a ParseError:

ParseError: Unclosed '('
in vendor/laravel/framework/src/Illuminate/View/Compilers/BladeCompiler.php:623

This error does not occur when Xdebug is disabled. It seems related to the intefraction between BladeCompiler and Xdebug, possibly involving view cache or teardown behavior during PHPUnit test execution.

Steps To Reproduce

  • Create any PHPUnit test in a Laravel Project;
  • Inside the test, add the markTestIncomplete method:
    public function test_category_can_be_restored(): void
    {
        $this->markTestIncomplete();
    }
  • Run tests with Xdebug enabled:
  • sail test (with alias) or ./vendor/bin/sail test;
  • Observe the error:
    protected function hasEvenNumberOfParentheses(string $expression)
    {
        $tokens = token_get_all('<?php '.$expression);
>> Exception has occurred.
>> ParseError: Unclosed '('

vwinck-dev avatar Oct 21 '25 13:10 vwinck-dev