-
Notifications
You must be signed in to change notification settings - Fork 595
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
'Cannot start session when headers already sent' on run Unit Test #476
Comments
One solution is change
|
I dont know if this cause it, but if change
The test starts run but trow this exception:
|
hello @eliasjtg how did you solve it? |
i don't think this is a solution, it works but when i am doing a deploy it download the lib each time. tests keep going fail |
@antonioribeiro @erikhu Opened a pull request on this in pragmarx/support. |
@shawngoh87 i thought the same but the problem is that if it is not started a session it must be create it, so the code in line 21 of PhpSession.php will not start a session if PHP_SESSION_NONE is true, remember this global means no exist session, so the original code i think is okey. |
Describe the bug
On run unit test this fails with the log:
To Reproduce
Steps to reproduce the behavior:
Install with
composer require pragmarx/tracker
Add the service provider to app/config/app.php:
PragmaRX\Tracker\Vendor\Laravel\ServiceProvider::class
Add the alias to the facade on app/config/app.php:
'Tracker' => 'PragmaRX\Tracker\Vendor\Laravel\Facade'
Publish tracker configuration:
php artisan vendor:publish --provider="PragmaRX\Tracker\Vendor\Laravel\ServiceProvider"
Enable the Middleware in
app/config/tracker.php
:'use_middleware' => true,
Add the Middleware to Laravel Kernel:
\PragmaRX\Tracker\Vendor\Laravel\Middlewares\Tracker::class,
Enable Tracker in tracker.php:
'enabled' => true,
Publish the migration:
php artisan tracker:tables
Config database.php:
'tracker' => [ 'driver' => 'mysql', 'url' => env('DATABASE_TRACK_URL', env('DATABASE_URL')), 'host' => env('DB_TRACK_HOST', env('DB_HOST', '127.0.0.1')), 'port' => env('DB_TRACK_PORT', env('DB_PORT', '3306')), 'database' => env('DB_TRACK_DATABASE' ,env('DB_DATABASE', 'forge')), 'username' => env('DB_TRACK_USERNAME', env('DB_USERNAME', 'forge')), 'password' => env('DB_TRACK_PASSWORD', env('DB_PASSWORD', '')), 'unix_socket' => env('DB_TRACK_SOCKET', env('DB_SOCKET', '')), 'charset' => 'utf8', 'collation' => 'utf8_unicode_ci', 'prefix' => '', 'prefix_indexes' => false, 'strict' => false, 'engine' => 'InnoDB', 'options' => extension_loaded('pdo_mysql') ? array_filter([ PDO::MYSQL_ATTR_SSL_CA => env('MYSQL_ATTR_SSL_CA'), ]) : [], ],
Migrate:
php artisan migrate
Enable configurations:
`
'cache_enabled' => true,
'log_enabled' => true,
'log_user_agents' => true,
'log_devices' => true,
'log_referers' => true,
'log_paths' => true,
'log_routes' => true,
'log_exceptions' => true,
'user_model' => 'App\Entities\User',
`
Run tests:
phpunit
Expected behavior
Tests run normally
Screenshots

Gitlab CI
System
Additional context
PHP 7.3.7
Laravel 6
PHPUnit 8.4.2
The text was updated successfully, but these errors were encountered: