php - PHPUnit PHP_Token_Class not found unless executed with --no-coverage
one text
Im currently having a problem on my PHPUnit.
It will throw the following when executed:
In Stream.php line 477:
Class 'PHP_Token_CLASS' not found
However, the test will just proceed if added the option below:
./phpunit --no-coverage
but its difficult to monitor the test since it has no coverage.
Im using docker for windows.
I have tried several things such as rebuilding the docker container, config clear on artisan, composer dumpautoload, deleted vendor directory and then running composer install, using the option --coverage-text and --coverage-xml but nothing seems to work.
Thank you.
[UPDATE]
Here is my composer.json file
{
"name": "laravel/laravel",
"type": "project",
"description": "The Laravel Framework.",
"keywords": [
"framework",
"laravel"
],
"license": "MIT",
"require": {
"php": "^7.2|^8.0",
"doctrine/dbal": "^2.12.1",
"fideloper/proxy": "^4.0",
"fruitcake/laravel-cors": "^2.0",
"guzzlehttp/guzzle": "^7.0",
"juampi92/cursor-pagination": "^1.6",
"laravel/framework": "^6.18.35",
"laravel/passport": "^9.3",
"laravel/tinker": "^2.0",
"mustache/mustache": "~2.5",
"predis/predis": "^1.1"
},
"require-dev": {
"facade/ignition": "^1.4",
"fzaninotto/faker": "^1.9.1",
"mockery/mockery": "^1.0",
"nunomaduro/collision": "^3.0",
"phpunit/phpunit": "^8.0"
},
"config": {
"optimize-autoloader": true,
"preferred-install": "dist",
"sort-packages": true
},
"extra": {
"laravel": {
"dont-discover": []
}
},
"autoload": {
"psr-4": {
"App\\": "app/"
},
"classmap": [
"database/seeds",
"database/factories"
],
"files": [
"app/helpers.php"
]
},
"autoload-dev": {
"psr-4": {
"Tests\\": "tests/"
}
},
"minimum-stability": "dev",
"prefer-stable": true,
"scripts": {
"post-autoload-dump": [
"Illuminate\\Foundation\\ComposerScripts::postAutoloadDump",
"@php artisan package:discover --ansi"
],
"post-root-package-install": [
"@php -r \"file_exists('.env') || copy('.env.example', '.env');\""
],
"post-create-project-cmd": [
"@php artisan key:generate --ansi"
]
}
}
Source