mirror of
https://github.com/VueFileManager/vuefilemanager.git
synced 2026-04-19 08:32:14 +00:00
test groups refactoring
This commit is contained in:
52
tests/Domain/Plans/PlansTest.php
Normal file
52
tests/Domain/Plans/PlansTest.php
Normal file
@@ -0,0 +1,52 @@
|
||||
<?php
|
||||
|
||||
|
||||
namespace Tests\Domain\Plans;
|
||||
|
||||
|
||||
use Domain\Settings\Models\User;
|
||||
use Illuminate\Support\Str;
|
||||
use Laravel\Sanctum\Sanctum;
|
||||
use Tests\TestCase;
|
||||
|
||||
class PlansTest extends TestCase
|
||||
{
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public function it_get_all_plans_for_index_page()
|
||||
{
|
||||
$this->getJson('/api/pricing')
|
||||
->assertStatus(200);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public function it_delete_single_plan()
|
||||
{
|
||||
$admin = User::factory(User::class)
|
||||
->create(['role' => 'admin']);
|
||||
|
||||
Sanctum::actingAs($admin);
|
||||
|
||||
$plan_name = 'test-plan-' . Str::random(16);
|
||||
|
||||
$this->postJson('/api/admin/plans', [
|
||||
'type' => 'plan',
|
||||
'attributes' => [
|
||||
'name' => $plan_name,
|
||||
'price' => (string)rand(1, 99),
|
||||
'description' => 'Some random description',
|
||||
'capacity' => rand(1, 999),
|
||||
],
|
||||
])
|
||||
->assertStatus(201)
|
||||
->assertJsonFragment([
|
||||
'name' => $plan_name
|
||||
]);
|
||||
|
||||
$this->deleteJson("/api/admin/plans/" . strtolower($plan_name))
|
||||
->assertStatus(204);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user