mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-02-13 08:55:53 -06:00
New unit tests to cover missed methods.
This commit is contained in:
parent
3386c8b455
commit
8e892e7ea5
app
controllers
database/migrations
lib/FireflyIII/Report
tests
tests
@ -97,6 +97,7 @@ class GoogleChartController extends BaseController
|
||||
$this->_chart->addColumn('Balance for ' . $account->name, 'number');
|
||||
}
|
||||
$current = clone $this->_start;
|
||||
$current->subDay();
|
||||
|
||||
while ($this->_end >= $current) {
|
||||
$row = [clone $current];
|
||||
|
@ -1,6 +1,7 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\QueryException;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
|
||||
/**
|
||||
@ -99,13 +100,16 @@ class ChangesForV322 extends Migration
|
||||
Schema::table(
|
||||
'budget_limits', function (Blueprint $table) {
|
||||
|
||||
// try {
|
||||
//$table->dropUnique('limits_component_id_startdate_repeat_freq_unique');
|
||||
// } catch (QueryException $e) {
|
||||
//$table->dropUnique('unique_ci_combi');
|
||||
// } catch (PDOException $e) {
|
||||
// $table->dropUnique('unique_ci_combi');
|
||||
// }
|
||||
// try {
|
||||
// //$table->dropUnique('unique_ci_combi');
|
||||
// } catch (QueryException $e) {
|
||||
// echo 'Could not delete unique_ci_combi';
|
||||
//
|
||||
// } catch (PDOException $e) {
|
||||
// echo 'Could not delete unique_ci_combi';
|
||||
// } catch (Exception $e) {
|
||||
// echo 'Could not delete unique_ci_combi';
|
||||
// }
|
||||
|
||||
}
|
||||
);
|
||||
|
@ -109,7 +109,7 @@ class Report implements ReportInterface
|
||||
public function getAccountsForMonth(Carbon $date)
|
||||
{
|
||||
$start = clone $date;
|
||||
$start->startOfMonth();
|
||||
$start->startOfMonth()->subDay();
|
||||
$end = clone $date;
|
||||
$end->endOfMonth();
|
||||
$list = $this->_queries->accountList();
|
||||
@ -425,7 +425,7 @@ class Report implements ReportInterface
|
||||
}
|
||||
);
|
||||
$report = [];
|
||||
$start->startOfYear();
|
||||
$start->startOfYear()->subDay();
|
||||
$end->endOfYear();
|
||||
|
||||
foreach ($accounts as $account) {
|
||||
|
@ -1,5 +1,7 @@
|
||||
<?php
|
||||
use Mockery as m;
|
||||
|
||||
use League\FactoryMuffin\Facade as f;
|
||||
|
||||
|
||||
/**
|
||||
* Class TestCase
|
||||
@ -17,39 +19,22 @@ class TestCase extends Illuminate\Foundation\Testing\TestCase
|
||||
$testEnvironment = 'testing';
|
||||
|
||||
return require __DIR__ . '/../../bootstrap/start.php';
|
||||
|
||||
}
|
||||
|
||||
public function setUp()
|
||||
{
|
||||
parent::setUp();
|
||||
Artisan::call('migrate');
|
||||
$this->seed();
|
||||
|
||||
|
||||
//$this->
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $class
|
||||
*
|
||||
* @return m\MockInterface
|
||||
*/
|
||||
public function mock($class)
|
||||
{
|
||||
$mock = Mockery::mock($class);
|
||||
|
||||
$this->app->instance($class, $mock);
|
||||
|
||||
return $mock;
|
||||
}
|
||||
|
||||
static public function setupBeforeClass()
|
||||
{
|
||||
League\FactoryMuffin\Facade::loadFactories(__DIR__ . '/factories');
|
||||
//League\FactoryMuffin\Facade::loadFactories(__DIR__ . '/factories');
|
||||
f::loadFactories(__DIR__ . '/factories');
|
||||
}
|
||||
|
||||
public function tearDown()
|
||||
{
|
||||
m::close();
|
||||
//m::close();
|
||||
}
|
||||
}
|
10
app/tests/factories/Account.php
Normal file
10
app/tests/factories/Account.php
Normal file
@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
League\FactoryMuffin\Facade::define(
|
||||
'Account', [
|
||||
'user_id' => 'factory|User',
|
||||
'account_type_id' => 'factory|AccountType',
|
||||
'name' => 'word',
|
||||
'active' => 'boolean',
|
||||
]
|
||||
);
|
9
app/tests/factories/AccountMeta.php
Normal file
9
app/tests/factories/AccountMeta.php
Normal file
@ -0,0 +1,9 @@
|
||||
<?php
|
||||
|
||||
League\FactoryMuffin\Facade::define(
|
||||
'AccountMeta', [
|
||||
'account_id' => 'factory|Account',
|
||||
'name' => 'word',
|
||||
'data' => 'text'
|
||||
]
|
||||
);
|
8
app/tests/factories/AccountType.php
Normal file
8
app/tests/factories/AccountType.php
Normal file
@ -0,0 +1,8 @@
|
||||
<?php
|
||||
|
||||
League\FactoryMuffin\Facade::define(
|
||||
'AccountType', [
|
||||
'type' => 'word',
|
||||
'editable' => 'boolean'
|
||||
]
|
||||
);
|
@ -10,13 +10,6 @@ settings:
|
||||
memory_limit: 1024M
|
||||
modules:
|
||||
config:
|
||||
Db:
|
||||
dsn: 'sqlite:tests/_data/db.sqlite'
|
||||
user: ''
|
||||
password: ''
|
||||
dump: tests/_data/dump.sql
|
||||
cleanup: true
|
||||
populate: true
|
||||
coverage:
|
||||
enabled: true
|
||||
remote: false
|
||||
|
@ -33,12 +33,14 @@
|
||||
"doctrine/dbal": "~2.3",
|
||||
"satooshi/php-coveralls": "dev-master",
|
||||
"mockery/mockery": "@stable",
|
||||
"league/factory-muffin": "~2.0",
|
||||
"league/factory-muffin": "~2.1",
|
||||
"codeception/codeception": "*",
|
||||
"codeception/c3": "2.*",
|
||||
"sebastian/phpcpd": "*",
|
||||
"sebastian/phpdcd": "*",
|
||||
"codeception/phpbuiltinserver": "*"
|
||||
"codeception/phpbuiltinserver": "*",
|
||||
"codeception/specify": "*",
|
||||
"codeception/verify": "*"
|
||||
|
||||
},
|
||||
"autoload": {
|
||||
|
125
composer.lock
generated
125
composer.lock
generated
@ -4,7 +4,7 @@
|
||||
"Read more about it at http://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
|
||||
"This file is @generated automatically"
|
||||
],
|
||||
"hash": "9c8cafd9d3f40fa1e56b3a7cee419da5",
|
||||
"hash": "66a93b738537ed20455648f477585c88",
|
||||
"packages": [
|
||||
{
|
||||
"name": "classpreloader/classpreloader",
|
||||
@ -2104,6 +2104,77 @@
|
||||
],
|
||||
"time": "2014-09-19 10:14:07"
|
||||
},
|
||||
{
|
||||
"name": "codeception/specify",
|
||||
"version": "0.4.1",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/Codeception/Specify.git",
|
||||
"reference": "0c0ae07adfc231115b3b72ade22f44c23c199ded"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/Codeception/Specify/zipball/0c0ae07adfc231115b3b72ade22f44c23c199ded",
|
||||
"reference": "0c0ae07adfc231115b3b72ade22f44c23c199ded",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"myclabs/deep-copy": "~1.1",
|
||||
"php": ">=5.4.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": "~4.0"
|
||||
},
|
||||
"type": "library",
|
||||
"autoload": {
|
||||
"psr-0": {
|
||||
"Codeception\\": "src/"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"authors": [
|
||||
{
|
||||
"name": "Michael Bodnarchuk",
|
||||
"email": "davert.php@mailican.com"
|
||||
}
|
||||
],
|
||||
"description": "BDD code blocks for PHPUnit and Codeception",
|
||||
"time": "2014-10-17 00:06:51"
|
||||
},
|
||||
{
|
||||
"name": "codeception/verify",
|
||||
"version": "0.2.7",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/Codeception/Verify.git",
|
||||
"reference": "66e5074905f4d9590ddb805d123fe632f4baa488"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/Codeception/Verify/zipball/66e5074905f4d9590ddb805d123fe632f4baa488",
|
||||
"reference": "66e5074905f4d9590ddb805d123fe632f4baa488",
|
||||
"shasum": ""
|
||||
},
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": "3.7.*"
|
||||
},
|
||||
"type": "library",
|
||||
"autoload": {
|
||||
"files": [
|
||||
"src/Codeception/function.php"
|
||||
]
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"authors": [
|
||||
{
|
||||
"name": "Michael Bodnarchuk",
|
||||
"email": "davert.php@mailican.com",
|
||||
"homepage": "http://codeception.com"
|
||||
}
|
||||
],
|
||||
"description": "BDD assertion library for PHPUnit",
|
||||
"time": "2014-01-22 14:40:33"
|
||||
},
|
||||
{
|
||||
"name": "doctrine/annotations",
|
||||
"version": "v1.2.3",
|
||||
@ -3153,6 +3224,48 @@
|
||||
],
|
||||
"time": "2014-12-22 10:06:19"
|
||||
},
|
||||
{
|
||||
"name": "myclabs/deep-copy",
|
||||
"version": "1.2.1",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/myclabs/DeepCopy.git",
|
||||
"reference": "d93c485e71bcd22df0a994e9e3e03a3ef3a3e3f3"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/d93c485e71bcd22df0a994e9e3e03a3ef3a3e3f3",
|
||||
"reference": "d93c485e71bcd22df0a994e9e3e03a3ef3a3e3f3",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=5.4.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"doctrine/collections": "1.*",
|
||||
"phpunit/phpunit": "~4.1"
|
||||
},
|
||||
"type": "library",
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"DeepCopy\\": "src/DeepCopy/"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"description": "Create deep copies (clones) of your objects",
|
||||
"homepage": "https://github.com/myclabs/DeepCopy",
|
||||
"keywords": [
|
||||
"clone",
|
||||
"copy",
|
||||
"duplicate",
|
||||
"object",
|
||||
"object graph"
|
||||
],
|
||||
"time": "2014-11-20 05:11:17"
|
||||
},
|
||||
{
|
||||
"name": "phpdocumentor/reflection-docblock",
|
||||
"version": "2.0.3",
|
||||
@ -4122,16 +4235,16 @@
|
||||
},
|
||||
{
|
||||
"name": "sebastian/version",
|
||||
"version": "1.0.3",
|
||||
"version": "1.0.4",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/sebastianbergmann/version.git",
|
||||
"reference": "b6e1f0cf6b9e1ec409a0d3e2f2a5fb0998e36b43"
|
||||
"reference": "a77d9123f8e809db3fbdea15038c27a95da4058b"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/sebastianbergmann/version/zipball/b6e1f0cf6b9e1ec409a0d3e2f2a5fb0998e36b43",
|
||||
"reference": "b6e1f0cf6b9e1ec409a0d3e2f2a5fb0998e36b43",
|
||||
"url": "https://api.github.com/repos/sebastianbergmann/version/zipball/a77d9123f8e809db3fbdea15038c27a95da4058b",
|
||||
"reference": "a77d9123f8e809db3fbdea15038c27a95da4058b",
|
||||
"shasum": ""
|
||||
},
|
||||
"type": "library",
|
||||
@ -4153,7 +4266,7 @@
|
||||
],
|
||||
"description": "Library that helps with managing the version number of Git-hosted PHP projects",
|
||||
"homepage": "https://github.com/sebastianbergmann/version",
|
||||
"time": "2014-03-07 15:35:33"
|
||||
"time": "2014-12-15 14:25:24"
|
||||
},
|
||||
{
|
||||
"name": "symfony/class-loader",
|
||||
|
@ -1,21 +1,9 @@
|
||||
<?php
|
||||
$db = realpath(__DIR__ . '/_data') . '/db.sqlite';
|
||||
if(!file_exists($db)) {
|
||||
exec('touch '.$db);
|
||||
exec('php artisan migrate --seed --env=testing');
|
||||
exec('sqlite3 tests/_data/db.sqlite .dump > tests/_data/dump.sql');
|
||||
$db = realpath(__DIR__ . '/_data') . '/db.sqlite';
|
||||
$dump = realpath(__DIR__ . '/_data') . '/dump.sql';
|
||||
if (!file_exists($db)) {
|
||||
$out = [];
|
||||
exec('touch ' . $db);
|
||||
exec('php artisan migrate --seed --env=testing', $out);
|
||||
exec('sqlite3 tests/_data/db.sqlite .dump > tests/_data/dump.sql', $out);
|
||||
}
|
||||
|
||||
/**
|
||||
* Class resetToClean
|
||||
*/
|
||||
class resetToClean
|
||||
{
|
||||
/**
|
||||
*
|
||||
*/
|
||||
static public function clean()
|
||||
{
|
||||
//exec('cp ' . realpath(__DIR__ . '/_data') . '/clean.sqlite ' . realpath(__DIR__ . '/_data') . '/testing.sqlite');
|
||||
}
|
||||
}
|
@ -11,6 +11,10 @@ modules:
|
||||
Db:
|
||||
populate: false
|
||||
cleanup: true
|
||||
dsn: 'sqlite:tests/_data/db.sqlite'
|
||||
user: ''
|
||||
password: ''
|
||||
dump: tests/_data/dump.sql
|
||||
Laravel4:
|
||||
environment: 'testing'
|
||||
filters: false
|
@ -55,7 +55,6 @@ class AccountControllerCest
|
||||
$I->see('Delete account "Delete me"');
|
||||
$I->submitForm('#destroy', []);
|
||||
$I->dontSeeRecord('accounts', ['id' => 3, 'deleted_at' => null]);
|
||||
resetToClean::clean();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -113,7 +112,6 @@ class AccountControllerCest
|
||||
$I->see('Create a new asset account');
|
||||
$I->submitForm('#store', ['name' => 'New through tests.', 'what' => 'asset', 'account_role' => 'defaultExpense', 'post_submit_action' => 'store']);
|
||||
$I->seeRecord('accounts', ['name' => 'New through tests.']);
|
||||
resetToClean::clean();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -128,7 +126,6 @@ class AccountControllerCest
|
||||
'#store', ['name' => 'New through tests.', 'what' => 'asset', 'account_role' => 'defaultExpense', 'post_submit_action' => 'create_another']
|
||||
);
|
||||
$I->seeRecord('accounts', ['name' => 'New through tests.']);
|
||||
resetToClean::clean();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -141,7 +138,6 @@ class AccountControllerCest
|
||||
$I->see('Create a new asset account');
|
||||
$I->submitForm('#store', ['name' => null, 'what' => 'asset', 'account_role' => 'defaultExpense', 'post_submit_action' => 'validate_only']);
|
||||
$I->dontSeeRecord('accounts', ['name' => 'New through tests.']);
|
||||
resetToClean::clean();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -156,7 +152,6 @@ class AccountControllerCest
|
||||
'#store', ['name' => 'New through tests.', 'what' => 'asset', 'account_role' => 'defaultExpense', 'post_submit_action' => 'validate_only']
|
||||
);
|
||||
$I->dontSeeRecord('accounts', ['name' => 'New through tests.']);
|
||||
resetToClean::clean();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -169,7 +164,6 @@ class AccountControllerCest
|
||||
$I->see('Edit asset account "Delete me"');
|
||||
$I->submitForm('#update', ['name' => 'Update me', 'what' => 'asset', 'account_role' => 'defaultExpense', 'post_submit_action' => 'update']);
|
||||
$I->seeRecord('accounts', ['name' => 'Update me']);
|
||||
resetToClean::clean();
|
||||
|
||||
}
|
||||
|
||||
@ -185,7 +179,6 @@ class AccountControllerCest
|
||||
'#update', ['name' => 'Savings accountXX', 'what' => 'asset', 'account_role' => 'defaultExpense', 'post_submit_action' => 'return_to_edit']
|
||||
);
|
||||
$I->seeRecord('accounts', ['name' => 'Savings accountXX']);
|
||||
resetToClean::clean();
|
||||
|
||||
}
|
||||
|
||||
|
@ -148,7 +148,6 @@ class BudgetControllerCest
|
||||
$I->see('Create a new budget');
|
||||
$I->submitForm('#store', ['name' => 'New budget.', 'post_submit_action' => 'store']);
|
||||
$I->seeRecord('budgets', ['name' => 'New budget.']);
|
||||
resetToClean::clean();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -197,7 +196,6 @@ class BudgetControllerCest
|
||||
$I->see('Edit budget "Delete me"');
|
||||
$I->submitForm('#update', ['name' => 'Update me', 'post_submit_action' => 'update']);
|
||||
$I->seeRecord('budgets', ['name' => 'Update me']);
|
||||
resetToClean::clean();
|
||||
|
||||
}
|
||||
|
||||
|
@ -107,7 +107,6 @@ class CategoryControllerCest
|
||||
$I->see('Create a new category');
|
||||
$I->submitForm('#store', ['name' => 'New category.', 'post_submit_action' => 'store']);
|
||||
$I->seeRecord('categories', ['name' => 'New category.']);
|
||||
resetToClean::clean();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -120,7 +119,6 @@ class CategoryControllerCest
|
||||
$I->see('Create a new category');
|
||||
$I->submitForm('#store', ['name' => 'New category.', 'post_submit_action' => 'create_another']);
|
||||
$I->seeRecord('categories', ['name' => 'New category.']);
|
||||
resetToClean::clean();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -133,7 +131,6 @@ class CategoryControllerCest
|
||||
$I->see('Create a new category');
|
||||
$I->submitForm('#store', ['name' => null, 'post_submit_action' => 'validate_only']);
|
||||
$I->dontSeeRecord('categories', ['name' => 'New category.']);
|
||||
resetToClean::clean();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -146,7 +143,6 @@ class CategoryControllerCest
|
||||
$I->see('Create a new category');
|
||||
$I->submitForm('#store', ['name' => 'New category.', 'post_submit_action' => 'validate_only']);
|
||||
$I->dontSeeRecord('categories', ['name' => 'New category.']);
|
||||
resetToClean::clean();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -159,7 +155,6 @@ class CategoryControllerCest
|
||||
$I->see('Edit category "Delete me"');
|
||||
$I->submitForm('#update', ['name' => 'Update me', 'post_submit_action' => 'update']);
|
||||
$I->seeRecord('categories', ['name' => 'Update me']);
|
||||
resetToClean::clean();
|
||||
|
||||
}
|
||||
|
||||
|
@ -168,7 +168,6 @@ class CurrencyControllerCest
|
||||
$I->see('Edit currency "US Dollar"');
|
||||
$I->submitForm('#update', ['name' => 'Successful update', 'symbol' => '$', 'code' => 'USD', 'post_submit_action' => 'update']);
|
||||
$I->seeRecord('transaction_currencies', ['name' => 'Successful update']);
|
||||
resetToClean::clean();
|
||||
|
||||
}
|
||||
|
||||
|
@ -46,7 +46,10 @@ class TransactionControllerCest
|
||||
public function destroyTransfer(FunctionalTester $I)
|
||||
{
|
||||
$I->wantTo('destroy a transfer');
|
||||
$I->amOnPage('/transaction/delete/406');
|
||||
|
||||
$journal = TransactionJournal::whereDescription('Money for new PC')->first();
|
||||
|
||||
$I->amOnPage('/transaction/delete/' . $journal->id);
|
||||
$I->submitForm('#destroy', []);
|
||||
$I->see('Transaction "Money for new PC" destroyed.');
|
||||
|
||||
@ -63,8 +66,9 @@ class TransactionControllerCest
|
||||
|
||||
public function edit(FunctionalTester $I)
|
||||
{
|
||||
$journal = TransactionJournal::whereDescription('Money for piggy')->first();
|
||||
$I->wantTo('edit a transaction');
|
||||
$I->amOnPage('/transaction/edit/408');
|
||||
$I->amOnPage('/transaction/edit/' . $journal->id);
|
||||
$I->see('Edit transfer "Money for piggy"');
|
||||
}
|
||||
|
||||
@ -91,8 +95,10 @@ class TransactionControllerCest
|
||||
|
||||
public function show(FunctionalTester $I)
|
||||
{
|
||||
$journal = TransactionJournal::whereDescription('Money for new PC')->first();
|
||||
|
||||
$I->wantTo('see a transaction');
|
||||
$I->amOnPage('/transaction/show/406');
|
||||
$I->amOnPage('/transaction/show/' . $journal->id);
|
||||
$I->see('Transfer "Money for new PC"');
|
||||
$I->see('1.259');
|
||||
}
|
||||
@ -117,27 +123,6 @@ class TransactionControllerCest
|
||||
$I->see('Transaction "Test" stored.');
|
||||
}
|
||||
|
||||
public function storeAndReturn(FunctionalTester $I)
|
||||
{
|
||||
$I->wantTo('store a transaction');
|
||||
$I->amOnPage('/transactions/create/withdrawal');
|
||||
$I->submitForm(
|
||||
'#store', [
|
||||
'reminder' => '',
|
||||
'description' => 'Test',
|
||||
'account_id' => 1,
|
||||
'expense_account' => 'Zomaar',
|
||||
'amount' => 100,
|
||||
'date' => '2014-12-30',
|
||||
'budget_id' => 3,
|
||||
'category' => 'Categorrr',
|
||||
'post_submit_action' => 'create_another'
|
||||
]
|
||||
);
|
||||
$I->see('Transaction "Test" stored.');
|
||||
}
|
||||
|
||||
|
||||
public function storeAndFail(FunctionalTester $I)
|
||||
{
|
||||
$I->wantTo('store a transaction and fail');
|
||||
@ -158,6 +143,26 @@ class TransactionControllerCest
|
||||
$I->see('Could not store transaction: The description field is required.');
|
||||
}
|
||||
|
||||
public function storeAndReturn(FunctionalTester $I)
|
||||
{
|
||||
$I->wantTo('store a transaction');
|
||||
$I->amOnPage('/transactions/create/withdrawal');
|
||||
$I->submitForm(
|
||||
'#store', [
|
||||
'reminder' => '',
|
||||
'description' => 'Test',
|
||||
'account_id' => 1,
|
||||
'expense_account' => 'Zomaar',
|
||||
'amount' => 100,
|
||||
'date' => '2014-12-30',
|
||||
'budget_id' => 3,
|
||||
'category' => 'Categorrr',
|
||||
'post_submit_action' => 'create_another'
|
||||
]
|
||||
);
|
||||
$I->see('Transaction "Test" stored.');
|
||||
}
|
||||
|
||||
public function update(FunctionalTester $I)
|
||||
{
|
||||
$I->wantTo('update a transaction');
|
||||
|
@ -1,2 +1,8 @@
|
||||
<?php
|
||||
// Here you can initialize variables that will be available to your tests
|
||||
$db = realpath(__DIR__ . '/../_data') . '/db.sqlite';
|
||||
if (!file_exists($db)) {
|
||||
$out = [];
|
||||
exec('touch ' . $db);
|
||||
exec('php artisan migrate --seed --env=testing', $out);
|
||||
exec('sqlite3 tests/_data/db.sqlite .dump > tests/_data/dump.sql', $out);
|
||||
}
|
40
tests/unit/AccountTest.php
Normal file
40
tests/unit/AccountTest.php
Normal file
@ -0,0 +1,40 @@
|
||||
<?php
|
||||
use League\FactoryMuffin\Facade as f;
|
||||
|
||||
/**
|
||||
* Class AccountTest
|
||||
*/
|
||||
class AccountTest extends TestCase
|
||||
{
|
||||
|
||||
public function setUp()
|
||||
{
|
||||
parent::setUp();
|
||||
}
|
||||
|
||||
public function tearDown()
|
||||
{
|
||||
parent::tearDown();
|
||||
}
|
||||
|
||||
// tests
|
||||
|
||||
public function testAccountMeta()
|
||||
{
|
||||
$account = f::create('Account');
|
||||
$newMeta = $account->updateMeta('field', 'value');
|
||||
$this->assertInstanceOf('AccountMeta', $newMeta);
|
||||
$secondMeta = $account->updateMeta('field', 'newValue');
|
||||
$this->assertEquals($newMeta->id, $secondMeta->id);
|
||||
$this->assertEquals($newMeta->data, 'value');
|
||||
$this->assertEquals($secondMeta->data, 'newValue');
|
||||
}
|
||||
|
||||
public function testAccountUser()
|
||||
{
|
||||
$account = f::create('Account');
|
||||
$this->assertInstanceOf('Account', $account);
|
||||
$this->assertInstanceOf('User', $account->user);
|
||||
}
|
||||
|
||||
}
|
18
tests/unit/ExamplATest.php
Normal file
18
tests/unit/ExamplATest.php
Normal file
@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
class ExamplATest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
protected function setUp()
|
||||
{
|
||||
}
|
||||
|
||||
protected function tearDown()
|
||||
{
|
||||
}
|
||||
|
||||
// tests
|
||||
public function testMe()
|
||||
{
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user