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
7b4c2ea
commit de9f0d1
Showing
3 changed files
with
62 additions
and
0 deletions.
There are no files selected for viewing
22 changes: 22 additions & 0 deletions
22
app/Containers/AppSection/Authorization/Tests/Unit/PermissionFactoryTest.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,22 @@ | ||
<?php | ||
|
||
namespace App\Containers\AppSection\Authorization\Tests\Unit; | ||
|
||
use App\Containers\AppSection\Authorization\Models\Permission; | ||
use App\Containers\AppSection\Authorization\Tests\TestCase; | ||
|
||
/** | ||
* Class PermissionFactoryTest. | ||
* | ||
* @group authorization | ||
* @group unit | ||
*/ | ||
class PermissionFactoryTest extends TestCase | ||
{ | ||
public function testCreatePermission(): void | ||
{ | ||
$permission = Permission::factory()->create(); | ||
|
||
$this->assertInstanceOf(Permission::class, $permission); | ||
} | ||
} |
33 changes: 33 additions & 0 deletions
33
app/Containers/AppSection/Authorization/Tests/Unit/RoleFactoryTest.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,33 @@ | ||
<?php | ||
|
||
namespace App\Containers\AppSection\Authorization\Tests\Unit; | ||
|
||
use App\Containers\AppSection\Authorization\Models\Role; | ||
use App\Containers\AppSection\Authorization\Tests\TestCase; | ||
|
||
/** | ||
* Class RoleFactoryTest. | ||
* | ||
* @group authorization | ||
* @group unit | ||
*/ | ||
class RoleFactoryTest extends TestCase | ||
{ | ||
public function testCreateRole(): void | ||
{ | ||
$role = Role::factory()->create(); | ||
|
||
$this->assertInstanceOf(Role::class, $role); | ||
} | ||
|
||
public function testCreateAdminRole(): void | ||
{ | ||
// 'admin' role is seeded into db automatically, so we have to remove it first before we can test creating it | ||
// using factory | ||
Role::findByName(config('appSection-authorization.admin_role'))->delete(); | ||
|
||
$role = Role::factory()->admin()->create(); | ||
|
||
$this->assertEquals(config('appSection-authorization.admin_role'), $role->name); | ||
} | ||
} |
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