-
Notifications
You must be signed in to change notification settings - Fork 11.1k
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
[BUG] PHPUnit Fails when new Service Provider is added #42
Comments
Are you able to put I find I nearly always need to run with error displaying on. Also, are you running the tests for your application or for the package you're developing?? |
@bencorlett Thanks to the reply. I did put the display errors on and got the following error. I am running the test for the L4 application (not the package). Note that Hbt\App\AppServiceProvider is actually a workbench package added to config/app.php file under providers. As shown in the error, it seems when running the phpunit on L4 root, the workbench service providers are not found when it is trying to load it. I did test this with a fresh install and creating a new workbench and adding the service provider and same happens.
|
I'm having this same issue. It looks like But that's partly a guess. I can look into this and confirm later tonight, hopefully. |
I believe I was right. The workbench autoloads are registered in public/index.php and artisan, but that leaves out the case of unit tests. For now, a workaround is to create |
Yeah that sounds about right @joecwallace. You might be able to add your workbench packages
Still... not ideal. |
Thanks @joecwallace and @jasonlewis for the suggestions, and hopefully we can see what @taylorotwell has to say about this issue. |
I've thought of a better way to fix this. In public function createApplication()
{
$unitTesting = true;
$testEnvironment = 'testing';
$basePath = __DIR__.'/../..';
Illuminate\Workbench\Starter::start($basePath.'/workbench');
return require $basePath.'/start.php';
} Cleaner than redefining the providers array. UPDATE: I submitted this fix as a pull request on laravel / laravel |
Ah good one Joe! Much better alternative.
|
@joecwallace thanks, finally this looks like the solution we need. |
Should this PR be merged to solve this issue? laravel/laravel#1608 |
Yes Sent from my iPad On 21/01/2013, at 5:21 AM, Raf [email protected] wrote:
|
This has been fixed. |
Add console command to create oauth clients for organizations
I used a fresh L4 install,
generated a workbench package
added the package service provider to config/app.php file under providers key
Then ran phpunit and test is not running.
Then I removed the service provider from the array and phpunit worked.
It seems something wrong with autoloading the extended class Illuminate\Foundation\Testing\TestCase
as if I extend the class with PHPUnit_Framework_TestCase then it does work.
The text was updated successfully, but these errors were encountered: