我的工厂目录(database\factories\FactoryHelpers.php
)
<?php
class FactoryHelpers
{
...
}
现在我尝试在我的测试中使用它,并获得class FactoryHelpers not found
我以为放
"classmap": [
"database/factories"
],
在我的作曲家文件中应该足以使FactoryHelpers类全局可用。
编辑:
composer.json
{
"name": "laravel/laravel",
"description": "The Laravel Framework.",
"keywords": ["framework", "laravel"],
"license": "MIT",
"type": "project",
"require": {
"php": ">=7.0.0",
"barryvdh/laravel-cors": "^0.9.3",
"fideloper/proxy": "~3.3",
"guzzlehttp/guzzle": "^6.0",
"laravel/framework": "5.5.*",
"laravel/tinker": "~1.0",
"webpatser/laravel-uuid": "^3.0"
},
"require-dev": {
"barryvdh/laravel-ide-helper": "v2.4.1",
"codeception/codeception": "^2.3",
"doctrine/dbal": "^2.6",
"filp/whoops": "~2.0",
"fzaninotto/faker": "~1.4",
"krlove/eloquent-model-generator": "^1.2",
"mockery/mockery": "0.9.*",
"mpociot/laravel-test-factory-helper": "^0.5.0",
"phpunit/phpunit": "~6.0"
},
"autoload": {
"classmap": [
"database/seeds",
"database/factories"
],
"psr-4": {
"App\\": "app/"
}
},
"autoload-dev": {
"psr-4": {
"Tests\\": "tests/"
}
},
"extra": {
"laravel": {
"dont-discover": [
]
}
},
"scripts": {
"post-root-package-install": [
"@php -r \"file_exists('.env') || copy('.env.example', '.env');\""
],
"post-create-project-cmd": [
"@php artisan key:generate"
],
"post-autoload-dump": [
"Illuminate\\Foundation\\ComposerScripts::postAutoloadDump",
"@php artisan package:discover"
]
},
"config": {
"preferred-install": "dist",
"sort-packages": true,
"optimize-autoloader": true
}
}