Skip to content

Commit

Permalink
Merge branch 'master' into 1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
dmitrijsmihailovs committed Feb 21, 2018
2 parents bcdb7cf + 6a1c112 commit 3d82b3b
Showing 1 changed file with 42 additions and 0 deletions.
42 changes: 42 additions & 0 deletions Tests/UserTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<?php

namespace Modules\User\Tests;

use Tests\TestCase;
use Illuminate\Foundation\Testing\RefreshDatabase;

class UserTest extends TestCase
{
/** @test */
public function guests_cannot_view_users()
{
$this->get(route('user::users.index'))->assertRedirect('admin/login');
}

/** @test */
public function admins_can_view_users()
{
$user = app(config('netcore.module-admin.user.model'))->where('is_admin', 1)->first();
$this->be($user);

$this->get(route('user::users.index'))->assertStatus(200);
}

/** @test */
public function guests_cannot_edit_users()
{
$user = app(config('netcore.module-admin.user.model'))->first();

$this->get(route('user::users.edit', $user))->assertRedirect('admin/login');
}

/** @test */
public function admins_can_edit_users()
{
$user = app(config('netcore.module-admin.user.model'))->first();
$admin = app(config('netcore.module-admin.user.model'))->where('is_admin', 1)->first();
$this->be($admin);

$this->get(route('user::users.edit', $user))->assertStatus(200);
}
}

0 comments on commit 3d82b3b

Please sign in to comment.