Reputation: 918
I'm new to Laravel and PhpUnit and I'm trying to run some tests located in the \App\Tests\Unit folder on customs classes located in the \App\Musibits directory.
I get the following when I run phpunit in the \App\Tests\Unit directory:
Fatal error: Class 'Tonality' not found in C:\Program Files (x86)\EasyPHP-DevServer-14.1VC11\data\localweb\musibits\app\tests\TonalityTest.php on line 8
Tonality.php contains my class and is in the \App\Musibits directory
I read numerous posts about autoloading and bootstrap, but I can't seem to make it work :-(
Here is my composer.json
{
"name": "laravel/laravel",
"description": "The Laravel Framework.",
"keywords": ["framework", "laravel"],
"license": "MIT",
"require": {
"laravel/framework": "4.2.*"
},
"require-dev": {
"phpunit/phpunit": "3.7.*"
},
"autoload": {
"classmap": [
"app/commands",
"app/controllers",
"app/models",
"app/database/migrations",
"app/database/seeds",
"app/tests/TestCase.php",
"app/musibits",
"app/tests"
]
},
"scripts": {
"post-install-cmd": [
"php artisan clear-compiled",
"php artisan optimize"
],
"post-update-cmd": [
"php artisan clear-compiled",
"php artisan optimize"
],
"post-create-project-cmd": [
"php artisan key:generate"
]
},
"config": {
"preferred-install": "dist"
},
"minimum-stability": "stable"
}
There is three autoload files included with Laravel, one for composer, one for phpunit and one for Laravel, I didn't change any.
Any cues would be greatly appreciated.
Thanks,
Phil
Upvotes: 1
Views: 671
Reputation: 111839
You should probably run
composer dump-autoload
to generate new class map
Upvotes: 1