mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-01-07 06:33:57 -06:00
149 lines
4.2 KiB
PHP
149 lines
4.2 KiB
PHP
<?php
|
|
/**
|
|
* AuthControllerTest.php
|
|
* Copyright (C) 2016 Sander Dorigo
|
|
*
|
|
* This software may be modified and distributed under the terms
|
|
* of the MIT license. See the LICENSE file for details.
|
|
*/
|
|
|
|
/**
|
|
* Generated by PHPUnit_SkeletonGenerator on 2016-01-19 at 15:40:28.
|
|
*/
|
|
class AuthControllerTest extends TestCase
|
|
{
|
|
|
|
/**
|
|
* @covers FireflyIII\Http\Controllers\Auth\AuthController::getLogin
|
|
*/
|
|
public function testGetLogin()
|
|
{
|
|
$response = $this->call('GET', '/login');
|
|
$this->assertEquals(200, $response->status());
|
|
}
|
|
|
|
/**
|
|
* @covers FireflyIII\Http\Controllers\Auth\AuthController::getLogout
|
|
*/
|
|
public function testGetLogout()
|
|
{
|
|
$this->be($this->user());
|
|
$response = $this->call('GET', '/logout');
|
|
$this->assertEquals(302, $response->status());
|
|
}
|
|
|
|
/**
|
|
* @covers FireflyIII\Http\Controllers\Auth\AuthController::getRegister
|
|
*/
|
|
public function testGetRegister()
|
|
{
|
|
$response = $this->call('GET', '/register');
|
|
$this->assertEquals(200, $response->status());
|
|
}
|
|
|
|
/**
|
|
* @covers FireflyIII\Http\Controllers\Auth\AuthController::login
|
|
*/
|
|
public function testLogin()
|
|
{
|
|
$response = $this->call('GET', '/login');
|
|
$this->assertSessionHas('isLoggedIn', 'yes');
|
|
$this->assertEquals(200, $response->status());
|
|
}
|
|
|
|
/**
|
|
* @covers FireflyIII\Http\Controllers\Auth\AuthController::logout
|
|
*/
|
|
public function testLogout()
|
|
{
|
|
$this->be($this->user());
|
|
$response = $this->call('GET', '/logout');
|
|
$this->assertEquals(302, $response->status());
|
|
// index should now redirect:
|
|
$response = $this->call('GET', '/');
|
|
$this->assertEquals(302, $response->status());
|
|
|
|
|
|
}
|
|
|
|
/**
|
|
* @covers FireflyIII\Http\Controllers\Auth\AuthController::postLogin
|
|
*/
|
|
public function testPostLogin()
|
|
{
|
|
$args = [
|
|
'email' => 'thegrumpydictator@gmail.com',
|
|
'password' => 'james',
|
|
'remember' => 1,
|
|
'_token' => Session::token(),
|
|
];
|
|
$response = $this->call('POST', '/login', $args);
|
|
$this->assertEquals(302, $response->status());
|
|
$this->assertSessionHas('isLoggedIn', 'yes');
|
|
|
|
}
|
|
|
|
/**
|
|
* @covers FireflyIII\Http\Controllers\Auth\AuthController::postRegister
|
|
*/
|
|
public function testPostRegister()
|
|
{
|
|
$args = [
|
|
'email' => 'thegrumpydictator+test@gmail.com',
|
|
'password' => 'james123',
|
|
'password_confirmation' => 'james123',
|
|
];
|
|
$response = $this->call('POST', '/register', $args);
|
|
$this->assertEquals(302, $response->status());
|
|
$this->assertSessionHas('start');
|
|
}
|
|
|
|
/**
|
|
* @covers FireflyIII\Http\Controllers\Auth\AuthController::redirectPath
|
|
* @todo Implement testRedirectPath().
|
|
*/
|
|
public function testRedirectPath()
|
|
{
|
|
// Remove the following lines when you implement this test.
|
|
$this->markTestIncomplete(
|
|
'This test has not been implemented yet.'
|
|
);
|
|
}
|
|
|
|
/**
|
|
* @covers FireflyIII\Http\Controllers\Auth\AuthController::register
|
|
* @todo Implement testRegister().
|
|
*/
|
|
public function testRegister()
|
|
{
|
|
// Remove the following lines when you implement this test.
|
|
$this->markTestIncomplete(
|
|
'This test has not been implemented yet.'
|
|
);
|
|
}
|
|
|
|
/**
|
|
* @covers FireflyIII\Http\Controllers\Auth\AuthController::showLoginForm
|
|
* @todo Implement testShowLoginForm().
|
|
*/
|
|
public function testShowLoginForm()
|
|
{
|
|
// Remove the following lines when you implement this test.
|
|
$this->markTestIncomplete(
|
|
'This test has not been implemented yet.'
|
|
);
|
|
}
|
|
|
|
/**
|
|
* @covers FireflyIII\Http\Controllers\Auth\AuthController::showRegistrationForm
|
|
* @todo Implement testShowRegistrationForm().
|
|
*/
|
|
public function testShowRegistrationForm()
|
|
{
|
|
// Remove the following lines when you implement this test.
|
|
$this->markTestIncomplete(
|
|
'This test has not been implemented yet.'
|
|
);
|
|
}
|
|
}
|