forked from apiato/apiato
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
162f711
commit 7b4c2ea
Showing
3 changed files
with
157 additions
and
0 deletions.
There are no files selected for viewing
95 changes: 95 additions & 0 deletions
95
app/Containers/AppSection/Authorization/Tests/Unit/PermissionMigrationTest.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
<?php | ||
|
||
namespace App\Containers\AppSection\Authorization\Tests\Unit; | ||
|
||
use App\Containers\AppSection\Authorization\Tests\TestCase; | ||
use Illuminate\Support\Facades\Schema; | ||
|
||
/** | ||
* Class PermissionMigrationTest. | ||
* | ||
* @group authorization | ||
* @group unit | ||
*/ | ||
class PermissionMigrationTest extends TestCase | ||
{ | ||
private array $tableNames; | ||
private array $columnNames; | ||
|
||
protected function setUp(): void | ||
{ | ||
parent::setUp(); | ||
$this->tableNames = config('permission.table_names'); | ||
$this->columnNames = config('permission.column_names'); | ||
} | ||
|
||
public function test_permissions_table_has_expected_columns(): void | ||
{ | ||
$columns = [ | ||
'id', | ||
'name', | ||
'guard_name', | ||
'display_name', | ||
'description', | ||
]; | ||
|
||
foreach ($columns as $column) { | ||
$this->assertTrue(Schema::hasColumn($this->tableNames['permissions'], $column)); | ||
} | ||
} | ||
|
||
public function test_roles_table_has_expected_columns(): void | ||
{ | ||
$columns = [ | ||
'id', | ||
'name', | ||
'guard_name', | ||
'display_name', | ||
'description', | ||
'created_at', | ||
'updated_at', | ||
]; | ||
|
||
foreach ($columns as $column) { | ||
$this->assertTrue(Schema::hasColumn($this->tableNames['roles'], $column)); | ||
} | ||
} | ||
|
||
public function test_model_has_permissions_table_has_expected_columns(): void | ||
{ | ||
$columns = [ | ||
'permission_id', | ||
'model_type', | ||
$this->columnNames['model_morph_key'], | ||
]; | ||
|
||
foreach ($columns as $column) { | ||
$this->assertTrue(Schema::hasColumn($this->tableNames['model_has_permissions'], $column)); | ||
} | ||
} | ||
|
||
public function test_model_has_roles_table_has_expected_columns(): void | ||
{ | ||
$columns = [ | ||
'role_id', | ||
'model_type', | ||
$this->columnNames['model_morph_key'], | ||
]; | ||
|
||
foreach ($columns as $column) { | ||
$this->assertTrue(Schema::hasColumn($this->tableNames['model_has_roles'], $column)); | ||
} | ||
} | ||
|
||
public function test_role_has_permissions_table_has_expected_columns(): void | ||
{ | ||
$columns = [ | ||
'permission_id', | ||
'role_id', | ||
]; | ||
|
||
foreach ($columns as $column) { | ||
$this->assertTrue(Schema::hasColumn($this->tableNames['role_has_permissions'], $column)); | ||
} | ||
} | ||
} |
28 changes: 28 additions & 0 deletions
28
app/Containers/AppSection/User/Tests/Unit/PasswordResetsMigrationTest.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<?php | ||
|
||
namespace App\Containers\AppSection\User\Tests\Unit; | ||
|
||
use App\Containers\AppSection\User\Tests\TestCase; | ||
use Illuminate\Support\Facades\Schema; | ||
|
||
/** | ||
* Class PasswordResetsMigrationTest. | ||
* | ||
* @group user | ||
* @group unit | ||
*/ | ||
class PasswordResetsMigrationTest extends TestCase | ||
{ | ||
public function test_password_resets_table_has_expected_columns(): void | ||
{ | ||
$columns = [ | ||
'email', | ||
'token', | ||
'created_at', | ||
]; | ||
|
||
foreach ($columns as $column) { | ||
$this->assertTrue(Schema::hasColumn('password_resets', $column)); | ||
} | ||
} | ||
} |
34 changes: 34 additions & 0 deletions
34
app/Containers/AppSection/User/Tests/Unit/UsersMigrationTest.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
<?php | ||
|
||
namespace App\Containers\AppSection\User\Tests\Unit; | ||
|
||
use App\Containers\AppSection\User\Tests\TestCase; | ||
use Illuminate\Support\Facades\Schema; | ||
|
||
/** | ||
* Class UsersMigrationTest. | ||
* | ||
* @group user | ||
* @group unit | ||
*/ | ||
class UsersMigrationTest extends TestCase | ||
{ | ||
public function test_users_table_has_expected_columns(): void | ||
{ | ||
$columns = [ | ||
'id', | ||
'name', | ||
'email', | ||
'password', | ||
'email_verified_at', | ||
'gender', | ||
'remember_token', | ||
'created_at', | ||
'updated_at', | ||
]; | ||
|
||
foreach ($columns as $column) { | ||
$this->assertTrue(Schema::hasColumn('users', $column)); | ||
} | ||
} | ||
} |