firefly-iii/tests/acceptance/Controllers/Auth/AuthControllerTest.php

82 lines
2.4 KiB
PHP
Raw Normal View History

2016-01-19 23:20:09 -06:00
<?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.
*/
2016-02-07 00:56:58 -06:00
2016-01-19 23:20:09 -06:00
class AuthControllerTest extends TestCase
{
/**
* @covers FireflyIII\Http\Controllers\Auth\AuthController::logout
*/
public function testLogout()
{
$this->be($this->user());
2016-01-24 11:11:57 -06:00
$this->call('GET', '/logout');
$this->assertResponseStatus(302);
2016-01-19 23:20:09 -06:00
// index should now redirect:
2016-01-24 11:11:57 -06:00
$this->call('GET', '/');
$this->assertResponseStatus(302);
2016-01-19 23:20:09 -06:00
}
/**
2016-02-04 00:30:48 -06:00
* @covers FireflyIII\Http\Controllers\Auth\AuthController::login
* @covers FireflyIII\Http\Controllers\Auth\AuthController::__construct
* @covers FireflyIII\Http\Controllers\Auth\AuthController::sendFailedLoginResponse
* @covers FireflyIII\Http\Controllers\Auth\AuthController::getFailedLoginMessage
*
2016-01-19 23:20:09 -06:00
*/
2016-02-04 00:30:48 -06:00
public function testLogin()
2016-01-19 23:20:09 -06:00
{
$args = [
'email' => 'thegrumpydictator@gmail.com',
'password' => 'james',
'remember' => 1,
];
2016-01-24 11:11:57 -06:00
$this->call('POST', '/login', $args);
$this->assertResponseStatus(302);
2016-01-20 02:15:33 -06:00
2016-01-24 11:11:57 -06:00
$this->call('GET', '/');
$this->assertResponseStatus(200);
2016-01-20 02:15:33 -06:00
2016-01-19 23:20:09 -06:00
}
/**
2016-02-04 00:30:48 -06:00
* @covers FireflyIII\Http\Controllers\Auth\AuthController::register
* @covers FireflyIII\Http\Controllers\Auth\AuthController::create
* @covers FireflyIII\Http\Controllers\Auth\AuthController::isBlockedDomain
* @covers FireflyIII\Http\Controllers\Auth\AuthController::getBlockedDomains
* @covers FireflyIII\Http\Controllers\Auth\AuthController::validator
2016-01-19 23:20:09 -06:00
*/
2016-02-04 00:30:48 -06:00
public function testRegister()
2016-01-19 23:20:09 -06:00
{
$args = [
'email' => 'thegrumpydictator+test@gmail.com',
'password' => 'james123',
'password_confirmation' => 'james123',
];
2016-01-24 11:11:57 -06:00
$this->call('POST', '/register', $args);
$this->assertResponseStatus(302);
2016-01-19 23:20:09 -06:00
$this->assertSessionHas('start');
}
/**
2016-02-04 00:30:48 -06:00
* @covers FireflyIII\Http\Controllers\Auth\AuthController::showRegistrationForm
2016-01-19 23:20:09 -06:00
*/
2016-02-04 00:30:48 -06:00
public function testShowRegistrationForm()
2016-01-19 23:20:09 -06:00
{
2016-01-24 11:11:57 -06:00
$this->call('GET', '/register');
$this->assertResponseStatus(200);
2016-01-19 23:20:09 -06:00
}
}