mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-11-08 18:58:07 +00:00
Auth and password controller.
This commit is contained in:
68
tests/controllers/AuthControllerTest.php
Normal file
68
tests/controllers/AuthControllerTest.php
Normal file
@@ -0,0 +1,68 @@
|
||||
<?php
|
||||
use League\FactoryMuffin\Facade as FactoryMuffin;
|
||||
|
||||
/**
|
||||
* Class AuthControllerTest
|
||||
*/
|
||||
class AuthControllerTest extends TestCase
|
||||
{
|
||||
/**
|
||||
* Sets up the fixture, for example, opens a network connection.
|
||||
* This method is called before a test is executed.
|
||||
*/
|
||||
public function setUp()
|
||||
{
|
||||
parent::setUp();
|
||||
FactoryMuffin::create('FireflyIII\User');
|
||||
}
|
||||
|
||||
/**
|
||||
* This method is called before the first test of this test class is run.
|
||||
*
|
||||
* @since Method available since Release 3.4.0
|
||||
*/
|
||||
public static function setUpBeforeClass()
|
||||
{
|
||||
parent::setUpBeforeClass();
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Tears down the fixture, for example, closes a network connection.
|
||||
* This method is called after a test is executed.
|
||||
*/
|
||||
public function tearDown()
|
||||
{
|
||||
parent::tearDown();
|
||||
}
|
||||
|
||||
public function testPostRegister()
|
||||
{
|
||||
|
||||
$data = [
|
||||
'email' => 'test@example.com',
|
||||
'password' => 'onetwothree',
|
||||
'password_confirmation' => 'onetwothree',
|
||||
'_token' => 'replaceMe'
|
||||
];
|
||||
$this->call('POST', '/auth/register', $data);
|
||||
$this->assertResponseStatus(302);
|
||||
$this->assertSessionHas('success');
|
||||
}
|
||||
|
||||
public function testPostRegisterFails()
|
||||
{
|
||||
|
||||
$data = [
|
||||
'email' => 'test@example.com',
|
||||
'password' => 'onetwothree',
|
||||
'password_confirmation' => 'onetwofour',
|
||||
'_token' => 'replaceMe'
|
||||
];
|
||||
$this->call('POST', '/auth/register', $data);
|
||||
$this->assertResponseStatus(302);
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user