Skip to content

Commit

Permalink
Make tests work
Browse files Browse the repository at this point in the history
  • Loading branch information
hosni committed Jan 10, 2024
1 parent ccb1ea2 commit e14719a
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/Models/Type.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

namespace dnj\AAA\Models;

use dnj\AAA\Contracts\ITypeManager;
use dnj\AAA\Contracts\IType;
use dnj\AAA\Contracts\ITypeManager;
use dnj\AAA\Contracts\IUser;
use dnj\AAA\Database\Factories\TypeFactory;
use dnj\AAA\Models\Concerns\HasAbilities;
Expand Down
1 change: 1 addition & 0 deletions src/ServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ public function boot()
$this->integrateToGates();
$this->registerRoutes();
$this->registerPublishing();
$this->registerPolicies();
}

/**
Expand Down
15 changes: 15 additions & 0 deletions tests/TestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,10 @@
use dnj\AAA\Models\TypeTranslate;
use dnj\AAA\Models\User;
use dnj\AAA\Policy;
use dnj\AAA\ServiceProvider as AAAServiceProvider;
use dnj\AAA\TypeManager;
use dnj\AAA\UserManager;
use dnj\UserLogger\ServiceProvider as UserLoggerServiceProvider;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Illuminate\Support\Facades\App;
use Orchestra\Testbench\Concerns\WithWorkbench;
Expand Down Expand Up @@ -41,8 +43,21 @@ protected function createUserWithAbility(string $ability): IUser
return User::factory()->withType($myType)->create();
}

protected function defineDatabaseMigrations(): void
{
$this->loadMigrationsFrom(__DIR__.'/../database/migrations');
}

protected function createUserWithModelAbility(string $model, string $ability): IUser
{
return $this->createUserWithAbility(Policy::getModelAbilityName($model, $ability));
}

protected function getPackageProviders($app)
{
return [
AAAServiceProvider::class,
UserLoggerServiceProvider::class,
];
}
}

0 comments on commit e14719a

Please sign in to comment.