Skip to content

[Request] Forward compatibility for PHPUnit 5 #10829

Closed
@shehi

Description

@shehi

Unit-tests created for PHPUnit 4 generally work in v5, but I experienced problems in context of Binding and Resolution of providers. Example would be:

My app utilizes Cartalyst/Sentinel package and I use it via app('sentinel') initiator. Whenever unit-test works flawlessly, nothing wrong happens. But the moment you have counter-assertion (failing assertion) in tests, an exception similar to this happens:

Stack trace: 
#0 /home/shehi/Projects/Basis/vendor/laravel/framework/src/Illuminate/Container/Container.php(627): Illuminate\Container\Container->build('Illuminate\Cont...', Array)
#1 /home/shehi/Projects/Basis/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(674): Illuminate\Container\Container->make('Illuminate\Cont...', Array)
#2 /home/shehi/Projects/Basis/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/HandleExceptions.php(154): Illuminate\Foundation\Application->make('Illuminate\Cont...')
#3 /home/shehi/Projects/Basis/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/HandleExceptions.php(79): Illuminate\Foundation\Bootstrap\HandleExceptions->getExceptionHandler()
#4 [internal function]: Illuminate\Fo' in /home/shehi/Projects/Basis/vendor/laravel/framework/src/Illuminate/Container/Container.php:745

Stack trace: 
#0 /home/shehi/Projects/Basis/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/HandleExceptions.php(133): Symfony\Component\Debug\Exception\FatalErrorException->__construct()
#1 /home/shehi/Projects/Basis/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/HandleExceptions.php(118): Illuminate\Foundation\Bootstrap\HandleExceptions->fatalExceptionFromError()
#2 /home/shehi/Projects/Basis/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/HandleExceptions.php(0): Illuminate\Foundation\Bootstrap\HandleExceptions->handleShutdown() #3 {main} [] []```

This exception, by the looks of it, has nothing to do with actual test, as when I downgrade, real assertion errors show up. Also notice in TRACE after #4, it somehow gets concatenated and new trace starts. Kinda weird as an internal function trace pops up there :) 

My project in question is: http://github.com/AudithSoftworks/Basis

In any way, I recommend thorough testing of PHPUnit 5 for upcoming Laravel release, including service container, bindings and resolutions scopes especially for cases of failing-assertions.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions