我是Laravel和PhpUnit的新手,我试图在位于\ App \ Musibits目录中的海关类的\ App \ Tests \ Unit文件夹中运行一些测试。
当我在\ App \ Tests \ Unit目录中运行phpunit时,我得到以下内容:
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包含我的课程,位于\ App \ Musibits目录
我阅读了很多关于自动加载和引导程序的帖子,但我似乎无法使其发挥作用: - (
这是我的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"
}
Laravel附带了三个自动加载文件,一个用于作曲家,一个用于phpunit,另一个用于Laravel,我没有改变任何文件。
任何暗示都会非常感激。
谢谢,
菲尔
答案 0 :(得分:1)
您应该运行
composer dump-autoload
生成新的类映射