-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGet_uploadedTest.php
More file actions
58 lines (48 loc) · 1.72 KB
/
Get_uploadedTest.php
File metadata and controls
58 lines (48 loc) · 1.72 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
<?php
use Illuminate\Foundation\Testing\RefreshDatabase;
use App\Models\User;
use Tests\TestCase;
use Illuminate\Foundation\Testing\WithFaker;
class DocumentUploadControllerGet_uploadedTest extends TestCase
{
use RefreshDatabase;
/** @test */
public function test_get_uploaded_success()
{
// Create a user and authenticate
$user = User::factory()->create();
$this->actingAs($user);
// Call api endpoint
$response = $this->getJson("/core/tier-upgrade/{$user->id}");
// Assert the response
$response->assertStatus(200);
$response->assertJson(['success' => true]);
$response->assertJsonStructure(['success', 'message', 'data' => []]);
}
/** @test */
public function test_get_uploaded_fail_without_permission()
{
// Create a user and authenticate
$user = User::factory()->create();
$this->actingAs($user);
// Call api endpoint
$response = $this->getJson("/core/tier-upgrade/{$user->id}");
// Assert the response
$response->assertStatus(405);
$response->assertJson(['success' => false]);
$response->assertJsonStructure(['success', 'message']);
}
/** @test */
public function test_get_uploaded_with_status_parameter_success()
{
// Create a user and authenticate
$user = User::factory()->create();
$this->actingAs($user);
// Call api endpoint
$response = $this->getJson("/core/tier-upgrade/{$user->id}?status=pending");
// Assert the response
$response->assertStatus(200);
$response->assertJson(['success' => true]);
$response->assertJsonStructure(['success', 'message', 'data' => []]);
}
}