|
| 1 | +<?php |
| 2 | +namespace Tests; |
| 3 | + |
| 4 | +/* |
| 5 | + * general/guest/* |
| 6 | + * |
| 7 | + * /:get /_id:get |
| 8 | + */ |
| 9 | + |
| 10 | +use App\Models\ActivityLog; |
| 11 | +use App\Models\Guest; |
| 12 | +use App\Models\Term; |
| 13 | +use App\Models\User; |
| 14 | +use Illuminate\Support\Carbon; |
| 15 | +use Illuminate\Support\Str; |
| 16 | + |
| 17 | +class LogTest extends TestCase { |
| 18 | + public function testGetPermission() { |
| 19 | + // - general |
| 20 | + // - exhibition |
| 21 | + // - reservation |
| 22 | + |
| 23 | + foreach (['general', 'exhibition', 'reservation'] as $perm) { |
| 24 | + $user = factory(User::class, $perm)->create(); |
| 25 | + |
| 26 | + $this->actingAs($user)->get('/onsite/general/log'); |
| 27 | + $this->assertResponseOk(); |
| 28 | + } |
| 29 | + |
| 30 | + foreach (['blogAdmin', 'admin', 'blogWriter', 'teacher'] as $perm) { |
| 31 | + $user = factory(User::class, $perm)->create(); |
| 32 | + $this->actingAs($user)->get('/onsite/general/log'); |
| 33 | + $this->assertResponseStatus(403); |
| 34 | + } |
| 35 | + |
| 36 | +// $user = factory(User::class, 'general')->create(); |
| 37 | +// |
| 38 | +// for ($i = 0; $i < $term_count; $i++) { |
| 39 | +// $term[] = factory(Term::class)->create(); |
| 40 | +// for ($j = 0; $j < $guest_count; $j++) { |
| 41 | +// $guest[] = factory(Guest::class)->create([ |
| 42 | +// 'term_id' => $term[$i]->id |
| 43 | +// ]); |
| 44 | +// } |
| 45 | +// } |
| 46 | +// |
| 47 | +// $this->actingAs($user)->get('/onsite/general/guest'); |
| 48 | +// $this->assertResponseOk(); |
| 49 | +// $this->receiveJson(); |
| 50 | +// $res = json_decode($this->response->getContent()); |
| 51 | +// $this->assertCount($term_count * $guest_count, $res); |
| 52 | + } |
| 53 | +} |
0 commit comments