Laravel-Test-Helpers icon indicating copy to clipboard operation
Laravel-Test-Helpers copied to clipboard

Always throw Way\Tests\ModelNotFoundException when using Factory::create('Student') method

Open titopandub opened this issue 11 years ago • 1 comments

When I use

$student = Factory::create('Student');

It always throw Way\Tests\ModelNotFoundException. Here is the full error messages

[#] # /Users/titopandub/Projects/Web/laravel/vendor/way/laravel-test-helpers/src/Way/Tests/Factory.php:164 [#] # /Users/titopandub/Projects/Web/laravel/vendor/way/laravel-test-helpers/src/Way/Tests/Factory.php:122 [#] # /Users/titopandub/Projects/Web/laravel/vendor/way/laravel-test-helpers/src/Way/Tests/Factory.php:108 [#] # /Users/titopandub/Projects/Web/laravel/vendor/way/laravel-test-helpers/src/Way/Tests/Factory.php:73 [#] # /Users/titopandub/Projects/Web/laravel/vendor/way/laravel-test-helpers/src/Way/Tests/Factory.php:320 [#] # /Users/titopandub/Projects/Web/laravel/vendor/way/laravel-test-helpers/src/Way/Tests/Factory.php:223 [#] # /Users/titopandub/Projects/Web/laravel/vendor/way/laravel-test-helpers/src/Way/Tests/Factory.php:128 [#] # /Users/titopandub/Projects/Web/laravel/vendor/way/laravel-test-helpers/src/Way/Tests/Factory.php:108 [#] # /Users/titopandub/Projects/Web/laravel/vendor/way/laravel-test-helpers/src/Way/Tests/Factory.php:73 [#] # /Users/titopandub/Projects/Web/laravel/app/tests/models/StudentTest.php:71

But the other methods (Factory::make('Student') or Factory::student()) work fine.

titopandub avatar Jun 27 '13 02:06 titopandub

Hmm, that's odd. Haven't heard of that happening before. The only difference between those methods is that create() will save it to the database.

I'll take a look.

JeffreyWay avatar Jun 27 '13 15:06 JeffreyWay