InfyOmLabs / laravel-generator

API and Admin Panel CRUD Generator for Laravel.
https://www.infyom.com/open-source
MIT License
3.78k stars 802 forks source link

Generated tests to use the Tests Namespace #516

Closed morrismukiri closed 5 years ago

morrismukiri commented 6 years ago

I get a PHP Fatal error: Class 'TestCase' not found in error on a newly created API and Repository test generated by api_scaffold

The TestCase class and the trait CreatesApplication are in the namespace Tests.

My autoload-dev looks like this:

"autoload-dev": {
        "psr-4": {
            "Tests\\": "tests/"
        },
        "classmap": [
            "tests/TestCase.php",
            "tests/ApiTestTrait.php",
            "tests/traits"
        ]
    },
mitulgolakiya commented 5 years ago

After this fix, few paths are changed, so anyone who wants to fix this will need to delete config/infyom/laravel_generator.php and run php artisan vendor:publish command to publish a new file.

If you have modified config file then take a back of that file first, then apply those changes again to config/infyom/laravel_generator.php