Skip to content

Commit

Permalink
Tweak factory test.
Browse files Browse the repository at this point in the history
  • Loading branch information
jaspertey committed Nov 14, 2024
1 parent b700cf0 commit e9fd489
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
4 changes: 0 additions & 4 deletions tests/Autoload/ProviderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,6 @@

describe('without autoload', function () {
it('does not register the provider', function ($binding) {
// setConfigValues([
// 'ddd.autoload.providers' => false,
// ]);

$this->afterApplicationRefreshed(function () {
app('ddd.autoloader')->boot();
});
Expand Down
14 changes: 10 additions & 4 deletions tests/Factory/DomainFactoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@
use Illuminate\Database\Eloquent\Factories\Factory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Facades\Artisan;
use Illuminate\Support\Facades\Config;
use Lunarstorm\LaravelDDD\Factories\DomainFactory;
use Lunarstorm\LaravelDDD\Tests\BootsTestApplication;

uses(BootsTestApplication::class);

it('can resolve the factory name of a domain model', function ($modelClass, $expectedFactoryClass) {
$this->setupTestApplication();
Expand All @@ -27,13 +29,17 @@
]);

it('can instantiate a domain model factory', function ($domainParameter, $modelName, $modelClass) {
$this->afterApplicationCreated(function () {
$this->setupTestApplication();

$this->afterApplicationRefreshed(function () {
app('ddd.autoloader')->boot();
});

$this->setupTestApplication();
$this->refreshApplicationWithConfig([
'ddd.base_model' => 'Lunarstorm\LaravelDDD\Models\DomainModel',
'ddd.autoload.factories' => true,
]);

Config::set('ddd.base_model', 'Lunarstorm\LaravelDDD\Models\DomainModel');
Artisan::call("ddd:model -f {$domainParameter}:{$modelName}");

expect(class_exists($modelClass))->toBeTrue();
Expand Down

0 comments on commit e9fd489

Please sign in to comment.