Skip to content
This repository has been archived by the owner on Oct 13, 2022. It is now read-only.

Commit

Permalink
test: log/permission test
Browse files Browse the repository at this point in the history
  • Loading branch information
Takeno-hito committed Mar 27, 2021
1 parent 7a25b8d commit 9794e04
Showing 1 changed file with 53 additions and 0 deletions.
53 changes: 53 additions & 0 deletions tests/onsite/General/LogTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
<?php
namespace Tests;

/*
* general/guest/*
*
* /:get /_id:get
*/

use App\Models\ActivityLog;
use App\Models\Guest;
use App\Models\Term;
use App\Models\User;
use Illuminate\Support\Carbon;
use Illuminate\Support\Str;

class LogTest extends TestCase {
public function testGetPermission() {
// - general
// - exhibition
// - reservation

foreach (['general', 'exhibition', 'reservation'] as $perm) {
$user = factory(User::class, $perm)->create();

$this->actingAs($user)->get('/onsite/general/log');
$this->assertResponseOk();
}

foreach (['blogAdmin', 'admin', 'blogWriter', 'teacher'] as $perm) {
$user = factory(User::class, $perm)->create();
$this->actingAs($user)->get('/onsite/general/log');
$this->assertResponseStatus(403);
}

// $user = factory(User::class, 'general')->create();
//
// for ($i = 0; $i < $term_count; $i++) {
// $term[] = factory(Term::class)->create();
// for ($j = 0; $j < $guest_count; $j++) {
// $guest[] = factory(Guest::class)->create([
// 'term_id' => $term[$i]->id
// ]);
// }
// }
//
// $this->actingAs($user)->get('/onsite/general/guest');
// $this->assertResponseOk();
// $this->receiveJson();
// $res = json_decode($this->response->getContent());
// $this->assertCount($term_count * $guest_count, $res);
}
}

0 comments on commit 9794e04

Please sign in to comment.