Commit 95973ff0 authored by Nicolas Widart's avatar Nicolas Widart

Renaming the user test and adding the session test

parent 2bbe2067
<?php namespace Modules\User\Tests;
use Cartalyst\Sentinel\Laravel\Facades\Sentinel;
use TestCase;
class SessionUrlTest extends TestCase
{
/** @test */
public function loginPageShouldBeAccessible()
{
$crawler = $this->client->request('GET', '/auth/login');
$this->assertTrue($this->client->getResponse()->isOk());
$this->assertCount(1, $crawler->filter('.header:contains("Sign In")'));
}
/** @test */
public function registerPageShouldBeAccessible()
{
$crawler = $this->client->request('GET', '/auth/register');
$this->assertTrue($this->client->getResponse()->isOk());
$this->assertCount(1, $crawler->filter('.header:contains("Register New Membership")'));
}
/** @test */
public function forgotPasswordShouldBeAccessible()
{
$crawler = $this->client->request('GET', '/auth/reset');
$this->assertTrue($this->client->getResponse()->isOk());
$this->assertCount(1, $crawler->filter('.header:contains("Reset Password")'));
}
/** @test */
public function dashboardShouldNotBePubliclyAccessible()
{
$this->app['router']->enableFilters();
Sentinel::logout();
$crawler = $this->client->request('GET', '/' . Config::get('core::core.admin-prefix'));
$this->assertRedirectedTo('auth/login');
}
/** @test */
public function dashboardShouldBeAccessibleIfLoggedIn()
{
// $sentinelMock = Mockery::mock('Cartalyst\Sentinel\Laravel\Facades\Sentinel');
// $sentinelMock->shouldReceive('check')->andReturn(true);
$this->app['router']->enableFilters();
$user = Sentinel::findById(4);
Sentinel::login($user);
$crawler = $this->client->request('GET', '/' . Config::get('core::core.admin-prefix'));
$this->assertTrue($this->client->getResponse()->isOk());
$this->assertCount(1, $crawler->filter('h1:contains("Dashboard")'));
}
}
\ No newline at end of file
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
use Cartalyst\Sentinel\Laravel\Facades\Sentinel; use Cartalyst\Sentinel\Laravel\Facades\Sentinel;
use Illuminate\Support\Facades\Config; use Illuminate\Support\Facades\Config;
class UrlTest extends \TestCase class UserUrlTest extends \TestCase
{ {
public function setUp() public function setUp()
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment