Skip to content

Running Unit Tests with PHPDBG #18121

@REBELinBLUE

Description

@REBELinBLUE
  • Laravel Version: 5.4.13
  • PHP Version: 7.0.15
  • Database Driver & Version: N/A

Description:

If you use phpdbg to generate code coverage instead of xdebug you can't test code which triggers the VerifyCsrfToken code.

It will fail with

{"error":{"type":"Illuminate\\Session\\TokenMismatchException","message":"","file":"\/path\/to\/project\/vendor\/laravel\/framework\/src\/Illuminate\/Foundation\/Http\/Middleware\/VerifyCsrfToken.php","line":68}}

This is because in the runningUnitTests method it uses the runningInConsole method of the Application, which checks that the php_sapi_name is cli but when using phpdbg it is phpdbg

Steps To Reproduce:

Test a controller which uses the CSRF middleware

$ phpdbg -qrr vendor/bin/phpunit --no-coverage tests/Features/MyControllerTest.php

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions