StydeNet / enlighten

Enlighten your APIs with auto-generated documentation
MIT License
574 stars 32 forks source link

[Error] Installation fails. #42

Closed mikebronner closed 3 years ago

mikebronner commented 3 years ago

Running php artisan enlighten:install fails with the following:

php artisan enlighten:install             
Copied Directory [/vendor/styde/enlighten/config] To [/config]
Copied Directory [/vendor/styde/enlighten/dist] To [/public/vendor/enlighten]
Copied File [/vendor/styde/enlighten/preview.png] To [/public/vendor/enlighten/img/preview.png]
Publishing complete.

   Illuminate\Contracts\Filesystem\FileNotFoundException 

  File does not exist at path /home/forge/lms.dev.genealabs.com/Tests/TestCase.php.

  at vendor/laravel/framework/src/Illuminate/Filesystem/Filesystem.php:57
     53▕         if ($this->isFile($path)) {
     54▕             return $lock ? $this->sharedGet($path) : file_get_contents($path);
     55▕         }
     56▕ 
  ➜  57▕         throw new FileNotFoundException("File does not exist at path {$path}.");
     58▕     }
     59▕ 
     60▕     /**
     61▕      * Get contents of a file with shared access.

      +16 vendor frames 
  17  artisan:37
      Illuminate\Foundation\Console\Kernel::handle()

The problem seems to be that the tests folder is expected to be capitalized. That is not normally the case in Laravel.

sileence commented 3 years ago

@mikebronner Hi! Thanks for reporting the issue. Please try again after updating to version 0.5.4 or later

mikebronner commented 3 years ago

hi @sileence , thanks for the quick response and turn-around! :) I'll go ahead and update and test and let you know in a minute. :)

mikebronner commented 3 years ago

The installation seemed to work for the most part:

php artisan enlighten:install       
Copied Directory [/vendor/styde/enlighten/config] To [/config]
Copied Directory [/vendor/styde/enlighten/dist] To [/public/vendor/enlighten]
Publishing complete.

The installer has detected changes in your TestCase class.
Please setup Enlighten manually with the link below:
https://github.com/StydeNet/enlighten#manual-setup

Please remember to create and setup the database for Enlighten and to change the APP_URL env variable if necessary.

After running your tests, you'll find your documentation by visiting: https://lms.dev.genealabs.com/enlighten

After updating the TestCase class as instructed, I now get the following errors when running tests:

phpunit             
PHPUnit 9.4.3 by Sebastian Bergmann and contributors.

.E

You should really speed up these slow tests (>500ms)...
 1. 2179ms to run Tests\Unit\Models\LoanTest:testEstimatedMonthlyPaymentsAmount

Time: 00:02.595, Memory: 38.00 MB

There was 1 error:

1) Tests\Unit\Models\LoanTest::testEstimatedWeeklyPaymentsAmount
Illuminate\Database\QueryException: SQLSTATE[23000]: Integrity constraint violation: 19 FOREIGN KEY constraint failed (SQL: insert into "enlighten_examples" ("group_id", "method_name", "line", "title", "slug", "description", "order_num", "test_status", "status", "updated_at", "created_at") values (1, testEstimatedWeeklyPaymentsAmount, 32, Estimated weekly payments amount, estimated-weekly-payments-amount, ?, 9999, unkown, unkown, 2020-11-18 20:01:28, 2020-11-18 20:01:28))

/home/forge/lms.dev.genealabs.com/vendor/laravel/framework/src/Illuminate/Database/Connection.php:671
/home/forge/lms.dev.genealabs.com/vendor/laravel/framework/src/Illuminate/Database/Connection.php:631
/home/forge/lms.dev.genealabs.com/vendor/laravel/framework/src/Illuminate/Database/Connection.php:465
/home/forge/lms.dev.genealabs.com/vendor/laravel/framework/src/Illuminate/Database/Connection.php:417
/home/forge/lms.dev.genealabs.com/vendor/laravel/framework/src/Illuminate/Database/Query/Processors/Processor.php:32
/home/forge/lms.dev.genealabs.com/vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php:2872
/home/forge/lms.dev.genealabs.com/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Builder.php:1508
/home/forge/lms.dev.genealabs.com/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Model.php:1051
/home/forge/lms.dev.genealabs.com/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Model.php:1016
/home/forge/lms.dev.genealabs.com/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Model.php:857
/home/forge/lms.dev.genealabs.com/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Builder.php:464
/home/forge/lms.dev.genealabs.com/vendor/laravel/framework/src/Illuminate/Support/helpers.php:263
/home/forge/lms.dev.genealabs.com/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Builder.php:465
/home/forge/lms.dev.genealabs.com/vendor/laravel/framework/src/Illuminate/Support/Traits/ForwardsCalls.php:23
/home/forge/lms.dev.genealabs.com/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Model.php:1884
/home/forge/lms.dev.genealabs.com/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Model.php:1896
/home/forge/lms.dev.genealabs.com/vendor/styde/enlighten/src/ExampleBuilder.php:67
/home/forge/lms.dev.genealabs.com/vendor/styde/enlighten/src/ExampleBuilder.php:131
/home/forge/lms.dev.genealabs.com/vendor/styde/enlighten/src/ExampleCreator.php:101
/home/forge/lms.dev.genealabs.com/vendor/styde/enlighten/src/Tests/EnlightenSetup.php:82
/home/forge/lms.dev.genealabs.com/vendor/laravel/framework/src/Illuminate/Events/Dispatcher.php:391
/home/forge/lms.dev.genealabs.com/vendor/laravel/framework/src/Illuminate/Events/Dispatcher.php:236
/home/forge/lms.dev.genealabs.com/vendor/laravel/framework/src/Illuminate/Database/Connection.php:835
/home/forge/lms.dev.genealabs.com/vendor/laravel/framework/src/Illuminate/Database/Connection.php:689
/home/forge/lms.dev.genealabs.com/vendor/laravel/framework/src/Illuminate/Database/Connection.php:642
/home/forge/lms.dev.genealabs.com/vendor/laravel/framework/src/Illuminate/Database/Connection.php:339
/home/forge/lms.dev.genealabs.com/vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php:2303
/home/forge/lms.dev.genealabs.com/vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php:2291
/home/forge/lms.dev.genealabs.com/vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php:2786
/home/forge/lms.dev.genealabs.com/vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php:2292
/home/forge/lms.dev.genealabs.com/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Builder.php:549
/home/forge/lms.dev.genealabs.com/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Builder.php:533
/home/forge/lms.dev.genealabs.com/vendor/laravel/framework/src/Illuminate/Database/Concerns/BuildsQueries.php:147
/home/forge/lms.dev.genealabs.com/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Builder.php:445
/home/forge/lms.dev.genealabs.com/vendor/laravel/framework/src/Illuminate/Support/Traits/ForwardsCalls.php:23
/home/forge/lms.dev.genealabs.com/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Model.php:1884
/home/forge/lms.dev.genealabs.com/database/seeders/LookupDataSeeder.php:12
/home/forge/lms.dev.genealabs.com/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php:36
/home/forge/lms.dev.genealabs.com/vendor/laravel/framework/src/Illuminate/Container/Util.php:40
/home/forge/lms.dev.genealabs.com/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php:93
/home/forge/lms.dev.genealabs.com/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php:37
/home/forge/lms.dev.genealabs.com/vendor/laravel/framework/src/Illuminate/Container/Container.php:610
/home/forge/lms.dev.genealabs.com/vendor/laravel/framework/src/Illuminate/Database/Seeder.php:149
/home/forge/lms.dev.genealabs.com/vendor/laravel/framework/src/Illuminate/Database/Seeder.php:49
/home/forge/lms.dev.genealabs.com/database/seeders/DatabaseSeeder.php:11
/home/forge/lms.dev.genealabs.com/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php:36
/home/forge/lms.dev.genealabs.com/vendor/laravel/framework/src/Illuminate/Container/Util.php:40
/home/forge/lms.dev.genealabs.com/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php:93
/home/forge/lms.dev.genealabs.com/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php:37
/home/forge/lms.dev.genealabs.com/vendor/laravel/framework/src/Illuminate/Container/Container.php:610
/home/forge/lms.dev.genealabs.com/vendor/laravel/framework/src/Illuminate/Database/Seeder.php:149
/home/forge/lms.dev.genealabs.com/vendor/laravel/framework/src/Illuminate/Database/Console/Seeds/SeedCommand.php:65
/home/forge/lms.dev.genealabs.com/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Concerns/GuardsAttributes.php:157
/home/forge/lms.dev.genealabs.com/vendor/laravel/framework/src/Illuminate/Database/Console/Seeds/SeedCommand.php:66
/home/forge/lms.dev.genealabs.com/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php:36
/home/forge/lms.dev.genealabs.com/vendor/laravel/framework/src/Illuminate/Container/Util.php:40
/home/forge/lms.dev.genealabs.com/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php:93
/home/forge/lms.dev.genealabs.com/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php:37
/home/forge/lms.dev.genealabs.com/vendor/laravel/framework/src/Illuminate/Container/Container.php:610
/home/forge/lms.dev.genealabs.com/vendor/laravel/framework/src/Illuminate/Console/Command.php:136
/home/forge/lms.dev.genealabs.com/vendor/symfony/console/Command/Command.php:258
/home/forge/lms.dev.genealabs.com/vendor/laravel/framework/src/Illuminate/Console/Command.php:121
/home/forge/lms.dev.genealabs.com/vendor/symfony/console/Application.php:920
/home/forge/lms.dev.genealabs.com/vendor/symfony/console/Application.php:266
/home/forge/lms.dev.genealabs.com/vendor/symfony/console/Application.php:142
/home/forge/lms.dev.genealabs.com/vendor/laravel/framework/src/Illuminate/Console/Application.php:93
/home/forge/lms.dev.genealabs.com/vendor/laravel/framework/src/Illuminate/Console/Application.php:185
/home/forge/lms.dev.genealabs.com/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php:263
/home/forge/lms.dev.genealabs.com/vendor/laravel/framework/src/Illuminate/Testing/PendingCommand.php:207
/home/forge/lms.dev.genealabs.com/vendor/laravel/framework/src/Illuminate/Testing/PendingCommand.php:390
/home/forge/lms.dev.genealabs.com/vendor/laravel/framework/src/Illuminate/Foundation/Testing/Concerns/InteractsWithConsole.php:66
/home/forge/lms.dev.genealabs.com/vendor/laravel/framework/src/Illuminate/Foundation/Testing/Concerns/InteractsWithDatabase.php:164
/home/forge/lms.dev.genealabs.com/tests/TestCase.php:34

Caused by
Doctrine\DBAL\Driver\PDO\Exception: SQLSTATE[23000]: Integrity constraint violation: 19 FOREIGN KEY constraint failed

/home/forge/lms.dev.genealabs.com/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDO/Exception.php:18
/home/forge/lms.dev.genealabs.com/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOStatement.php:117
/home/forge/lms.dev.genealabs.com/vendor/laravel/framework/src/Illuminate/Database/Connection.php:464
/home/forge/lms.dev.genealabs.com/vendor/laravel/framework/src/Illuminate/Database/Connection.php:664
/home/forge/lms.dev.genealabs.com/vendor/laravel/framework/src/Illuminate/Database/Connection.php:631
/home/forge/lms.dev.genealabs.com/vendor/laravel/framework/src/Illuminate/Database/Connection.php:465
/home/forge/lms.dev.genealabs.com/vendor/laravel/framework/src/Illuminate/Database/Connection.php:417
/home/forge/lms.dev.genealabs.com/vendor/laravel/framework/src/Illuminate/Database/Query/Processors/Processor.php:32
/home/forge/lms.dev.genealabs.com/vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php:2872
/home/forge/lms.dev.genealabs.com/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Builder.php:1508
/home/forge/lms.dev.genealabs.com/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Model.php:1051
/home/forge/lms.dev.genealabs.com/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Model.php:1016
/home/forge/lms.dev.genealabs.com/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Model.php:857
/home/forge/lms.dev.genealabs.com/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Builder.php:464
/home/forge/lms.dev.genealabs.com/vendor/laravel/framework/src/Illuminate/Support/helpers.php:263
/home/forge/lms.dev.genealabs.com/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Builder.php:465
/home/forge/lms.dev.genealabs.com/vendor/laravel/framework/src/Illuminate/Support/Traits/ForwardsCalls.php:23
/home/forge/lms.dev.genealabs.com/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Model.php:1884
/home/forge/lms.dev.genealabs.com/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Model.php:1896
/home/forge/lms.dev.genealabs.com/vendor/styde/enlighten/src/ExampleBuilder.php:67
/home/forge/lms.dev.genealabs.com/vendor/styde/enlighten/src/ExampleBuilder.php:131
/home/forge/lms.dev.genealabs.com/vendor/styde/enlighten/src/ExampleCreator.php:101
/home/forge/lms.dev.genealabs.com/vendor/styde/enlighten/src/Tests/EnlightenSetup.php:82
/home/forge/lms.dev.genealabs.com/vendor/laravel/framework/src/Illuminate/Events/Dispatcher.php:391
/home/forge/lms.dev.genealabs.com/vendor/laravel/framework/src/Illuminate/Events/Dispatcher.php:236
/home/forge/lms.dev.genealabs.com/vendor/laravel/framework/src/Illuminate/Database/Connection.php:835
/home/forge/lms.dev.genealabs.com/vendor/laravel/framework/src/Illuminate/Database/Connection.php:689
/home/forge/lms.dev.genealabs.com/vendor/laravel/framework/src/Illuminate/Database/Connection.php:642
/home/forge/lms.dev.genealabs.com/vendor/laravel/framework/src/Illuminate/Database/Connection.php:339
/home/forge/lms.dev.genealabs.com/vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php:2303
/home/forge/lms.dev.genealabs.com/vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php:2291
/home/forge/lms.dev.genealabs.com/vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php:2786
/home/forge/lms.dev.genealabs.com/vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php:2292
/home/forge/lms.dev.genealabs.com/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Builder.php:549
/home/forge/lms.dev.genealabs.com/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Builder.php:533
/home/forge/lms.dev.genealabs.com/vendor/laravel/framework/src/Illuminate/Database/Concerns/BuildsQueries.php:147
/home/forge/lms.dev.genealabs.com/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Builder.php:445
/home/forge/lms.dev.genealabs.com/vendor/laravel/framework/src/Illuminate/Support/Traits/ForwardsCalls.php:23
/home/forge/lms.dev.genealabs.com/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Model.php:1884
/home/forge/lms.dev.genealabs.com/database/seeders/LookupDataSeeder.php:12
/home/forge/lms.dev.genealabs.com/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php:36
/home/forge/lms.dev.genealabs.com/vendor/laravel/framework/src/Illuminate/Container/Util.php:40
/home/forge/lms.dev.genealabs.com/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php:93
/home/forge/lms.dev.genealabs.com/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php:37
/home/forge/lms.dev.genealabs.com/vendor/laravel/framework/src/Illuminate/Container/Container.php:610
/home/forge/lms.dev.genealabs.com/vendor/laravel/framework/src/Illuminate/Database/Seeder.php:149
/home/forge/lms.dev.genealabs.com/vendor/laravel/framework/src/Illuminate/Database/Seeder.php:49
/home/forge/lms.dev.genealabs.com/database/seeders/DatabaseSeeder.php:11
/home/forge/lms.dev.genealabs.com/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php:36
/home/forge/lms.dev.genealabs.com/vendor/laravel/framework/src/Illuminate/Container/Util.php:40
/home/forge/lms.dev.genealabs.com/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php:93
/home/forge/lms.dev.genealabs.com/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php:37
/home/forge/lms.dev.genealabs.com/vendor/laravel/framework/src/Illuminate/Container/Container.php:610
/home/forge/lms.dev.genealabs.com/vendor/laravel/framework/src/Illuminate/Database/Seeder.php:149
/home/forge/lms.dev.genealabs.com/vendor/laravel/framework/src/Illuminate/Database/Console/Seeds/SeedCommand.php:65
/home/forge/lms.dev.genealabs.com/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Concerns/GuardsAttributes.php:157
/home/forge/lms.dev.genealabs.com/vendor/laravel/framework/src/Illuminate/Database/Console/Seeds/SeedCommand.php:66
/home/forge/lms.dev.genealabs.com/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php:36
/home/forge/lms.dev.genealabs.com/vendor/laravel/framework/src/Illuminate/Container/Util.php:40
/home/forge/lms.dev.genealabs.com/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php:93
/home/forge/lms.dev.genealabs.com/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php:37
/home/forge/lms.dev.genealabs.com/vendor/laravel/framework/src/Illuminate/Container/Container.php:610
/home/forge/lms.dev.genealabs.com/vendor/laravel/framework/src/Illuminate/Console/Command.php:136
/home/forge/lms.dev.genealabs.com/vendor/symfony/console/Command/Command.php:258
/home/forge/lms.dev.genealabs.com/vendor/laravel/framework/src/Illuminate/Console/Command.php:121
/home/forge/lms.dev.genealabs.com/vendor/symfony/console/Application.php:920
/home/forge/lms.dev.genealabs.com/vendor/symfony/console/Application.php:266
/home/forge/lms.dev.genealabs.com/vendor/symfony/console/Application.php:142
/home/forge/lms.dev.genealabs.com/vendor/laravel/framework/src/Illuminate/Console/Application.php:93
/home/forge/lms.dev.genealabs.com/vendor/laravel/framework/src/Illuminate/Console/Application.php:185
/home/forge/lms.dev.genealabs.com/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php:263
/home/forge/lms.dev.genealabs.com/vendor/laravel/framework/src/Illuminate/Testing/PendingCommand.php:207
/home/forge/lms.dev.genealabs.com/vendor/laravel/framework/src/Illuminate/Testing/PendingCommand.php:390
/home/forge/lms.dev.genealabs.com/vendor/laravel/framework/src/Illuminate/Foundation/Testing/Concerns/InteractsWithConsole.php:66
/home/forge/lms.dev.genealabs.com/vendor/laravel/framework/src/Illuminate/Foundation/Testing/Concerns/InteractsWithDatabase.php:164
/home/forge/lms.dev.genealabs.com/tests/TestCase.php:34

Caused by
PDOException: SQLSTATE[23000]: Integrity constraint violation: 19 FOREIGN KEY constraint failed

/home/forge/lms.dev.genealabs.com/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOStatement.php:115
/home/forge/lms.dev.genealabs.com/vendor/laravel/framework/src/Illuminate/Database/Connection.php:464
/home/forge/lms.dev.genealabs.com/vendor/laravel/framework/src/Illuminate/Database/Connection.php:664
/home/forge/lms.dev.genealabs.com/vendor/laravel/framework/src/Illuminate/Database/Connection.php:631
/home/forge/lms.dev.genealabs.com/vendor/laravel/framework/src/Illuminate/Database/Connection.php:465
/home/forge/lms.dev.genealabs.com/vendor/laravel/framework/src/Illuminate/Database/Connection.php:417
/home/forge/lms.dev.genealabs.com/vendor/laravel/framework/src/Illuminate/Database/Query/Processors/Processor.php:32
/home/forge/lms.dev.genealabs.com/vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php:2872
/home/forge/lms.dev.genealabs.com/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Builder.php:1508
/home/forge/lms.dev.genealabs.com/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Model.php:1051
/home/forge/lms.dev.genealabs.com/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Model.php:1016
/home/forge/lms.dev.genealabs.com/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Model.php:857
/home/forge/lms.dev.genealabs.com/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Builder.php:464
/home/forge/lms.dev.genealabs.com/vendor/laravel/framework/src/Illuminate/Support/helpers.php:263
/home/forge/lms.dev.genealabs.com/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Builder.php:465
/home/forge/lms.dev.genealabs.com/vendor/laravel/framework/src/Illuminate/Support/Traits/ForwardsCalls.php:23
/home/forge/lms.dev.genealabs.com/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Model.php:1884
/home/forge/lms.dev.genealabs.com/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Model.php:1896
/home/forge/lms.dev.genealabs.com/vendor/styde/enlighten/src/ExampleBuilder.php:67
/home/forge/lms.dev.genealabs.com/vendor/styde/enlighten/src/ExampleBuilder.php:131
/home/forge/lms.dev.genealabs.com/vendor/styde/enlighten/src/ExampleCreator.php:101
/home/forge/lms.dev.genealabs.com/vendor/styde/enlighten/src/Tests/EnlightenSetup.php:82
/home/forge/lms.dev.genealabs.com/vendor/laravel/framework/src/Illuminate/Events/Dispatcher.php:391
/home/forge/lms.dev.genealabs.com/vendor/laravel/framework/src/Illuminate/Events/Dispatcher.php:236
/home/forge/lms.dev.genealabs.com/vendor/laravel/framework/src/Illuminate/Database/Connection.php:835
/home/forge/lms.dev.genealabs.com/vendor/laravel/framework/src/Illuminate/Database/Connection.php:689
/home/forge/lms.dev.genealabs.com/vendor/laravel/framework/src/Illuminate/Database/Connection.php:642
/home/forge/lms.dev.genealabs.com/vendor/laravel/framework/src/Illuminate/Database/Connection.php:339
/home/forge/lms.dev.genealabs.com/vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php:2303
/home/forge/lms.dev.genealabs.com/vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php:2291
/home/forge/lms.dev.genealabs.com/vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php:2786
/home/forge/lms.dev.genealabs.com/vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php:2292
/home/forge/lms.dev.genealabs.com/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Builder.php:549
/home/forge/lms.dev.genealabs.com/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Builder.php:533
/home/forge/lms.dev.genealabs.com/vendor/laravel/framework/src/Illuminate/Database/Concerns/BuildsQueries.php:147
/home/forge/lms.dev.genealabs.com/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Builder.php:445
/home/forge/lms.dev.genealabs.com/vendor/laravel/framework/src/Illuminate/Support/Traits/ForwardsCalls.php:23
/home/forge/lms.dev.genealabs.com/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Model.php:1884
/home/forge/lms.dev.genealabs.com/database/seeders/LookupDataSeeder.php:12
/home/forge/lms.dev.genealabs.com/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php:36
/home/forge/lms.dev.genealabs.com/vendor/laravel/framework/src/Illuminate/Container/Util.php:40
/home/forge/lms.dev.genealabs.com/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php:93
/home/forge/lms.dev.genealabs.com/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php:37
/home/forge/lms.dev.genealabs.com/vendor/laravel/framework/src/Illuminate/Container/Container.php:610
/home/forge/lms.dev.genealabs.com/vendor/laravel/framework/src/Illuminate/Database/Seeder.php:149
/home/forge/lms.dev.genealabs.com/vendor/laravel/framework/src/Illuminate/Database/Seeder.php:49
/home/forge/lms.dev.genealabs.com/database/seeders/DatabaseSeeder.php:11
/home/forge/lms.dev.genealabs.com/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php:36
/home/forge/lms.dev.genealabs.com/vendor/laravel/framework/src/Illuminate/Container/Util.php:40
/home/forge/lms.dev.genealabs.com/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php:93
/home/forge/lms.dev.genealabs.com/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php:37
/home/forge/lms.dev.genealabs.com/vendor/laravel/framework/src/Illuminate/Container/Container.php:610
/home/forge/lms.dev.genealabs.com/vendor/laravel/framework/src/Illuminate/Database/Seeder.php:149
/home/forge/lms.dev.genealabs.com/vendor/laravel/framework/src/Illuminate/Database/Console/Seeds/SeedCommand.php:65
/home/forge/lms.dev.genealabs.com/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Concerns/GuardsAttributes.php:157
/home/forge/lms.dev.genealabs.com/vendor/laravel/framework/src/Illuminate/Database/Console/Seeds/SeedCommand.php:66
/home/forge/lms.dev.genealabs.com/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php:36
/home/forge/lms.dev.genealabs.com/vendor/laravel/framework/src/Illuminate/Container/Util.php:40
/home/forge/lms.dev.genealabs.com/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php:93
/home/forge/lms.dev.genealabs.com/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php:37
/home/forge/lms.dev.genealabs.com/vendor/laravel/framework/src/Illuminate/Container/Container.php:610
/home/forge/lms.dev.genealabs.com/vendor/laravel/framework/src/Illuminate/Console/Command.php:136
/home/forge/lms.dev.genealabs.com/vendor/symfony/console/Command/Command.php:258
/home/forge/lms.dev.genealabs.com/vendor/laravel/framework/src/Illuminate/Console/Command.php:121
/home/forge/lms.dev.genealabs.com/vendor/symfony/console/Application.php:920
/home/forge/lms.dev.genealabs.com/vendor/symfony/console/Application.php:266
/home/forge/lms.dev.genealabs.com/vendor/symfony/console/Application.php:142
/home/forge/lms.dev.genealabs.com/vendor/laravel/framework/src/Illuminate/Console/Application.php:93
/home/forge/lms.dev.genealabs.com/vendor/laravel/framework/src/Illuminate/Console/Application.php:185
/home/forge/lms.dev.genealabs.com/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php:263
/home/forge/lms.dev.genealabs.com/vendor/laravel/framework/src/Illuminate/Testing/PendingCommand.php:207
/home/forge/lms.dev.genealabs.com/vendor/laravel/framework/src/Illuminate/Testing/PendingCommand.php:390
/home/forge/lms.dev.genealabs.com/vendor/laravel/framework/src/Illuminate/Foundation/Testing/Concerns/InteractsWithConsole.php:66
/home/forge/lms.dev.genealabs.com/vendor/laravel/framework/src/Illuminate/Foundation/Testing/Concerns/InteractsWithDatabase.php:164
/home/forge/lms.dev.genealabs.com/tests/TestCase.php:34

I did create a separate database called totality_enlighten and it has the tables in it, so it appears they migrated correctly.

jeffochoa commented 3 years ago

@mikebronner please trying publishing the migrations:

  1. rm -r database/migrations/enlighten
  2. php artisan vendor:publish --tag=enlighten-migrations
  3. php artisan enlighten:migrate:fresh

And then run your tests again.

Let me know if that works.

Cheers, Jeff.

mikebronner commented 3 years ago

@jeffochoa Thanks, unfortunately still getting the same error after that.

sileence commented 3 years ago

@mikebronner hi! If you have modified your TestCase.php file previously, Enlighten won't override it! If you haven't then there might be something else for us to fix. (maybe a mismatch in EOL or something like that).

Regarding the migrations: please truncate all the Enlighten tables info and try again running only one test method or test methods from another class to try to narrow the error down.

Enlighten might fail if 2 test classes or test methods have very similar names (like "testExample" and "test_example"), but that doesn't seem to be the case.

mikebronner commented 3 years ago

Hi @sileence, thanks for the follow-up again. I have manually updated the TestCase class according to the README.

Oddly enough, running each test method individually is not a problem. The issue seems to be when running all tests at once.

Here's my TestCase class, it seems to be throwing exceptions when trying to seed the second time around.

<?php

namespace Tests;

use App\Models\User;
use Database\Factories\EmployeeFactory;
use Database\Factories\UserFactory;
use Illuminate\Foundation\Mix;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Illuminate\Foundation\Testing\TestCase as BaseTestCase;
use Styde\Enlighten\Tests\EnlightenSetup;

abstract class TestCase extends BaseTestCase
{
    use CreatesApplication;
    use EnlightenSetup;
    use RefreshDatabase;

    protected User $user;

    protected function setUp(): void
    {
        parent::setUp();

        $this->setUpEnlighten();

        // Swap out the Mix manifest implementation, so we don't need
        // to run the npm commands to generate a manifest file for
        // the assets in order to run tests that return views.
        $this->swap(Mix::class, function () {
            return '';
        });

        $this->seed();
        $this->user = (new UserFactory)->create();
        (new EmployeeFactory)->create([
            "user_id" => $this->user->getKey(),
        ]);
    }
}
mikebronner commented 3 years ago

OK, found the issue: by manually adding the enlighten entry in config/database.php the tests completed successfully.

sileence commented 3 years ago

@mikebronner awesome! Enlighten will respect any changes to your TestCase if it has been modified before, but if you install Enlighten just after starting a new project, it should replace the TestCase with a new one.

Re the database, were you using sqlite? Maybe that was the problem, but I'm glad it's fixed now! I hope you enjoy our component 😊