This repository has been archived by the owner on Apr 7, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
213 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
<?php | ||
|
||
namespace Tests; | ||
|
||
use ActivismeBe\User; | ||
use Spatie\Permission\Models\Role; | ||
|
||
/** | ||
* Helper traits for creating logins | ||
* | ||
* @author Tim Joosten <[email protected]> | ||
* @copyright 2018 Tim Joosten and his contributors | ||
* @package Tests\Traits | ||
*/ | ||
trait CreatesUsers | ||
{ | ||
/** | ||
* Function for creating a newly role in the testing db. | ||
* | ||
* @param string $name The name for the role that has to be created. | ||
* @return string | ||
*/ | ||
protected function createRole(string $name): string | ||
{ | ||
return factory(Role::class)->create(['name' => $name])->name; | ||
} | ||
|
||
/** | ||
* Create an normal user in the system | ||
* | ||
* @return \ActivismeBe\User | ||
*/ | ||
public function createNormalUser(): User | ||
{ | ||
return factory(User::class)->create() | ||
->assignRole($this->createRole('user')); | ||
} | ||
|
||
/** | ||
* Create an admin user in the system | ||
* | ||
* @return \ActivismeBe\User | ||
*/ | ||
public function createAdminUser(): User | ||
{ | ||
return factory(User::class)->create() | ||
->assignRole($this->createRole('admin')); | ||
} | ||
|
||
/** | ||
* Create an blocked user in the system. | ||
* | ||
* @return \ActivismeBe\User | ||
*/ | ||
public function createBlockedUser(): User | ||
{ | ||
$user = factory(User::class)->create()->ban(); | ||
return User::find($user->id); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
<?php | ||
|
||
namespace Tests\Feature\Backend; | ||
|
||
use Tests\TestCase; | ||
use Illuminate\Foundation\Testing\WithFaker; | ||
use Illuminate\Foundation\Testing\RefreshDatabase; | ||
|
||
/** | ||
* Class HomeRouteTest | ||
* | ||
* @author Tim Joosten <[email protected]> | ||
* @copyright 2018 Tim Joosten | ||
* @package Tests\Feature\Backend | ||
*/ | ||
class HomeRouteTest extends TestCase | ||
{ | ||
use RefreshDatabase; | ||
|
||
/** | ||
* @test | ||
* @testdox Test if an unauthenticated user can't access the home index page. | ||
*/ | ||
public function unAuthenticated(): void | ||
{ | ||
$this->get(route('home')) | ||
->assertStatus(302) | ||
->assertRedirect(route('login')); | ||
} | ||
|
||
/** | ||
* @test | ||
* @testdox Test if a authenticated user can view the home index page. | ||
*/ | ||
public function authenticated(): void | ||
{ | ||
$user = $this->createNormalUser(); | ||
|
||
$this->actingAs($user) | ||
->get(route('home')) | ||
->assertStatus(200); | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<?php | ||
|
||
namespace Tests\Feature\Frontend; | ||
|
||
use Tests\TestCase; | ||
use Illuminate\Foundation\Testing\WithFaker; | ||
use Illuminate\Foundation\Testing\RefreshDatabase; | ||
|
||
/** | ||
* Class CalendarTest | ||
* | ||
* @author Tim Joosten <[email protected]> | ||
* @copyright 2018 Tim Joosten | ||
* @package Tests\Feature\Frontend | ||
*/ | ||
class CalendarTest extends TestCase | ||
{ | ||
/** | ||
* @test | ||
* @testdox Test if the calendar index page is accessible | ||
*/ | ||
public function IndexPage(): void | ||
{ | ||
$this->get(route('calendar.index'))->assertStatus(200); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<?php | ||
|
||
namespace Tests\Feature\Frontend; | ||
|
||
use Tests\TestCase; | ||
use Illuminate\Foundation\Testing\WithFaker; | ||
use Illuminate\Foundation\Testing\RefreshDatabase; | ||
|
||
/** | ||
* Class DisclaimerTest | ||
* | ||
* @author Tim Joosten <[email protected]> | ||
* @copyright 2018 Tim Joosten | ||
* @package Tests\Feature\Frontend | ||
*/ | ||
class DisclaimerTest extends TestCase | ||
{ | ||
/** | ||
* @test | ||
* @testdox Test is a quest can view the disclaimer page without errors | ||
*/ | ||
public function indexTest(): void | ||
{ | ||
$this->get(route('disclaimer.index'))->assertStatus(200); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<?php | ||
|
||
namespace Tests\Feature\Frontend; | ||
|
||
use Tests\TestCase; | ||
use Illuminate\Foundation\Testing\WithFaker; | ||
use Illuminate\Foundation\Testing\RefreshDatabase; | ||
|
||
/** | ||
* Class HomeRouteTest | ||
* | ||
* @author Tim Joosten <[email protected]> | ||
* @copyright 2018 Tim Joosten | ||
* @package Tests\Feature\Frontend | ||
*/ | ||
class HomeRouteTest extends TestCase | ||
{ | ||
/** | ||
* @test | ||
* @testdox Test if the application index page is accesable. | ||
*/ | ||
public function HomeView(): void | ||
{ | ||
$this->get(route('home.front'))->assertStatus(200); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<?php | ||
|
||
namespace Tests\Feature\Frontend; | ||
|
||
use Tests\TestCase; | ||
use Illuminate\Foundation\Testing\WithFaker; | ||
use Illuminate\Foundation\Testing\RefreshDatabase; | ||
|
||
/** | ||
* Class VisionTest | ||
* | ||
* @author Tim Joosten <[email protected]> | ||
* @copyright 2018 Tim Joosten | ||
* @package Tests\Feature\Frontend | ||
*/ | ||
class VisionTest extends TestCase | ||
{ | ||
/** | ||
* @test | ||
* @testdox Test if the quest can view the vision page without errors | ||
*/ | ||
public function visionIndex() | ||
{ | ||
$this->get(route('visie.index'))->assertStatus(200); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,5 +6,5 @@ | |
|
||
abstract class TestCase extends BaseTestCase | ||
{ | ||
use CreatesApplication; | ||
use CreatesApplication, CreatesUsers; | ||
} |