mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-16 17:33:45 +00:00
Updated some tests, fixed some bugs.
This commit is contained in:
@@ -1,8 +1,24 @@
|
||||
<?php
|
||||
// This is global bootstrap for autoloading
|
||||
$db = realpath(__DIR__ . '/_data') . '/testing.sqlite';
|
||||
$db = realpath(__DIR__ . '/_data') . '/testing.sqlite';
|
||||
|
||||
if (!file_exists($db)) {
|
||||
exec('touch ' . $db);
|
||||
exec('php artisan migrate --seed --env=testing');
|
||||
}
|
||||
exec('cp ' . $db . ' ' . realpath(__DIR__ . '/_data') . '/clean.sqlite');
|
||||
|
||||
/**
|
||||
* Class resetToClean
|
||||
* @SuppressWarnings("CamelCase")
|
||||
*/
|
||||
class resetToClean
|
||||
{
|
||||
/**
|
||||
*
|
||||
*/
|
||||
static public function clean()
|
||||
{
|
||||
exec('cp ' . realpath(__DIR__ . '/_data') . '/clean.sqlite ' . realpath(__DIR__ . '/_data') . '/testing.sqlite');
|
||||
}
|
||||
}
|
106
tests/functional/AccountControllerCest.php
Normal file
106
tests/functional/AccountControllerCest.php
Normal file
@@ -0,0 +1,106 @@
|
||||
<?php
|
||||
use Carbon\Carbon;
|
||||
|
||||
/**
|
||||
* Class AccountControllerCest
|
||||
*/
|
||||
class AccountControllerCest
|
||||
{
|
||||
/**
|
||||
* @param FunctionalTester $I
|
||||
*/
|
||||
public function _after(FunctionalTester $I)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* @param FunctionalTester $I
|
||||
*/
|
||||
public function _before(FunctionalTester $I)
|
||||
{
|
||||
$I->amLoggedAs(['email' => 'thegrumpydictator@gmail.com', 'password' => 'james']);
|
||||
|
||||
Session::put('start', new Carbon);
|
||||
Session::put('end', new Carbon);
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @param FunctionalTester $I
|
||||
*/
|
||||
public function create(FunctionalTester $I)
|
||||
{
|
||||
// @codingStandardsIgnoreStart
|
||||
$I->wantTo('create a new asset account');
|
||||
$I->amOnPage('/accounts/create/asset');
|
||||
$I->see('Create a new asset account');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param FunctionalTester $I
|
||||
*/
|
||||
public function delete(FunctionalTester $I)
|
||||
{
|
||||
$I->wantTo('delete an asset account');
|
||||
$I->amOnPage('/accounts/delete/3');
|
||||
$I->see('Delete account "Delete me"');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param FunctionalTester $I
|
||||
*/
|
||||
public function destroy(FunctionalTester $I)
|
||||
{
|
||||
$I->wantTo('destroy an asset account');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param FunctionalTester $I
|
||||
*/
|
||||
public function edit(FunctionalTester $I)
|
||||
{
|
||||
$I->wantTo('delete an asset account');
|
||||
$I->amOnPage('/accounts/edit/3');
|
||||
$I->see('Edit asset account "Delete me"');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param FunctionalTester $I
|
||||
*/
|
||||
public function index(FunctionalTester $I)
|
||||
{
|
||||
$I->wantTo('see a list of accounts');
|
||||
$I->amOnPage('/accounts/asset');
|
||||
$I->see('Checking account');
|
||||
$I->see('Delete me');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param FunctionalTester $I
|
||||
*/
|
||||
public function show(FunctionalTester $I)
|
||||
{
|
||||
$I->wantTo('see one account');
|
||||
#$I->amOnPage('/accounts/show/3');
|
||||
#$I->see('Details for');
|
||||
#$I->see('Delete me');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param FunctionalTester $I
|
||||
*/
|
||||
public function store(FunctionalTester $I)
|
||||
{
|
||||
$I->wantTo('store a new asset account');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param FunctionalTester $I
|
||||
*/
|
||||
public function update(FunctionalTester $I)
|
||||
{
|
||||
$I->wantTo('update an asset account');
|
||||
}
|
||||
|
||||
}
|
@@ -1,5 +1,11 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Class UserControllerCest
|
||||
*
|
||||
* @SuppressWarnings("CamelCase")
|
||||
* @SuppressWarnings("short")
|
||||
*/
|
||||
class UserControllerCest
|
||||
{
|
||||
/**
|
||||
@@ -24,11 +30,24 @@ class UserControllerCest
|
||||
$I->wantTo('login');
|
||||
$I->amOnPage('/login');
|
||||
$I->see('Sign In');
|
||||
$I->submitForm('#login', ['email' => 'functional@example.com','password' => 'functional']);
|
||||
$I->submitForm('#login', ['email' => 'functional@example.com', 'password' => 'functional']);
|
||||
$I->see('functional@example.com');
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @param FunctionalTester $I
|
||||
*/
|
||||
public function loginFails(FunctionalTester $I)
|
||||
{
|
||||
$I->wantTo('fail the login');
|
||||
$I->amOnPage('/login');
|
||||
$I->see('Sign In');
|
||||
$I->submitForm('#login', ['email' => 'functional@example.com', 'password' => 'wrong']);
|
||||
$I->see('No good');
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @param FunctionalTester $I
|
||||
*/
|
||||
@@ -57,7 +76,7 @@ class UserControllerCest
|
||||
$I->wantTo('post-register a new account');
|
||||
$I->amOnPage('/register');
|
||||
$token = $I->grabValueFrom('input[name=_token]');
|
||||
$I->submitForm('#register', ['email' => 'noreply@gmail.com','_token' => $token]);
|
||||
$I->submitForm('#register', ['email' => 'noreply@gmail.com', '_token' => $token]);
|
||||
$I->see('Password sent!');
|
||||
$I->seeRecord('users', ['email' => 'noreply@gmail.com']);
|
||||
// @codingStandardsIgnoreEnd
|
||||
|
Reference in New Issue
Block a user