Skip to content

Commit

Permalink
[ADD] easy_panel.database.panel_admin_table and `easy_panel.databas…
Browse files Browse the repository at this point in the history
…e.crud_table` into test initial
  • Loading branch information
moaminsharifi committed Feb 11, 2024
1 parent 0dde686 commit 472f3c7
Showing 1 changed file with 27 additions and 21 deletions.
48 changes: 27 additions & 21 deletions tests/TestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,13 @@

namespace EasyPanelTest;

use App\Models\Article;
use EasyPanel\EasyPanelServiceProvider;
use EasyPanel\Parsers\StubParser;
use EasyPanelTest\Dependencies\User;
use Faker\Factory;
use Illuminate\Database\Eloquent\Collection;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Facades\Hash;
use Iya30n\DynamicAcl\Providers\DynamicAclServiceProvider;
use Javoscript\MacroableModels\MacroableModelsServiceProvider;
Expand All @@ -15,7 +18,7 @@ abstract class TestCase extends \Orchestra\Testbench\TestCase
{

/**
* @var \Illuminate\Database\Eloquent\Collection|\Illuminate\Database\Eloquent\Model
* @var Collection|Model
*/
protected $user;

Expand All @@ -24,26 +27,28 @@ abstract class TestCase extends \Orchestra\Testbench\TestCase
*/
protected $parser;

public function getAdmin()
{
$this->user->panelAdmin()->create([
'is_superuser' => true
]);

return $this->user->refresh();
}

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

$this->loadMigrationsFrom(__DIR__.'/Dependencies/database/migrations');
$this->loadMigrationsFrom(__DIR__.'/../vendor/iya30n/dynamic-acl/database/migrations');
$this->loadMigrationsFrom(__DIR__ . '/Dependencies/database/migrations');
$this->loadMigrationsFrom(__DIR__ . '/../vendor/iya30n/dynamic-acl/database/migrations');
$this->setUser();
$this->setParser();

config()->set('easy_panel.user_model', User::class);
}
config()->set('easy_panel.database.panel_admin_table', 'panel_admins');
config()->set('easy_panel.database.crud_table', 'cruds');

protected function getPackageProviders($app)
{
return [
EasyPanelServiceProvider::class,
LivewireServiceProvider::class,
MacroableModelsServiceProvider::class,
DynamicAclServiceProvider::class,
];
}

protected function setUser()
Expand All @@ -53,17 +58,18 @@ protected function setUser()
$this->user = $user;
}

public function getAdmin()
private function setParser()
{
$this->user->panelAdmin()->create([
'is_superuser' => true
]);

return $this->user->refresh();
$this->parser = new StubParser('article', Article::class);
}

private function setParser()
protected function getPackageProviders($app)
{
$this->parser = new StubParser('article', \App\Models\Article::class);
return [
EasyPanelServiceProvider::class,
LivewireServiceProvider::class,
MacroableModelsServiceProvider::class,
DynamicAclServiceProvider::class,
];
}
}

0 comments on commit 472f3c7

Please sign in to comment.