Skip to content

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

@vwinck-dev

Description

@vwinck-dev

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 '('

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions