Skip to content

Commit

Permalink
add test
Browse files Browse the repository at this point in the history
  • Loading branch information
Mohammad-Alavi committed Oct 1, 2021
1 parent 64981c5 commit effc541
Showing 1 changed file with 16 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace App\Containers\AppSection\Authorization\UI\API\Tests\Functional;

use App\Containers\AppSection\Authorization\UI\API\Tests\ApiTestCase;
use Illuminate\Testing\Fluent\AssertableJson;

/**
* Class CreateRoleTest.
Expand Down Expand Up @@ -45,5 +46,20 @@ public function testCreateRoleWithWrongName(): void
$response = $this->makeCall($data);

$response->assertStatus(422);
$response->assertJson(
fn (AssertableJson $json) =>
$json->has('message')
->has('errors')
->where('errors.name.0.0', 'String should not contain space.')
);
}

public function testGivenHaveNoAccess_CannotCreateRole(): void
{
$this->getTestingUserWithoutAccess();

$response = $this->makeCall([]);

$response->assertStatus(403);
}
}

0 comments on commit effc541

Please sign in to comment.