diff --git a/.gitignore b/.gitignore
index 7ea9221a8b..2eb9714228 100644
--- a/.gitignore
+++ b/.gitignore
@@ -32,4 +32,5 @@ addNewLines.php
.env.backup
.env.local
+tests/_output/*
tests/_output/*
\ No newline at end of file
diff --git a/README.md b/README.md
index a601b48810..a3de7d2e42 100644
--- a/README.md
+++ b/README.md
@@ -61,19 +61,19 @@ Everything is organised:
_Please note that everything in these screenshots is fictional and may not be realistic._
-
+
-
+
-
+
-
+
-
+
-
+
-
+
## Running and installing
diff --git a/app/Generator/Chart/Account/ChartJsAccountChartGenerator.php b/app/Generator/Chart/Account/ChartJsAccountChartGenerator.php
index b084678de0..a6ab113571 100644
--- a/app/Generator/Chart/Account/ChartJsAccountChartGenerator.php
+++ b/app/Generator/Chart/Account/ChartJsAccountChartGenerator.php
@@ -20,6 +20,7 @@ class ChartJsAccountChartGenerator implements AccountChartGenerator
/**
* @codeCoverageIgnore
+ *
* @param Collection $accounts
* @param Carbon $start
* @param Carbon $end
diff --git a/app/Generator/Chart/Account/GoogleAccountChartGenerator.php b/app/Generator/Chart/Account/GoogleAccountChartGenerator.php
index 3859175b3d..ab84e168ce 100644
--- a/app/Generator/Chart/Account/GoogleAccountChartGenerator.php
+++ b/app/Generator/Chart/Account/GoogleAccountChartGenerator.php
@@ -64,32 +64,7 @@ class GoogleAccountChartGenerator implements AccountChartGenerator
*/
public function frontpage(Collection $accounts, Carbon $start, Carbon $end)
{
- $chart = new GChart;
- $chart->addColumn(trans('firefly.dayOfMonth'), 'date');
-
- $index = 1;
- /** @var Account $account */
- foreach ($accounts as $account) {
- $chart->addColumn(trans('firefly.balanceFor', ['name' => $account->name]), 'number');
- $chart->addCertainty($index);
- $index++;
- }
- $current = clone $start;
- $current->subDay();
- $today = Carbon::now();
- while ($end >= $current) {
- $row = [clone $current];
- $certain = $current < $today;
- foreach ($accounts as $account) {
- $row[] = Steam::balance($account, $current);
- $row[] = $certain;
- }
- $chart->addRowArray($row);
- $current->addDay();
- }
- $chart->generate();
-
- return $chart->getData();
+ return $this->all($accounts, $start, $end);
}
/**
diff --git a/app/Generator/Chart/Bill/ChartJsBillChartGenerator.php b/app/Generator/Chart/Bill/ChartJsBillChartGenerator.php
index 4afa0c6ea7..e4dd7a6857 100644
--- a/app/Generator/Chart/Bill/ChartJsBillChartGenerator.php
+++ b/app/Generator/Chart/Bill/ChartJsBillChartGenerator.php
@@ -1,10 +1,4 @@
description;
- $paidAmount += floatval($entry->amount);
+ $paidAmount = bcadd($paidAmount, $entry->amount);
}
-
- // loop unpaid:
/** @var Bill $entry */
- foreach ($unpaid as $entry) {
+ foreach ($unpaid as $entry) { // loop unpaid:
$description = $entry[0]->name . ' (' . $entry[1]->format('jS M Y') . ')';
$amount = ($entry[0]->amount_max + $entry[0]->amount_min) / 2;
$unpaidDescriptions[] = $description;
- $unpaidAmount += $amount;
+ $unpaidAmount = bcadd($unpaidAmount, $amount);
unset($amount, $description);
}
diff --git a/app/Generator/Chart/Bill/GoogleBillChartGenerator.php b/app/Generator/Chart/Bill/GoogleBillChartGenerator.php
index 8864bb8306..87960405ec 100644
--- a/app/Generator/Chart/Bill/GoogleBillChartGenerator.php
+++ b/app/Generator/Chart/Bill/GoogleBillChartGenerator.php
@@ -30,12 +30,14 @@ class GoogleBillChartGenerator implements BillChartGenerator
$unpaidDescriptions = [];
$unpaidAmount = 0;
+ bcscale(2);
+
/** @var TransactionJournal $entry */
foreach ($paid as $entry) {
$paidDescriptions[] = $entry->description;
- $paidAmount += floatval($entry->amount);
+ $paidAmount = bcadd($paidAmount, $entry->amount);
}
// loop unpaid:
@@ -44,7 +46,7 @@ class GoogleBillChartGenerator implements BillChartGenerator
$description = $entry[0]->name . ' (' . $entry[1]->format('jS M Y') . ')';
$amount = ($entry[0]->amount_max + $entry[0]->amount_min) / 2;
$unpaidDescriptions[] = $description;
- $unpaidAmount += $amount;
+ $unpaidAmount = bcadd($unpaidAmount, $amount);
unset($amount, $description);
}
@@ -77,7 +79,11 @@ class GoogleBillChartGenerator implements BillChartGenerator
/** @var TransactionJournal $result */
foreach ($entries as $result) {
- $chart->addRow(clone $result->date, floatval($bill->amount_max), floatval($bill->amount_min), floatval($result->amount));
+ $chart->addRow(
+ clone $result->date,
+ floatval($bill->amount_max),
+ floatval($bill->amount_min),
+ floatval($result->amount));
}
$chart->generate();
diff --git a/app/Generator/Chart/Budget/ChartJsBudgetChartGenerator.php b/app/Generator/Chart/Budget/ChartJsBudgetChartGenerator.php
index e7665fe9b9..d91a293286 100644
--- a/app/Generator/Chart/Budget/ChartJsBudgetChartGenerator.php
+++ b/app/Generator/Chart/Budget/ChartJsBudgetChartGenerator.php
@@ -28,7 +28,6 @@ class ChartJsBudgetChartGenerator implements BudgetChartGenerator
$format = Config::get('firefly.' . $dateFormat . '.' . $language);
$data = [
- 'count' => 1,
'labels' => [],
'datasets' => [
[
@@ -45,6 +44,8 @@ class ChartJsBudgetChartGenerator implements BudgetChartGenerator
}
+ $data['count'] = count($data['datasets']);
+
return $data;
}
@@ -118,7 +119,6 @@ class ChartJsBudgetChartGenerator implements BudgetChartGenerator
$format = Config::get('firefly.month.' . $language);
$data = [
- 'count' => 0,
'labels' => [],
'datasets' => [],
];
diff --git a/app/Generator/Chart/Budget/GoogleBudgetChartGenerator.php b/app/Generator/Chart/Budget/GoogleBudgetChartGenerator.php
index a463a6b296..848c493b68 100644
--- a/app/Generator/Chart/Budget/GoogleBudgetChartGenerator.php
+++ b/app/Generator/Chart/Budget/GoogleBudgetChartGenerator.php
@@ -37,6 +37,7 @@ class GoogleBudgetChartGenerator implements BudgetChartGenerator
/**
* @codeCoverageIgnore
+ *
* @param Collection $entries
*
* @return array
diff --git a/app/Generator/Chart/Category/ChartJsCategoryChartGenerator.php b/app/Generator/Chart/Category/ChartJsCategoryChartGenerator.php
index 49f92827b7..42e17d875c 100644
--- a/app/Generator/Chart/Category/ChartJsCategoryChartGenerator.php
+++ b/app/Generator/Chart/Category/ChartJsCategoryChartGenerator.php
@@ -17,7 +17,7 @@ class ChartJsCategoryChartGenerator implements CategoryChartGenerator
/**
* @param Collection $entries
- * @param string $dateFormat
+ * @param string $dateFormat
*
* @return array
*/
@@ -76,6 +76,7 @@ class ChartJsCategoryChartGenerator implements CategoryChartGenerator
/**
* @codeCoverageIgnore
+ *
* @param Collection $entries
*
* @return array
diff --git a/app/Generator/Chart/Category/GoogleCategoryChartGenerator.php b/app/Generator/Chart/Category/GoogleCategoryChartGenerator.php
index b6187f64ed..476f90c998 100644
--- a/app/Generator/Chart/Category/GoogleCategoryChartGenerator.php
+++ b/app/Generator/Chart/Category/GoogleCategoryChartGenerator.php
@@ -99,6 +99,7 @@ class GoogleCategoryChartGenerator implements CategoryChartGenerator
$chart->addRowArray($entry);
}
$chart->generate();
+
return $chart->getData();
}
diff --git a/app/Generator/Chart/Report/ChartJsReportChartGenerator.php b/app/Generator/Chart/Report/ChartJsReportChartGenerator.php
index c1b5cdf5a7..516d2f5332 100644
--- a/app/Generator/Chart/Report/ChartJsReportChartGenerator.php
+++ b/app/Generator/Chart/Report/ChartJsReportChartGenerator.php
@@ -3,7 +3,6 @@
namespace FireflyIII\Generator\Chart\Report;
use Config;
-use Grumpydictator\Gchart\GChart;
use Illuminate\Support\Collection;
use Preferences;
@@ -78,6 +77,7 @@ class ChartJsReportChartGenerator implements ReportChartGenerator
$data['datasets'][1]['data'][] = round($expense, 2);
$data['datasets'][0]['data'][] = round(($income / $count), 2);
$data['datasets'][1]['data'][] = round(($expense / $count), 2);
+
return $data;
}
}
diff --git a/app/Helpers/Csv/Converter/AccountId.php b/app/Helpers/Csv/Converter/AccountId.php
new file mode 100644
index 0000000000..ef555174a6
--- /dev/null
+++ b/app/Helpers/Csv/Converter/AccountId.php
@@ -0,0 +1,29 @@
+mapped[$this->index][$this->value])) {
+ $account = Auth::user()->accounts()->find($this->mapped[$this->index][$this->value]);
+ } else {
+ $account = Auth::user()->accounts()->find($this->value);
+ }
+
+ return $account;
+ }
+}
\ No newline at end of file
diff --git a/app/Helpers/Csv/Converter/Amount.php b/app/Helpers/Csv/Converter/Amount.php
new file mode 100644
index 0000000000..38acf974b5
--- /dev/null
+++ b/app/Helpers/Csv/Converter/Amount.php
@@ -0,0 +1,26 @@
+value)) {
+ return $this->value;
+ }
+
+ return 0;
+ }
+}
\ No newline at end of file
diff --git a/app/Helpers/Csv/Converter/AssetAccountIban.php b/app/Helpers/Csv/Converter/AssetAccountIban.php
new file mode 100644
index 0000000000..c928534663
--- /dev/null
+++ b/app/Helpers/Csv/Converter/AssetAccountIban.php
@@ -0,0 +1,68 @@
+mapped[$this->index][$this->value])) {
+ $account = Auth::user()->accounts()->find($this->mapped[$this->index][$this->value]);
+
+ return $account;
+ }
+ if (strlen($this->value) > 0) {
+ // find or create new account:
+ $account = $this->findAccount();
+ $accountType = AccountType::where('type', 'Asset account')->first();
+
+ if (is_null($account)) {
+ // create it if doesn't exist.
+ $account = Account::firstOrCreateEncrypted(
+ [
+ 'name' => $this->value,
+ 'iban' => $this->value,
+ 'user_id' => Auth::user()->id,
+ 'account_type_id' => $accountType->id,
+ 'active' => 1,
+ ]
+ );
+ }
+
+ return $account;
+ }
+
+ return null;
+ }
+
+ /**
+ * @return Account|null
+ */
+ protected function findAccount()
+ {
+ $set = Auth::user()->accounts()->accountTypeIn(['Default account', 'Asset account'])->get(['accounts.*']);
+ /** @var Account $entry */
+ foreach ($set as $entry) {
+ if ($entry->iban == $this->value) {
+
+ return $entry;
+ }
+ }
+
+ return null;
+ }
+}
\ No newline at end of file
diff --git a/app/Helpers/Csv/Converter/AssetAccountName.php b/app/Helpers/Csv/Converter/AssetAccountName.php
new file mode 100644
index 0000000000..3fc708c20b
--- /dev/null
+++ b/app/Helpers/Csv/Converter/AssetAccountName.php
@@ -0,0 +1,51 @@
+mapped[$this->index][$this->value])) {
+ $account = Auth::user()->accounts()->find($this->mapped[$this->index][$this->value]);
+
+ return $account;
+ }
+ // find or create new account:
+ $accountType = AccountType::where('type', 'Asset account')->first();
+ $set = Auth::user()->accounts()->accountTypeIn(['Asset account', 'Default account'])->get();
+ /** @var Account $entry */
+ foreach ($set as $entry) {
+ if ($entry->name == $this->value) {
+ return $entry;
+ }
+ }
+
+ // create it if doesnt exist.
+ $account = Account::firstOrCreateEncrypted(
+ [
+ 'name' => $this->value,
+ 'iban' => '',
+ 'user_id' => Auth::user()->id,
+ 'account_type_id' => $accountType->id,
+ 'active' => 1,
+ ]
+ );
+
+ return $account;
+ }
+}
\ No newline at end of file
diff --git a/app/Helpers/Csv/Converter/BasicConverter.php b/app/Helpers/Csv/Converter/BasicConverter.php
new file mode 100644
index 0000000000..ba2bffc864
--- /dev/null
+++ b/app/Helpers/Csv/Converter/BasicConverter.php
@@ -0,0 +1,122 @@
+data;
+ }
+
+ /**
+ * @param array $data
+ */
+ public function setData(array $data)
+ {
+ $this->data = $data;
+ }
+
+ /**
+ * @return string
+ */
+ public function getField()
+ {
+ return $this->field;
+ }
+
+ /**
+ * @param string $field
+ */
+ public function setField($field)
+ {
+ $this->field = $field;
+ }
+
+ /**
+ * @return int
+ */
+ public function getIndex()
+ {
+ return $this->index;
+ }
+
+ /**
+ * @param int $index
+ */
+ public function setIndex($index)
+ {
+ $this->index = $index;
+ }
+
+ /**
+ * @return array
+ */
+ public function getMapped()
+ {
+ return $this->mapped;
+ }
+
+ /**
+ * @param array $mapped
+ */
+ public function setMapped($mapped)
+ {
+ $this->mapped = $mapped;
+ }
+
+ /**
+ * @return string
+ */
+ public function getRole()
+ {
+ return $this->role;
+ }
+
+ /**
+ * @param string $role
+ */
+ public function setRole($role)
+ {
+ $this->role = $role;
+ }
+
+ /**
+ * @return string
+ */
+ public function getValue()
+ {
+ return $this->value;
+ }
+
+ /**
+ * @param string $value
+ */
+ public function setValue($value)
+ {
+ $this->value = $value;
+ }
+
+
+}
\ No newline at end of file
diff --git a/app/Helpers/Csv/Converter/BillId.php b/app/Helpers/Csv/Converter/BillId.php
new file mode 100644
index 0000000000..975ce66771
--- /dev/null
+++ b/app/Helpers/Csv/Converter/BillId.php
@@ -0,0 +1,30 @@
+mapped[$this->index][$this->value])) {
+ $bill = Auth::user()->bills()->find($this->mapped[$this->index][$this->value]);
+ } else {
+ $bill = Auth::user()->bills()->find($this->value);
+ }
+
+ return $bill;
+ }
+}
\ No newline at end of file
diff --git a/app/Helpers/Csv/Converter/BillName.php b/app/Helpers/Csv/Converter/BillName.php
new file mode 100644
index 0000000000..4e15b1bdbd
--- /dev/null
+++ b/app/Helpers/Csv/Converter/BillName.php
@@ -0,0 +1,38 @@
+mapped[$this->index][$this->value])) {
+ $bill = Auth::user()->bills()->find($this->mapped[$this->index][$this->value]);
+ } else {
+
+ $bills = Auth::user()->bills()->get();
+ /** @var Bill $bill */
+ foreach ($bills as $bill) {
+ if ($bill->name == $this->value) {
+ return $bill;
+ }
+ }
+ }
+
+ return $bill;
+ }
+}
\ No newline at end of file
diff --git a/app/Helpers/Csv/Converter/BudgetId.php b/app/Helpers/Csv/Converter/BudgetId.php
new file mode 100644
index 0000000000..daaec82688
--- /dev/null
+++ b/app/Helpers/Csv/Converter/BudgetId.php
@@ -0,0 +1,29 @@
+mapped[$this->index][$this->value])) {
+ $budget = Auth::user()->budgets()->find($this->mapped[$this->index][$this->value]);
+ } else {
+ $budget = Auth::user()->budgets()->find($this->value);
+ }
+
+ return $budget;
+ }
+}
\ No newline at end of file
diff --git a/app/Helpers/Csv/Converter/BudgetName.php b/app/Helpers/Csv/Converter/BudgetName.php
new file mode 100644
index 0000000000..26ff92a1ec
--- /dev/null
+++ b/app/Helpers/Csv/Converter/BudgetName.php
@@ -0,0 +1,35 @@
+mapped[$this->index][$this->value])) {
+ $budget = Auth::user()->budgets()->find($this->mapped[$this->index][$this->value]);
+ } else {
+ $budget = Budget::firstOrCreateEncrypted(
+ [
+ 'name' => $this->value,
+ 'user_id' => Auth::user()->id,
+ 'active' => true,
+ ]
+ );
+ }
+
+ return $budget;
+ }
+}
\ No newline at end of file
diff --git a/app/Helpers/Csv/Converter/CategoryId.php b/app/Helpers/Csv/Converter/CategoryId.php
new file mode 100644
index 0000000000..9b6b089d37
--- /dev/null
+++ b/app/Helpers/Csv/Converter/CategoryId.php
@@ -0,0 +1,29 @@
+mapped[$this->index][$this->value])) {
+ $category = Auth::user()->categories()->find($this->mapped[$this->index][$this->value]);
+ } else {
+ $category = Auth::user()->categories()->find($this->value);
+ }
+
+ return $category;
+ }
+}
\ No newline at end of file
diff --git a/app/Helpers/Csv/Converter/CategoryName.php b/app/Helpers/Csv/Converter/CategoryName.php
new file mode 100644
index 0000000000..5a35ecbcb9
--- /dev/null
+++ b/app/Helpers/Csv/Converter/CategoryName.php
@@ -0,0 +1,34 @@
+mapped[$this->index][$this->value])) {
+ $category = Auth::user()->categories()->find($this->mapped[$this->index][$this->value]);
+ } else {
+ $category = Category::firstOrCreateEncrypted(
+ [
+ 'name' => $this->value,
+ 'user_id' => Auth::user()->id
+ ]
+ );
+ }
+
+ return $category;
+ }
+}
\ No newline at end of file
diff --git a/app/Helpers/Csv/Converter/ConverterInterface.php b/app/Helpers/Csv/Converter/ConverterInterface.php
new file mode 100644
index 0000000000..f6a0cae84d
--- /dev/null
+++ b/app/Helpers/Csv/Converter/ConverterInterface.php
@@ -0,0 +1,49 @@
+mapped[$this->index][$this->value])) {
+ $currency = TransactionCurrency::find($this->mapped[$this->index][$this->value]);
+ } else {
+ $currency = TransactionCurrency::whereCode($this->value)->first();
+ }
+
+ return $currency;
+ }
+}
\ No newline at end of file
diff --git a/app/Helpers/Csv/Converter/CurrencyId.php b/app/Helpers/Csv/Converter/CurrencyId.php
new file mode 100644
index 0000000000..1544acae83
--- /dev/null
+++ b/app/Helpers/Csv/Converter/CurrencyId.php
@@ -0,0 +1,28 @@
+mapped[$this->index][$this->value])) {
+ $currency = TransactionCurrency::find($this->mapped[$this->index][$this->value]);
+ } else {
+ $currency = TransactionCurrency::find($this->value);
+ }
+
+ return $currency;
+ }
+}
\ No newline at end of file
diff --git a/app/Helpers/Csv/Converter/CurrencyName.php b/app/Helpers/Csv/Converter/CurrencyName.php
new file mode 100644
index 0000000000..09a1bad4c4
--- /dev/null
+++ b/app/Helpers/Csv/Converter/CurrencyName.php
@@ -0,0 +1,28 @@
+mapped[$this->index][$this->value])) {
+ $currency = TransactionCurrency::find($this->mapped[$this->index][$this->value]);
+ } else {
+ $currency = TransactionCurrency::whereName($this->value)->first();
+ }
+
+ return $currency;
+ }
+}
\ No newline at end of file
diff --git a/app/Helpers/Csv/Converter/CurrencySymbol.php b/app/Helpers/Csv/Converter/CurrencySymbol.php
new file mode 100644
index 0000000000..957674751f
--- /dev/null
+++ b/app/Helpers/Csv/Converter/CurrencySymbol.php
@@ -0,0 +1,28 @@
+mapped[$this->index][$this->value])) {
+ $currency = TransactionCurrency::find($this->mapped[$this->index][$this->value]);
+ } else {
+ $currency = TransactionCurrency::whereSymbol($this->value)->first();
+ }
+
+ return $currency;
+ }
+}
\ No newline at end of file
diff --git a/app/Helpers/Csv/Converter/Date.php b/app/Helpers/Csv/Converter/Date.php
new file mode 100644
index 0000000000..9848b0d0be
--- /dev/null
+++ b/app/Helpers/Csv/Converter/Date.php
@@ -0,0 +1,27 @@
+value);
+
+ return $date;
+ }
+}
\ No newline at end of file
diff --git a/app/Helpers/Csv/Converter/Description.php b/app/Helpers/Csv/Converter/Description.php
new file mode 100644
index 0000000000..19bede19a0
--- /dev/null
+++ b/app/Helpers/Csv/Converter/Description.php
@@ -0,0 +1,21 @@
+data['description'] . ' ' . $this->value);
+ }
+}
\ No newline at end of file
diff --git a/app/Helpers/Csv/Converter/Ignore.php b/app/Helpers/Csv/Converter/Ignore.php
new file mode 100644
index 0000000000..b9c7607d47
--- /dev/null
+++ b/app/Helpers/Csv/Converter/Ignore.php
@@ -0,0 +1,22 @@
+mapped[$this->index][$this->value])) {
+ $account = Auth::user()->accounts()->find($this->mapped[$this->index][$this->value]);
+
+ return $account;
+ } else {
+ if (strlen($this->value) > 0) {
+ $account = $this->findAccount();
+ if (!is_null($account)) {
+ return $account;
+ }
+ }
+
+ return $this->value;
+ }
+ }
+
+ /**
+ * @return Account|null
+ */
+ protected function findAccount()
+ {
+ $set = Auth::user()->accounts()->get();
+ /** @var Account $account */
+ foreach ($set as $account) {
+ if ($account->iban == $this->value) {
+ Log::debug('OpposingAccountIban::convert found an Account (#' . $account->id . ': ' . $account->name . ') with IBAN ' . $this->value);
+
+ return $account;
+ }
+ }
+
+ return null;
+ }
+}
\ No newline at end of file
diff --git a/app/Helpers/Csv/Converter/OpposingAccountId.php b/app/Helpers/Csv/Converter/OpposingAccountId.php
new file mode 100644
index 0000000000..8d14ab5e75
--- /dev/null
+++ b/app/Helpers/Csv/Converter/OpposingAccountId.php
@@ -0,0 +1,32 @@
+mapped[$this->index][$this->value])) {
+ $account = Auth::user()->accounts()->find($this->mapped[$this->index][$this->value]);
+
+ } else {
+ $account = Auth::user()->accounts()->find($this->value);
+ }
+
+ return $account;
+
+ }
+}
\ No newline at end of file
diff --git a/app/Helpers/Csv/Converter/OpposingAccountName.php b/app/Helpers/Csv/Converter/OpposingAccountName.php
new file mode 100644
index 0000000000..835ae0ad7c
--- /dev/null
+++ b/app/Helpers/Csv/Converter/OpposingAccountName.php
@@ -0,0 +1,31 @@
+mapped[$this->index][$this->value])) {
+ $account = Auth::user()->accounts()->find($this->mapped[$this->index][$this->value]);
+
+ return $account;
+ } else {
+ return $this->value;
+ }
+ }
+}
\ No newline at end of file
diff --git a/app/Helpers/Csv/Converter/RabobankDebetCredit.php b/app/Helpers/Csv/Converter/RabobankDebetCredit.php
new file mode 100644
index 0000000000..bfe1babc5e
--- /dev/null
+++ b/app/Helpers/Csv/Converter/RabobankDebetCredit.php
@@ -0,0 +1,26 @@
+value == 'D') {
+ return -1;
+ }
+
+ return 1;
+ }
+}
\ No newline at end of file
diff --git a/app/Helpers/Csv/Converter/TagsComma.php b/app/Helpers/Csv/Converter/TagsComma.php
new file mode 100644
index 0000000000..73ad4aa71f
--- /dev/null
+++ b/app/Helpers/Csv/Converter/TagsComma.php
@@ -0,0 +1,40 @@
+value);
+ foreach ($strings as $string) {
+ $tag = Tag::firstOrCreateEncrypted(
+ [
+ 'tag' => $string,
+ 'tagMode' => 'nothing',
+ 'user_id' => Auth::user()->id,
+ ]
+ );
+ $tags->push($tag);
+ }
+ $tags = $tags->merge($this->data['tags']);
+
+ return $tags;
+ }
+}
\ No newline at end of file
diff --git a/app/Helpers/Csv/Converter/TagsSpace.php b/app/Helpers/Csv/Converter/TagsSpace.php
new file mode 100644
index 0000000000..6e0353832d
--- /dev/null
+++ b/app/Helpers/Csv/Converter/TagsSpace.php
@@ -0,0 +1,40 @@
+value);
+ foreach ($strings as $string) {
+ $tag = Tag::firstOrCreateEncrypted(
+ [
+ 'tag' => $string,
+ 'tagMode' => 'nothing',
+ 'user_id' => Auth::user()->id,
+ ]
+ );
+ $tags->push($tag);
+ }
+ $tags = $tags->merge($this->data['tags']);
+
+ return $tags;
+ }
+}
\ No newline at end of file
diff --git a/app/Helpers/Csv/Data.php b/app/Helpers/Csv/Data.php
new file mode 100644
index 0000000000..f6eca2f145
--- /dev/null
+++ b/app/Helpers/Csv/Data.php
@@ -0,0 +1,263 @@
+sessionHasHeaders();
+ $this->sessionDateFormat();
+ $this->sessionCsvFileLocation();
+ $this->sessionMap();
+ $this->sessionRoles();
+ $this->sessionMapped();
+ $this->sessionSpecifix();
+ }
+
+ protected function sessionHasHeaders()
+ {
+ if (Session::has('csv-has-headers')) {
+ $this->hasHeaders = (bool)Session::get('csv-has-headers');
+ }
+ }
+
+ protected function sessionDateFormat()
+ {
+ if (Session::has('csv-date-format')) {
+ $this->dateFormat = (string)Session::get('csv-date-format');
+ }
+ }
+
+ protected function sessionCsvFileLocation()
+ {
+ if (Session::has('csv-file')) {
+ $this->csvFileLocation = (string)Session::get('csv-file');
+ }
+ }
+
+ protected function sessionMap()
+ {
+ if (Session::has('csv-map')) {
+ $this->map = (array)Session::get('csv-map');
+ }
+ }
+
+ protected function sessionRoles()
+ {
+ if (Session::has('csv-roles')) {
+ $this->roles = (array)Session::get('csv-roles');
+ }
+ }
+
+ protected function sessionMapped()
+ {
+ if (Session::has('csv-mapped')) {
+ $this->mapped = (array)Session::get('csv-mapped');
+ }
+ }
+
+ protected function sessionSpecifix()
+ {
+ if (Session::has('csv-specifix')) {
+ $this->specifix = (array)Session::get('csv-specifix');
+ }
+ }
+
+ /**
+ * @return string
+ */
+ public function getDateFormat()
+ {
+ return $this->dateFormat;
+ }
+
+ /**
+ * @param mixed $dateFormat
+ */
+ public function setDateFormat($dateFormat)
+ {
+ Session::put('csv-date-format', $dateFormat);
+ $this->dateFormat = $dateFormat;
+ }
+
+ /**
+ * @return bool
+ */
+ public function hasHeaders()
+ {
+ return $this->hasHeaders;
+ }
+
+ /**
+ * @param bool $hasHeaders
+ */
+ public function setHasHeaders($hasHeaders)
+ {
+ Session::put('csv-has-headers', $hasHeaders);
+ $this->hasHeaders = $hasHeaders;
+ }
+
+ /**
+ * @return array
+ */
+ public function getMap()
+ {
+ return $this->map;
+ }
+
+ /**
+ * @param array $map
+ */
+ public function setMap(array $map)
+ {
+ Session::put('csv-map', $map);
+ $this->map = $map;
+ }
+
+ /**
+ * @return array
+ */
+ public function getMapped()
+ {
+ return $this->mapped;
+ }
+
+ /**
+ * @param array $mapped
+ */
+ public function setMapped(array $mapped)
+ {
+ Session::put('csv-mapped', $mapped);
+ $this->mapped = $mapped;
+ }
+
+ /**
+ * @return Reader
+ */
+ public function getReader()
+ {
+
+ if (strlen($this->csvFileContent) === 0) {
+ $this->loadCsvFile();
+ }
+
+ if (is_null($this->reader)) {
+ $this->reader = Reader::createFromString($this->getCsvFileContent());
+ }
+
+ return $this->reader;
+ }
+
+ protected function loadCsvFile()
+ {
+ $file = $this->getCsvFileLocation();
+ $content = file_get_contents($file);
+ $contentDecrypted = Crypt::decrypt($content);
+ $this->setCsvFileContent($contentDecrypted);
+ }
+
+ /**
+ * @return string
+ */
+ public function getCsvFileLocation()
+ {
+ return $this->csvFileLocation;
+ }
+
+ /**
+ * @param string $csvFileLocation
+ */
+ public function setCsvFileLocation($csvFileLocation)
+ {
+ Session::put('csv-file', $csvFileLocation);
+ $this->csvFileLocation = $csvFileLocation;
+ }
+
+ /**
+ * @return string
+ */
+ public function getCsvFileContent()
+ {
+ return $this->csvFileContent;
+ }
+
+ /**
+ * @param string $csvFileContent
+ */
+ public function setCsvFileContent($csvFileContent)
+ {
+ $this->csvFileContent = $csvFileContent;
+ }
+
+ /**
+ * @return array
+ */
+ public function getRoles()
+ {
+ return $this->roles;
+ }
+
+ /**
+ * @param array $roles
+ */
+ public function setRoles(array $roles)
+ {
+ Session::put('csv-roles', $roles);
+ $this->roles = $roles;
+ }
+
+ /**
+ * @return array
+ */
+ public function getSpecifix()
+ {
+ return $this->specifix;
+ }
+
+ /**
+ * @param array $specifix
+ */
+ public function setSpecifix($specifix)
+ {
+ Session::put('csv-specifix', $specifix);
+ $this->specifix = $specifix;
+ }
+
+
+}
\ No newline at end of file
diff --git a/app/Helpers/Csv/Importer.php b/app/Helpers/Csv/Importer.php
new file mode 100644
index 0000000000..fe8ca0f7dc
--- /dev/null
+++ b/app/Helpers/Csv/Importer.php
@@ -0,0 +1,331 @@
+errors;
+ }
+
+ /**
+ * Used by CsvController
+ *
+ * @return int
+ */
+ public function getImported()
+ {
+ return $this->imported;
+ }
+
+ /**
+ * Used by CsvController
+ *
+ * @return int
+ */
+ public function getRows()
+ {
+ return $this->rows;
+ }
+
+ /**
+ * @throws FireflyException
+ */
+ public function run()
+ {
+ set_time_limit(0);
+
+ $this->map = $this->data->getMap();
+ $this->roles = $this->data->getRoles();
+ $this->mapped = $this->data->getMapped();
+ $this->specifix = $this->data->getSpecifix();
+
+ foreach ($this->data->getReader() as $index => $row) {
+ if ($this->parseRow($index)) {
+ $this->rows++;
+ $result = $this->importRow($row);
+ if (!($result === true)) {
+ Log::error('Caught error at row #' . $index . ': ' . $result);
+ $this->errors[$index] = $result;
+ } else {
+ $this->imported++;
+ }
+ }
+ }
+ }
+
+ /**
+ * @param int $index
+ *
+ * @return bool
+ */
+ protected function parseRow($index)
+ {
+ return (($this->data->hasHeaders() && $index > 1) || !$this->data->hasHeaders());
+ }
+
+ /**
+ * @param $row
+ *
+ * @throws FireflyException
+ * @return string|bool
+ */
+ protected function importRow($row)
+ {
+ $data = $this->getFiller(); // These fields are necessary to create a new transaction journal. Some are optional
+ foreach ($row as $index => $value) {
+ $role = isset($this->roles[$index]) ? $this->roles[$index] : '_ignore';
+ $class = Config::get('csv.roles.' . $role . '.converter');
+ $field = Config::get('csv.roles.' . $role . '.field');
+
+ /** @var ConverterInterface $converter */
+ $converter = App::make('FireflyIII\Helpers\Csv\Converter\\' . $class);
+ $converter->setData($data); // the complete array so far.
+ $converter->setField($field);
+ $converter->setIndex($index);
+ $converter->setMapped($this->mapped);
+ $converter->setValue($value);
+ $converter->setRole($role);
+ $data[$field] = $converter->convert();
+
+ }
+ // move to class vars.
+ $this->importData = $data;
+ $this->importRow = $row;
+ unset($data, $row);
+ // post processing and validating.
+ $this->postProcess();
+ $result = $this->validateData();
+
+ if (!($result === true)) {
+ return $result; // return error.
+ }
+ $journal = $this->createTransactionJournal();
+ if ($journal instanceof TransactionJournal) {
+ return true;
+ }
+
+ return false;
+ }
+
+ /**
+ * @return array
+ */
+ protected function getFiller()
+ {
+ $filler = [];
+ foreach (Config::get('csv.roles') as $role) {
+ if (isset($role['field'])) {
+ $fieldName = $role['field'];
+ $filler[$fieldName] = null;
+ }
+ }
+ // some extra's:
+ $filler['bill-id'] = null;
+ $filler['opposing-account-object'] = null;
+ $filler['amount-modifier'] = '1';
+
+ return $filler;
+
+ }
+
+ /**
+ * Row denotes the original data.
+ *
+ * @return void
+ */
+ protected function postProcess()
+ {
+ // do bank specific fixes (must be enabled but now all of them.
+
+ foreach ($this->getSpecifix() as $className) {
+ /** @var SpecifixInterface $specifix */
+ $specifix = App::make('FireflyIII\Helpers\Csv\Specifix\\' . $className);
+ $specifix->setData($this->importData);
+ $specifix->setRow($this->importRow);
+ $this->importData = $specifix->fix();
+ }
+
+
+ $set = Config::get('csv.post_processors');
+ foreach ($set as $className) {
+ /** @var PostProcessorInterface $postProcessor */
+ $postProcessor = App::make('FireflyIII\Helpers\Csv\PostProcessing\\' . $className);
+ $postProcessor->setData($this->importData);
+ $this->importData = $postProcessor->process();
+ }
+
+ }
+
+ /**
+ * @return array
+ */
+ public function getSpecifix()
+ {
+ return $this->specifix;
+ }
+
+ /**
+ *
+ * @return bool|string
+ */
+ protected function validateData()
+ {
+ if (is_null($this->importData['date']) && is_null($this->importData['date-rent'])) {
+ return 'No date value for this row.';
+ }
+ if (is_null($this->importData['opposing-account-object'])) {
+ return 'Opposing account is null';
+ }
+
+ return true;
+ }
+
+ /**
+ *
+ * @return TransactionJournal|string
+ */
+ protected function createTransactionJournal()
+ {
+ bcscale(2);
+ $date = $this->importData['date'];
+ if (is_null($this->importData['date'])) {
+ $date = $this->importData['date-rent'];
+ }
+ $transactionType = $this->getTransactionType(); // defaults to deposit
+ $errors = new MessageBag;
+ $journal = TransactionJournal::create(
+ ['user_id' => Auth::user()->id, 'transaction_type_id' => $transactionType->id, 'transaction_currency_id' => $this->importData['currency']->id,
+ 'description' => $this->importData['description'], 'completed' => 0, 'date' => $date, 'bill_id' => $this->importData['bill-id'],]
+ );
+ if ($journal->getErrors()->count() == 0) {
+ $accountId = $this->importData['asset-account']->id; // create first transaction:
+ $amount = $this->importData['amount'];
+ $transaction = Transaction::create(['transaction_journal_id' => $journal->id, 'account_id' => $accountId, 'amount' => $amount]);
+ $errors = $transaction->getErrors();
+ $accountId = $this->importData['opposing-account-object']->id; // create second transaction:
+ $amount = bcmul($this->importData['amount'], -1);
+ $transaction = Transaction::create(['transaction_journal_id' => $journal->id, 'account_id' => $accountId, 'amount' => $amount]);
+ $errors = $transaction->getErrors()->merge($errors);
+ }
+ if ($errors->count() == 0) {
+ $journal->completed = 1;
+ $journal->save();
+ } else {
+ $text = join(',', $errors->all());
+
+ return $text;
+ }
+ $this->saveBudget($journal);
+ $this->saveCategory($journal);
+ $this->saveTags($journal);
+
+ return $journal;
+ }
+
+ /**
+ * @return TransactionType
+ */
+ protected function getTransactionType()
+ {
+ $transactionType = TransactionType::where('type', 'Deposit')->first();
+ if ($this->importData['amount'] < 0) {
+ $transactionType = TransactionType::where('type', 'Withdrawal')->first();
+ }
+
+ if (in_array($this->importData['opposing-account-object']->accountType->type, ['Asset account', 'Default account'])) {
+ $transactionType = TransactionType::where('type', 'Transfer')->first();
+ }
+
+ return $transactionType;
+ }
+
+ /**
+ * @param TransactionJournal $journal
+ */
+ protected function saveBudget(TransactionJournal $journal)
+ {
+ // add budget:
+ if (!is_null($this->importData['budget'])) {
+ $journal->budgets()->save($this->importData['budget']);
+ }
+ }
+
+ /**
+ * @param TransactionJournal $journal
+ */
+ protected function saveCategory(TransactionJournal $journal)
+ {
+ // add category:
+ if (!is_null($this->importData['category'])) {
+ $journal->categories()->save($this->importData['category']);
+ }
+ }
+
+ /**
+ * @param TransactionJournal $journal
+ */
+ protected function saveTags(TransactionJournal $journal)
+ {
+ if (!is_null($this->importData['tags'])) {
+ foreach ($this->importData['tags'] as $tag) {
+ $journal->tags()->save($tag);
+ }
+ }
+ }
+
+ /**
+ * @param Data $data
+ */
+ public function setData($data)
+ {
+ $this->data = $data;
+ }
+
+}
\ No newline at end of file
diff --git a/app/Helpers/Csv/Mapper/AnyAccount.php b/app/Helpers/Csv/Mapper/AnyAccount.php
new file mode 100644
index 0000000000..36fe8b20ed
--- /dev/null
+++ b/app/Helpers/Csv/Mapper/AnyAccount.php
@@ -0,0 +1,34 @@
+accounts()->with('accountType')->orderBy('accounts.name', 'ASC')->get(['accounts.*']);
+
+ $list = [];
+ /** @var Account $account */
+ foreach ($result as $account) {
+ $list[$account->id] = $account->name . ' (' . $account->accountType->type . ')';
+ }
+ asort($list);
+
+ array_unshift($list, trans('firefly.csv_do_not_map'));
+
+ return $list;
+ }
+}
\ No newline at end of file
diff --git a/app/Helpers/Csv/Mapper/AssetAccount.php b/app/Helpers/Csv/Mapper/AssetAccount.php
new file mode 100644
index 0000000000..6915533ea7
--- /dev/null
+++ b/app/Helpers/Csv/Mapper/AssetAccount.php
@@ -0,0 +1,45 @@
+accounts()->with(
+ ['accountmeta' => function (HasMany $query) {
+ $query->where('name', 'accountRole');
+ }]
+ )->accountTypeIn(['Default account', 'Asset account'])->orderBy('accounts.name', 'ASC')->get(['accounts.*']);
+
+ $list = [];
+
+ /** @var Account $account */
+ foreach ($result as $account) {
+ $name = $account->name;
+ if (strlen($account->iban) > 0) {
+ $name .= ' (' . $account->iban . ')';
+ }
+ $list[$account->id] = $name;
+ }
+
+ asort($list);
+
+ array_unshift($list, trans('firefly.csv_do_not_map'));
+
+ return $list;
+ }
+}
\ No newline at end of file
diff --git a/app/Helpers/Csv/Mapper/Bill.php b/app/Helpers/Csv/Mapper/Bill.php
new file mode 100644
index 0000000000..45f2de5897
--- /dev/null
+++ b/app/Helpers/Csv/Mapper/Bill.php
@@ -0,0 +1,34 @@
+bills()->get(['bills.*']);
+ $list = [];
+
+ /** @var BillModel $bill */
+ foreach ($result as $bill) {
+ $list[$bill->id] = $bill->name . ' [' . $bill->match . ']';
+ }
+ asort($list);
+
+ array_unshift($list, trans('firefly.csv_do_not_map'));
+
+ return $list;
+ }
+}
\ No newline at end of file
diff --git a/app/Helpers/Csv/Mapper/Budget.php b/app/Helpers/Csv/Mapper/Budget.php
new file mode 100644
index 0000000000..dbe8ebb03c
--- /dev/null
+++ b/app/Helpers/Csv/Mapper/Budget.php
@@ -0,0 +1,34 @@
+budgets()->get(['budgets.*']);
+ $list = [];
+
+ /** @var BudgetModel $budget */
+ foreach ($result as $budget) {
+ $list[$budget->id] = $budget->name;
+ }
+ asort($list);
+
+ array_unshift($list, trans('firefly.csv_do_not_map'));
+
+ return $list;
+ }
+}
\ No newline at end of file
diff --git a/app/Helpers/Csv/Mapper/Category.php b/app/Helpers/Csv/Mapper/Category.php
new file mode 100644
index 0000000000..7244a65a1a
--- /dev/null
+++ b/app/Helpers/Csv/Mapper/Category.php
@@ -0,0 +1,34 @@
+categories()->get(['categories.*']);
+ $list = [];
+
+ /** @var CategoryModel $category */
+ foreach ($result as $category) {
+ $list[$category->id] = $category->name;
+ }
+ asort($list);
+
+ array_unshift($list, trans('firefly.csv_do_not_map'));
+
+ return $list;
+ }
+}
\ No newline at end of file
diff --git a/app/Helpers/Csv/Mapper/MapperInterface.php b/app/Helpers/Csv/Mapper/MapperInterface.php
new file mode 100644
index 0000000000..a01785f9a4
--- /dev/null
+++ b/app/Helpers/Csv/Mapper/MapperInterface.php
@@ -0,0 +1,16 @@
+budgets()->get(['tags.*']);
+ $list = [];
+
+ /** @var TagModel $tag */
+ foreach ($result as $tag) {
+ $list[$tag->id] = $tag->tag;
+ }
+ asort($list);
+
+ array_unshift($list, trans('firefly.csv_do_not_map'));
+
+ return $list;
+ }
+}
\ No newline at end of file
diff --git a/app/Helpers/Csv/Mapper/TransactionCurrency.php b/app/Helpers/Csv/Mapper/TransactionCurrency.php
new file mode 100644
index 0000000000..4d6281acdc
--- /dev/null
+++ b/app/Helpers/Csv/Mapper/TransactionCurrency.php
@@ -0,0 +1,32 @@
+id] = $currency->name . ' (' . $currency->code . ')';
+ }
+
+ asort($list);
+
+ array_unshift($list, trans('firefly.csv_do_not_map'));
+
+ return $list;
+ }
+}
\ No newline at end of file
diff --git a/app/Helpers/Csv/PostProcessing/Amount.php b/app/Helpers/Csv/PostProcessing/Amount.php
new file mode 100644
index 0000000000..c4e6f6e890
--- /dev/null
+++ b/app/Helpers/Csv/PostProcessing/Amount.php
@@ -0,0 +1,35 @@
+data['amount'] = bcmul($this->data['amount'], $this->data['amount-modifier']);
+
+ return $this->data;
+ }
+
+ /**
+ * @param array $data
+ */
+ public function setData(array $data)
+ {
+ $this->data = $data;
+ }
+}
\ No newline at end of file
diff --git a/app/Helpers/Csv/PostProcessing/Bill.php b/app/Helpers/Csv/PostProcessing/Bill.php
new file mode 100644
index 0000000000..e21d8f6720
--- /dev/null
+++ b/app/Helpers/Csv/PostProcessing/Bill.php
@@ -0,0 +1,37 @@
+data['bill'])) {
+ $this->data['bill-id'] = $this->data['bill']->id;
+ }
+
+ return $this->data;
+ }
+
+ /**
+ * @param array $data
+ */
+ public function setData(array $data)
+ {
+ $this->data = $data;
+ }
+}
\ No newline at end of file
diff --git a/app/Helpers/Csv/PostProcessing/Currency.php b/app/Helpers/Csv/PostProcessing/Currency.php
new file mode 100644
index 0000000000..f985c6a881
--- /dev/null
+++ b/app/Helpers/Csv/PostProcessing/Currency.php
@@ -0,0 +1,41 @@
+data['currency'])) {
+ $currencyPreference = Preferences::get('currencyPreference', 'EUR');
+ $this->data['currency'] = TransactionCurrency::whereCode($currencyPreference->data)->first();
+ }
+
+ return $this->data;
+ }
+
+ /**
+ * @param array $data
+ */
+ public function setData(array $data)
+ {
+ $this->data = $data;
+ }
+}
\ No newline at end of file
diff --git a/app/Helpers/Csv/PostProcessing/Description.php b/app/Helpers/Csv/PostProcessing/Description.php
new file mode 100644
index 0000000000..2f2b019918
--- /dev/null
+++ b/app/Helpers/Csv/PostProcessing/Description.php
@@ -0,0 +1,38 @@
+data['description'] = trim($this->data['description']);
+ if (strlen($this->data['description']) == 0) {
+ $this->data['description'] = trans('firefly.csv_empty_description');
+ }
+
+
+ return $this->data;
+ }
+
+ /**
+ * @param array $data
+ */
+ public function setData(array $data)
+ {
+
+ $this->data = $data;
+ }
+}
\ No newline at end of file
diff --git a/app/Helpers/Csv/PostProcessing/OpposingAccount.php b/app/Helpers/Csv/PostProcessing/OpposingAccount.php
new file mode 100644
index 0000000000..f7690438be
--- /dev/null
+++ b/app/Helpers/Csv/PostProcessing/OpposingAccount.php
@@ -0,0 +1,196 @@
+checkIdNameObject();
+ if (!is_null($result)) {
+ return $result;
+ }
+
+ $result = $this->checkIbanString();
+ if (!is_null($result)) {
+ return $result;
+ }
+
+ $result = $this->checkNameString();
+ if (!is_null($result)) {
+ return $result;
+ }
+
+ return null;
+ }
+
+ /**
+ * @param array $data
+ */
+ public function setData(array $data)
+ {
+ $this->data = $data;
+ }
+
+ /**
+ * @return array
+ */
+ protected function checkIdNameObject()
+ {
+ if ($this->data['opposing-account-id'] instanceof Account) { // first priority. try to find the account based on ID, if any
+ $this->data['opposing-account-object'] = $this->data['opposing-account-id'];
+
+ return $this->data;
+ }
+ if ($this->data['opposing-account-iban'] instanceof Account) { // second: try to find the account based on IBAN, if any.
+ $this->data['opposing-account-object'] = $this->data['opposing-account-iban'];
+
+ return $this->data;
+ }
+
+ return null;
+ }
+
+ /**
+ * @return array|null
+ */
+ protected function checkIbanString()
+ {
+ $rules = ['iban' => 'iban'];
+ $check = ['iban' => $this->data['opposing-account-iban']];
+ $validator = Validator::make($check, $rules);
+ if (!$validator->fails()) {
+ $this->data['opposing-account-object'] = $this->parseIbanString();
+
+ return $this->data;
+ }
+
+ return null;
+ }
+
+ /**
+ * @return Account|null
+ */
+ protected function parseIbanString()
+ {
+ // create by name and/or iban.
+ $accounts = Auth::user()->accounts()->get();
+ foreach ($accounts as $entry) {
+ if ($entry->iban == $this->data['opposing-account-iban']) {
+
+ return $entry;
+ }
+ }
+ $account = $this->createAccount();
+
+ return $account;
+ }
+
+ /**
+ * @return Account|null
+ */
+ protected function createAccount()
+ {
+ $accountType = $this->getAccountType();
+
+ // create if not exists:
+ $name = is_string($this->data['opposing-account-name']) && strlen($this->data['opposing-account-name']) > 0 ? $this->data['opposing-account-name']
+ : $this->data['opposing-account-iban'];
+ $account = Account::firstOrCreateEncrypted(
+ [
+ 'user_id' => Auth::user()->id,
+ 'account_type_id' => $accountType->id,
+ 'name' => $name,
+ 'iban' => $this->data['opposing-account-iban'],
+ 'active' => true,
+ ]
+ );
+
+ return $account;
+ }
+
+ /**
+ *
+ * @return AccountType
+ */
+ protected function getAccountType()
+ {
+ // opposing account type:
+ if ($this->data['amount'] < 0) {
+ // create expense account:
+
+ return AccountType::where('type', 'Expense account')->first();
+ } else {
+ // create revenue account:
+
+ return AccountType::where('type', 'Revenue account')->first();
+
+
+ }
+ }
+
+ /**
+ * @return array|null
+ */
+ protected function checkNameString()
+ {
+ if ($this->data['opposing-account-name'] instanceof Account) { // third: try to find account based on name, if any.
+ $this->data['opposing-account-object'] = $this->data['opposing-account-name'];
+
+ return $this->data;
+ }
+ if (is_string($this->data['opposing-account-name'])) {
+ $this->data['opposing-account-object'] = $this->parseNameString();
+
+ return $this->data;
+ }
+
+ return null;
+ }
+
+ /**
+ * @return Account|null
+ */
+ protected function parseNameString()
+ {
+ $accountType = $this->getAccountType();
+ $accounts = Auth::user()->accounts()->where('account_type_id', $accountType->id)->get();
+ foreach ($accounts as $entry) {
+ if ($entry->name == $this->data['opposing-account-name']) {
+ Log::debug('Found an account with this name (#' . $entry->id . ': ' . $entry->name . ')');
+
+ return $entry;
+ }
+ }
+ // create if not exists:
+ $account = Account::firstOrCreateEncrypted(
+ [
+ 'user_id' => Auth::user()->id,
+ 'account_type_id' => $accountType->id,
+ 'name' => $this->data['opposing-account-name'],
+ 'iban' => '',
+ 'active' => true,
+ ]
+ );
+
+ return $account;
+ }
+}
\ No newline at end of file
diff --git a/app/Helpers/Csv/PostProcessing/PostProcessorInterface.php b/app/Helpers/Csv/PostProcessing/PostProcessorInterface.php
new file mode 100644
index 0000000000..88a8ad1da7
--- /dev/null
+++ b/app/Helpers/Csv/PostProcessing/PostProcessorInterface.php
@@ -0,0 +1,29 @@
+data;
+
+ }
+
+ /**
+ * @param array $data
+ */
+ public function setData($data)
+ {
+ $this->data = $data;
+ }
+
+ /**
+ * @param array $row
+ */
+ public function setRow($row)
+ {
+ $this->row = $row;
+ }
+
+
+}
\ No newline at end of file
diff --git a/app/Helpers/Csv/Specifix/RabobankDescription.php b/app/Helpers/Csv/Specifix/RabobankDescription.php
new file mode 100644
index 0000000000..2a2f7211e9
--- /dev/null
+++ b/app/Helpers/Csv/Specifix/RabobankDescription.php
@@ -0,0 +1,58 @@
+rabobankFixEmptyOpposing();
+
+ return $this->data;
+
+ }
+
+ /**
+ * Fixes Rabobank specific thing.
+ */
+ protected function rabobankFixEmptyOpposing()
+ {
+ if (strlen($this->data['opposing-account-name']) == 0) {
+ $this->data['opposing-account-name'] = $this->row[10];
+ }
+ $this->data['description'] = trim(str_replace($this->row[10], '', $this->data['description']));
+ }
+
+ /**
+ * @param array $data
+ */
+ public function setData($data)
+ {
+ $this->data = $data;
+ }
+
+ /**
+ * @param array $row
+ */
+ public function setRow($row)
+ {
+ $this->row = $row;
+ }
+
+
+}
\ No newline at end of file
diff --git a/app/Helpers/Csv/Specifix/SpecifixInterface.php b/app/Helpers/Csv/Specifix/SpecifixInterface.php
new file mode 100644
index 0000000000..a71e3cb45a
--- /dev/null
+++ b/app/Helpers/Csv/Specifix/SpecifixInterface.php
@@ -0,0 +1,25 @@
+ $row) {
+ if ($this->useRow($hasHeaders, $index)) {
+ // collect all map values
+
+ foreach ($keys as $column) {
+ $values[$column][] = $row[$column];
+ }
+ }
+ }
+ /*
+ * Make each one unique.
+ */
+ foreach ($values as $column => $found) {
+ $values[$column] = array_unique($found);
+ }
+
+ return $values;
+ }
+
+ /**
+ * @param array $roles
+ * @param mixed $map
+ *
+ * @return array
+ */
+ public function processSelectedMapping(array $roles, $map)
+ {
+ $configRoles = Config::get('csv.roles');
+ $maps = [];
+
+
+ if (is_array($map)) {
+ foreach ($map as $index => $field) {
+ if (isset($roles[$index])) {
+ $name = $roles[$index];
+ if ($configRoles[$name]['mappable']) {
+ $maps[$index] = $name;
+ }
+ }
+ }
+ }
+
+ return $maps;
+
+ }
+
+ /**
+ * @param mixed $input
+ *
+ * @return array
+ */
+ public function processSelectedRoles($input)
+ {
+ $roles = [];
+
+
+ /*
+ * Store all rows for each column:
+ */
+ if (is_array($input)) {
+ foreach ($input as $index => $role) {
+ if ($role != '_ignore') {
+ $roles[$index] = $role;
+ }
+ }
+ }
+
+ return $roles;
+ }
+
+ /**
+ * @param array $fields
+ *
+ * @return bool
+ */
+ public function sessionHasValues(array $fields)
+ {
+ foreach ($fields as $field) {
+ if (!Session::has($field)) {
+ return false;
+ }
+ }
+
+ return true;
+ }
+
+ /**
+ * @param array $map
+ *
+ * @return array
+ * @throws FireflyException
+ */
+ public function showOptions(array $map)
+ {
+ $options = [];
+ foreach ($map as $index => $columnRole) {
+
+ $mapper = Config::get('csv.roles.' . $columnRole . '.mapper');
+ if (is_null($mapper)) {
+ throw new FireflyException('Cannot map field of type "' . $columnRole . '".');
+ }
+ $class = 'FireflyIII\Helpers\Csv\Mapper\\' . $mapper;
+ try {
+ /** @var MapperInterface $mapObject */
+ $mapObject = App::make($class);
+ } catch (ReflectionException $e) {
+ throw new FireflyException('Column "' . $columnRole . '" cannot be mapped because class ' . $mapper . ' does not exist.');
+ }
+ $set = $mapObject->getMap();
+ $options[$index] = $set;
+ }
+
+ return $options;
+ }
+
+ /**
+ * @param $path
+ *
+ * @return string
+ */
+ public function storeCsvFile($path)
+ {
+ $time = str_replace(' ', '-', microtime());
+ $fileName = 'csv-upload-' . Auth::user()->id . '-' . $time . '.csv.encrypted';
+ $fullPath = storage_path('upload') . DIRECTORY_SEPARATOR . $fileName;
+ $content = file_get_contents($path);
+ $contentEncrypted = Crypt::encrypt($content);
+ file_put_contents($fullPath, $contentEncrypted);
+
+ return $fullPath;
+
+
+ }
+
+ /**
+ * @param bool $hasHeaders
+ * @param int $index
+ *
+ * @return bool
+ */
+ protected function useRow($hasHeaders, $index)
+ {
+ return ($hasHeaders && $index > 1) || !$hasHeaders;
+ }
+}
\ No newline at end of file
diff --git a/app/Helpers/Csv/WizardInterface.php b/app/Helpers/Csv/WizardInterface.php
new file mode 100644
index 0000000000..bd86a21495
--- /dev/null
+++ b/app/Helpers/Csv/WizardInterface.php
@@ -0,0 +1,59 @@
+query->getAllAccounts($date, $end, $shared);
- $start = 0;
- $end = 0;
- $diff = 0;
+ $start = '0';
+ $end = '0';
+ $diff = '0';
+ bcscale(2);
// remove cash account, if any:
$accounts = $accounts->filter(
@@ -77,9 +78,9 @@ class ReportHelper implements ReportHelperInterface
// summarize:
foreach ($accounts as $account) {
- $start += $account->startBalance;
- $end += $account->endBalance;
- $diff += ($account->endBalance - $account->startBalance);
+ $start = bcadd($start, $account->startBalance);
+ $end = bcadd($end, $account->endBalance);
+ $diff = bcadd($diff, ($account->endBalance - $account->startBalance));
}
$object = new AccountCollection;
@@ -201,11 +202,10 @@ class ReportHelper implements ReportHelperInterface
*
* @param Carbon $start
* @param Carbon $end
- * @param boolean $shared
*
* @return BillCollection
*/
- public function getBillReport(Carbon $start, Carbon $end, $shared)
+ public function getBillReport(Carbon $start, Carbon $end)
{
/** @var \FireflyIII\Repositories\Bill\BillRepositoryInterface $repository */
$repository = App::make('FireflyIII\Repositories\Bill\BillRepositoryInterface');
diff --git a/app/Helpers/Report/ReportHelperInterface.php b/app/Helpers/Report/ReportHelperInterface.php
index 75ffbdfd0c..f3dbf42546 100644
--- a/app/Helpers/Report/ReportHelperInterface.php
+++ b/app/Helpers/Report/ReportHelperInterface.php
@@ -37,11 +37,10 @@ interface ReportHelperInterface
*
* @param Carbon $start
* @param Carbon $end
- * @param boolean $shared
*
* @return BillCollection
*/
- public function getBillReport(Carbon $start, Carbon $end, $shared);
+ public function getBillReport(Carbon $start, Carbon $end);
/**
* @param Carbon $start
diff --git a/app/Helpers/Report/ReportQuery.php b/app/Helpers/Report/ReportQuery.php
index b2ac2eb624..4d73653c9f 100644
--- a/app/Helpers/Report/ReportQuery.php
+++ b/app/Helpers/Report/ReportQuery.php
@@ -54,9 +54,7 @@ class ReportQuery implements ReportQueryInterface
$query->where('transaction_types.type', 'Withdrawal'); // any withdrawal is fine.
}
$query->orderBy('transaction_journals.date');
-
- // get everything
- $data = $query->get(
+ $data = $query->get( // get everything
['transaction_journals.*', 'transaction_types.type', 'ac_to.name as name', 'ac_to.id as account_id', 'ac_to.encrypted as account_encrypted']
);
@@ -227,11 +225,10 @@ class ReportQuery implements ReportQueryInterface
* @param Account $account
* @param Carbon $start
* @param Carbon $end
- * @param bool $shared
*
* @return string
*/
- public function spentNoBudget(Account $account, Carbon $start, Carbon $end, $shared = false)
+ public function spentNoBudget(Account $account, Carbon $start, Carbon $end)
{
return
Auth::user()->transactionjournals()
diff --git a/app/Helpers/Report/ReportQueryInterface.php b/app/Helpers/Report/ReportQueryInterface.php
index 9705193dd0..c48aeeab59 100644
--- a/app/Helpers/Report/ReportQueryInterface.php
+++ b/app/Helpers/Report/ReportQueryInterface.php
@@ -71,11 +71,10 @@ interface ReportQueryInterface
* @param Account $account
* @param Carbon $start
* @param Carbon $end
- * @param bool $shared
*
* @return string
*/
- public function spentNoBudget(Account $account, Carbon $start, Carbon $end, $shared = false);
+ public function spentNoBudget(Account $account, Carbon $start, Carbon $end);
}
diff --git a/app/Http/Controllers/AccountController.php b/app/Http/Controllers/AccountController.php
index be1a8545c8..0a904f593c 100644
--- a/app/Http/Controllers/AccountController.php
+++ b/app/Http/Controllers/AccountController.php
@@ -8,7 +8,6 @@ use FireflyIII\Models\Account;
use FireflyIII\Repositories\Account\AccountRepositoryInterface;
use Input;
use Preferences;
-use Redirect;
use Session;
use Steam;
use URL;
@@ -89,7 +88,7 @@ class AccountController extends Controller
Session::flash('success', trans('firefly.' . $typeName . '_deleted', ['name' => $name]));
Preferences::mark();
- return Redirect::to(Session::get('accounts.delete.url'));
+ return redirect(Session::get('accounts.delete.url'));
}
/**
@@ -199,13 +198,15 @@ class AccountController extends Controller
'virtualBalance' => floatval($request->input('virtualBalance')),
'active' => true,
'user' => Auth::user()->id,
+ 'iban' => $request->input('iban'),
'accountRole' => $request->input('accountRole'),
'openingBalance' => floatval($request->input('openingBalance')),
'openingBalanceDate' => new Carbon((string)$request->input('openingBalanceDate')),
'openingBalanceCurrency' => intval($request->input('balance_currency_id')),
];
- $account = $repository->store($accountData);
+
+ $account = $repository->store($accountData);
Session::flash('success', 'New account "' . $account->name . '" stored!');
Preferences::mark();
@@ -214,13 +215,11 @@ class AccountController extends Controller
// set value so create routine will not overwrite URL:
Session::put('accounts.create.fromStore', true);
- return Redirect::route('accounts.create')->withInput();
+ return redirect(route('accounts.create', [$request->input('what')]))->withInput();
}
// redirect to previous URL.
- return Redirect::to(Session::get('accounts.create.url'));
-
-
+ return redirect(Session::get('accounts.create.url'));
}
/**
@@ -237,6 +236,7 @@ class AccountController extends Controller
'name' => $request->input('name'),
'active' => $request->input('active'),
'user' => Auth::user()->id,
+ 'iban' => $request->input('iban'),
'accountRole' => $request->input('accountRole'),
'virtualBalance' => floatval($request->input('virtualBalance')),
'openingBalance' => floatval($request->input('openingBalance')),
@@ -246,6 +246,7 @@ class AccountController extends Controller
'ccMonthlyPaymentDate' => $request->input('ccMonthlyPaymentDate'),
];
+
$repository->update($account, $accountData);
Session::flash('success', 'Account "' . $account->name . '" updated.');
@@ -255,11 +256,11 @@ class AccountController extends Controller
// set value so edit routine will not overwrite URL:
Session::put('accounts.edit.fromUpdate', true);
- return Redirect::route('accounts.edit', [$account->id])->withInput(['return_to_edit' => 1]);
+ return redirect(route('accounts.edit', [$account->id]))->withInput(['return_to_edit' => 1]);
}
// redirect to previous URL.
- return Redirect::to(Session::get('accounts.edit.url'));
+ return redirect(Session::get('accounts.edit.url'));
}
diff --git a/app/Http/Controllers/BillController.php b/app/Http/Controllers/BillController.php
index 5439dcb676..ca59f0d256 100644
--- a/app/Http/Controllers/BillController.php
+++ b/app/Http/Controllers/BillController.php
@@ -7,7 +7,6 @@ use FireflyIII\Models\TransactionJournal;
use FireflyIII\Repositories\Bill\BillRepositoryInterface;
use Input;
use Preferences;
-use Redirect;
use Session;
use URL;
use View;
@@ -79,8 +78,7 @@ class BillController extends Controller
Session::flash('success', 'The bill was deleted.');
Preferences::mark();
- return Redirect::to(Session::get('bills.delete.url'));
-
+ return redirect(Session::get('bills.delete.url'));
}
/**
@@ -133,7 +131,7 @@ class BillController extends Controller
if (intval($bill->active) == 0) {
Session::flash('warning', 'Inactive bills cannot be scanned.');
- return Redirect::to(URL::previous());
+ return redirect(URL::previous());
}
$journals = $repository->getPossiblyRelatedJournals($bill);
@@ -146,7 +144,7 @@ class BillController extends Controller
Session::flash('success', 'Rescanned everything.');
Preferences::mark();
- return Redirect::to(URL::previous());
+ return redirect(URL::previous());
}
/**
@@ -182,11 +180,11 @@ class BillController extends Controller
// set value so create routine will not overwrite URL:
Session::put('bills.create.fromStore', true);
- return Redirect::route('bills.create')->withInput();
+ return redirect(route('bills.create'))->withInput();
}
// redirect to previous URL.
- return Redirect::to(Session::get('bills.create.url'));
+ return redirect(Session::get('bills.create.url'));
}
@@ -209,11 +207,11 @@ class BillController extends Controller
// set value so edit routine will not overwrite URL:
Session::put('bills.edit.fromUpdate', true);
- return Redirect::route('bills.edit', [$bill->id])->withInput(['return_to_edit' => 1]);
+ return redirect(route('bills.edit', [$bill->id]))->withInput(['return_to_edit' => 1]);
}
// redirect to previous URL.
- return Redirect::to(Session::get('bills.edit.url'));
+ return redirect(Session::get('bills.edit.url'));
}
diff --git a/app/Http/Controllers/BudgetController.php b/app/Http/Controllers/BudgetController.php
index 04f3b4706a..5e698ee423 100644
--- a/app/Http/Controllers/BudgetController.php
+++ b/app/Http/Controllers/BudgetController.php
@@ -9,7 +9,6 @@ use FireflyIII\Models\LimitRepetition;
use FireflyIII\Repositories\Budget\BudgetRepositoryInterface;
use Input;
use Preferences;
-use Redirect;
use Response;
use Session;
use URL;
@@ -106,7 +105,7 @@ class BudgetController extends Controller
Preferences::mark();
- return Redirect::to(Session::get('budgets.delete.url'));
+ return redirect(Session::get('budgets.delete.url'));
}
/**
@@ -200,7 +199,7 @@ class BudgetController extends Controller
Preferences::set('budgetIncomeTotal' . $date, intval(Input::get('amount')));
Preferences::mark();
- return Redirect::route('budgets.index');
+ return redirect(route('budgets.index'));
}
/**
@@ -254,11 +253,11 @@ class BudgetController extends Controller
// set value so create routine will not overwrite URL:
Session::put('budgets.create.fromStore', true);
- return Redirect::route('budgets.create')->withInput();
+ return redirect(route('budgets.create'))->withInput();
}
// redirect to previous URL.
- return Redirect::to(Session::get('budgets.create.url'));
+ return redirect(Session::get('budgets.create.url'));
}
@@ -285,11 +284,11 @@ class BudgetController extends Controller
// set value so edit routine will not overwrite URL:
Session::put('budgets.edit.fromUpdate', true);
- return Redirect::route('budgets.edit', [$budget->id])->withInput(['return_to_edit' => 1]);
+ return redirect(route('budgets.edit', [$budget->id]))->withInput(['return_to_edit' => 1]);
}
// redirect to previous URL.
- return Redirect::to(Session::get('budgets.edit.url'));
+ return redirect(Session::get('budgets.edit.url'));
}
diff --git a/app/Http/Controllers/CategoryController.php b/app/Http/Controllers/CategoryController.php
index 0a6bc918b0..790d2fd822 100644
--- a/app/Http/Controllers/CategoryController.php
+++ b/app/Http/Controllers/CategoryController.php
@@ -8,7 +8,6 @@ use FireflyIII\Repositories\Category\CategoryRepositoryInterface;
use Illuminate\Pagination\LengthAwarePaginator;
use Input;
use Preferences;
-use Redirect;
use Session;
use URL;
use View;
@@ -80,7 +79,7 @@ class CategoryController extends Controller
Session::flash('success', 'The category "' . e($name) . '" was deleted.');
Preferences::mark();
- return Redirect::to(Session::get('categories.delete.url'));
+ return redirect(Session::get('categories.delete.url'));
}
/**
@@ -178,10 +177,10 @@ class CategoryController extends Controller
if (intval(Input::get('create_another')) === 1) {
Session::put('categories.create.fromStore', true);
- return Redirect::route('categories.create')->withInput();
+ return redirect(route('categories.create'))->withInput();
}
- return Redirect::route('categories.index');
+ return redirect(route('categories.index'));
}
@@ -206,11 +205,11 @@ class CategoryController extends Controller
if (intval(Input::get('return_to_edit')) === 1) {
Session::put('categories.edit.fromUpdate', true);
- return Redirect::route('categories.edit', [$category->id]);
+ return redirect(route('categories.edit', [$category->id]));
}
// redirect to previous URL.
- return Redirect::to(Session::get('categories.edit.url'));
+ return redirect(Session::get('categories.edit.url'));
}
diff --git a/app/Http/Controllers/Chart/BudgetController.php b/app/Http/Controllers/Chart/BudgetController.php
index 45bd8a2a44..ad7192415d 100644
--- a/app/Http/Controllers/Chart/BudgetController.php
+++ b/app/Http/Controllers/Chart/BudgetController.php
@@ -93,6 +93,7 @@ class BudgetController extends Controller
{
$start = clone $repetition->startdate;
$end = $repetition->enddate;
+ bcscale(2);
// chart properties for cache:
$cache = new CacheProperties();
@@ -113,8 +114,8 @@ class BudgetController extends Controller
/*
* Sum of expenses on this day:
*/
- $sum = $repository->expensesOnDayCorrected($budget, $start);
- $amount += $sum;
+ $sum = $repository->expensesOnDayCorrected($budget, $start);
+ $amount = bcadd($amount, $sum);
$entries->push([clone $start, $amount]);
$start->addDay();
}
diff --git a/app/Http/Controllers/Chart/CategoryController.php b/app/Http/Controllers/Chart/CategoryController.php
index 28f4f17bf5..917bb76b08 100644
--- a/app/Http/Controllers/Chart/CategoryController.php
+++ b/app/Http/Controllers/Chart/CategoryController.php
@@ -176,9 +176,7 @@ class CategoryController extends Controller
$start = new Carbon($year . '-01-01');
$end = new Carbon($year . '-12-31');
-
- // chart properties for cache:
- $cache = new CacheProperties;
+ $cache = new CacheProperties; // chart properties for cache:
$cache->addProperty($start);
$cache->addProperty($end);
$cache->addProperty('category');
@@ -192,14 +190,11 @@ class CategoryController extends Controller
$entries = new Collection;
while ($start < $end) {
- // month is the current end of the period:
- $month = clone $start;
+ $month = clone $start; // month is the current end of the period
$month->endOfMonth();
- // make a row:
- $row = [clone $start];
+ $row = [clone $start]; // make a row:
- // each budget, fill the row:
- foreach ($categories as $category) {
+ foreach ($categories as $category) { // each budget, fill the row
$spent = $repository->spentInPeriodCorrected($category, $start, $month, $shared);
$row[] = $spent;
}
diff --git a/app/Http/Controllers/CsvController.php b/app/Http/Controllers/CsvController.php
new file mode 100644
index 0000000000..6349b0a47a
--- /dev/null
+++ b/app/Http/Controllers/CsvController.php
@@ -0,0 +1,401 @@
+wizard = App::make('FireflyIII\Helpers\Csv\WizardInterface');
+ $this->data = App::make('FireflyIII\Helpers\Csv\Data');
+
+ }
+
+ /**
+ * Define column roles and mapping.
+ *
+ * STEP THREE
+ *
+ * @return \Illuminate\Http\RedirectResponse|\Illuminate\View\View
+ */
+ public function columnRoles()
+ {
+
+ $fields = ['csv-file', 'csv-date-format', 'csv-has-headers'];
+ if (!$this->wizard->sessionHasValues($fields)) {
+ Session::flash('warning', 'Could not recover upload.');
+
+ return redirect(route('csv.index'));
+ }
+
+ $subTitle = trans('firefly.csv_define_column_roles');
+ $firstRow = $this->data->getReader()->fetchOne();
+ $count = count($firstRow);
+ $headers = [];
+ $example = $this->data->getReader()->fetchOne(1);
+ $availableRoles = [];
+ $roles = $this->data->getRoles();
+ $map = $this->data->getMap();
+
+ for ($i = 1; $i <= $count; $i++) {
+ $headers[] = trans('firefly.csv_column') . ' #' . $i;
+ }
+ if ($this->data->hasHeaders()) {
+ $headers = $firstRow;
+ }
+
+ foreach (Config::get('csv.roles') as $name => $role) {
+ $availableRoles[$name] = trans('firefly.csv_column_' . $name);//$role['name'];
+ }
+ ksort($availableRoles);
+
+ return view('csv.column-roles', compact('availableRoles', 'map', 'roles', 'headers', 'example', 'subTitle'));
+ }
+
+ /**
+ * Optional download of mapping.
+ *
+ * STEP FOUR THREE-A
+ *
+ * @return \Illuminate\Http\RedirectResponse|string
+ */
+ public function downloadConfig()
+ {
+ $fields = ['csv-date-format', 'csv-has-headers'];
+ if (!$this->wizard->sessionHasValues($fields)) {
+ Session::flash('warning', 'Could not recover upload.');
+
+ return redirect(route('csv.index'));
+ }
+ $data = [
+ 'date-format' => Session::get('date-format'),
+ 'has-headers' => Session::get('csv-has-headers')
+ ];
+ if (Session::has('csv-map')) {
+ $data['map'] = Session::get('csv-map');
+ }
+ if (Session::has('csv-roles')) {
+ $data['roles'] = Session::get('csv-roles');
+ }
+ if (Session::has('csv-mapped')) {
+ $data['mapped'] = Session::get('csv-mapped');
+ }
+
+ $result = json_encode($data, JSON_PRETTY_PRINT);
+ $name = 'csv-configuration-' . date('Y-m-d') . '.json';
+
+ header('Content-disposition: attachment; filename=' . $name);
+ header('Content-type: application/json');
+ echo $result;
+
+ return '';
+ }
+
+ /**
+ * @return \Illuminate\View\View
+ */
+ public function downloadConfigPage()
+ {
+ $subTitle = trans('firefly.csv_download_config_title');
+
+ return view('csv.download-config', compact('subTitle'));
+ }
+
+ /**
+ * This method shows the initial upload form.
+ *
+ * STEP ONE
+ *
+ * @return \Illuminate\View\View
+ */
+ public function index()
+ {
+ $subTitle = trans('firefly.csv_import');
+
+ Session::forget('csv-date-format');
+ Session::forget('csv-has-headers');
+ Session::forget('csv-file');
+ Session::forget('csv-map');
+ Session::forget('csv-roles');
+ Session::forget('csv-mapped');
+ Session::forget('csv-specifix');
+
+ // get list of supported specifix
+ $specifix = [];
+ foreach (Config::get('csv.specifix') as $entry) {
+ $specifix[$entry] = trans('firefly.csv_specifix_' . $entry);
+ }
+
+ // can actually upload?
+ $uploadPossible = is_writable(storage_path('upload'));
+ $path = storage_path('upload');
+
+ return view('csv.index', compact('subTitle', 'uploadPossible', 'path', 'specifix'));
+ }
+
+ /**
+ * Parse the file.
+ *
+ * STEP FOUR
+ *
+ * @return \Illuminate\Http\RedirectResponse
+ */
+ public function initialParse()
+ {
+ $fields = ['csv-file', 'csv-date-format', 'csv-has-headers'];
+ if (!$this->wizard->sessionHasValues($fields)) {
+ Session::flash('warning', 'Could not recover upload.');
+
+ return redirect(route('csv.index'));
+ }
+
+ // process given roles and mapping:
+ $roles = $this->wizard->processSelectedRoles(Input::get('role'));
+ $maps = $this->wizard->processSelectedMapping($roles, Input::get('map'));
+
+ Session::put('csv-map', $maps);
+ Session::put('csv-roles', $roles);
+
+ // Go back when no roles defined:
+ if (count($roles) === 0) {
+ Session::flash('warning', 'Please select some roles.');
+
+ return redirect(route('csv.column-roles'));
+ }
+
+ /*
+ * Continue with map specification when necessary.
+ */
+ if (count($maps) > 0) {
+ return redirect(route('csv.map'));
+ }
+
+ /*
+ * Or simply start processing.
+ */
+
+ // proceed to download config
+ return redirect(route('csv.download-config-page'));
+
+ }
+
+ /**
+ *
+ * Map first if necessary,
+ *
+ * STEP FIVE.
+ *
+ * @return \Illuminate\Http\RedirectResponse|\Illuminate\View\View
+ * @throws FireflyException
+ */
+ public function map()
+ {
+
+ // Make sure all fields we need are accounted for.
+ $fields = ['csv-file', 'csv-date-format', 'csv-has-headers', 'csv-map', 'csv-roles'];
+ if (!$this->wizard->sessionHasValues($fields)) {
+ Session::flash('warning', 'Could not recover upload.');
+
+ return redirect(route('csv.index'));
+ }
+ /*
+ * The "options" array contains all options the user has
+ * per column, where the key represents the column.
+ *
+ * For each key there is an array which in turn represents
+ * all the options available: grouped by ID.
+ *
+ * options[column index] = [
+ * field id => field identifier.
+ * ]
+ */
+ try {
+ $options = $this->wizard->showOptions($this->data->getMap());
+ } catch (FireflyException $e) {
+ return view('error', ['message' => $e->getMessage()]);
+ }
+
+ // After these values are prepped, read the actual CSV file
+ $reader = $this->data->getReader();
+ $map = $this->data->getMap();
+ $hasHeaders = $this->data->hasHeaders();
+ $values = $this->wizard->getMappableValues($reader, $map, $hasHeaders);
+ $map = $this->data->getMap();
+ $mapped = $this->data->getMapped();
+ $subTitle = trans('firefly.csv_map_values');
+
+ return view('csv.map', compact('map', 'options', 'values', 'mapped', 'subTitle'));
+ }
+
+ /**
+ *
+ * Finally actually process the CSV file.
+ *
+ * STEP SEVEN
+ *
+ * @return \Illuminate\Http\RedirectResponse|\Illuminate\View\View
+ */
+ public function process()
+ {
+ /*
+ * Make sure all fields we need are accounted for.
+ */
+ $fields = ['csv-file', 'csv-date-format', 'csv-has-headers', 'csv-map', 'csv-roles', 'csv-mapped'];
+ if (!$this->wizard->sessionHasValues($fields)) {
+ Session::flash('warning', 'Could not recover upload.');
+
+ return redirect(route('csv.index'));
+ }
+
+ Log::debug('Created importer');
+ $importer = new Importer;
+ $importer->setData($this->data);
+ try {
+ $importer->run();
+ } catch (FireflyException $e) {
+ Log::error('Catch error: ' . $e->getMessage());
+
+ return view('error', ['message' => $e->getMessage()]);
+ }
+ Log::debug('Done importing!');
+
+ $rows = $importer->getRows();
+ $errors = $importer->getErrors();
+ $imported = $importer->getImported();
+
+ Preferences::mark();
+
+ $subTitle = trans('firefly.csv_process_title');
+
+ return view('csv.process', compact('rows', 'errors', 'imported', 'subTitle'));
+
+ }
+
+ /**
+ * Store the mapping the user has made. This is
+ *
+ * STEP SIX
+ *
+ * @return \Illuminate\Http\RedirectResponse
+ */
+ public function saveMapping()
+ {
+ /*
+ * Make sure all fields we need are accounted for.
+ */
+ $fields = ['csv-file', 'csv-date-format', 'csv-has-headers', 'csv-map', 'csv-roles'];
+ if (!$this->wizard->sessionHasValues($fields)) {
+ Session::flash('warning', 'Could not recover upload.');
+
+ return redirect(route('csv.index'));
+ }
+
+ // save mapping to session.
+ $mapped = [];
+ if (!is_array(Input::get('mapping'))) {
+ Session::flash('warning', 'Invalid mapping.');
+
+ return redirect(route('csv.map'));
+ }
+
+ foreach (Input::get('mapping') as $index => $data) {
+ $mapped[$index] = [];
+ foreach ($data as $value => $mapping) {
+ if (intval($mapping) !== 0) {
+ $mapped[$index][$value] = $mapping;
+ }
+ }
+ }
+ Session::put('csv-mapped', $mapped);
+
+ // proceed to process.
+ return redirect(route('csv.download-config-page'));
+
+ }
+
+ /**
+ *
+ * This method processes the file, puts it away somewhere safe
+ * and sends you onwards.
+ *
+ * STEP TWO
+ *
+ * @param Request $request
+ *
+ * @return \Illuminate\Http\RedirectResponse
+ */
+ public function upload(Request $request)
+ {
+ if (!$request->hasFile('csv')) {
+ Session::flash('warning', 'No file uploaded.');
+
+ return redirect(route('csv.index'));
+ }
+
+ $fullPath = $this->wizard->storeCsvFile($request->file('csv')->getRealPath());
+ $settings = [];
+ $settings['date-format'] = Input::get('date_format');
+ $settings['has-headers'] = intval(Input::get('has_headers')) === 1;
+ $settings['specifix'] = Input::get('specifix');
+ $settings['map'] = [];
+ $settings['mapped'] = [];
+ $settings['roles'] = [];
+
+ /*
+ * Process config file if present.
+ */
+ if ($request->hasFile('csv_config')) {
+ $data = file_get_contents($request->file('csv_config')->getRealPath());
+ $json = json_decode($data, true);
+ if (is_array($json)) {
+ $settings = array_merge($settings, $json);
+ }
+ }
+
+ $this->data->setCsvFileLocation($fullPath);
+ $this->data->setDateFormat($settings['date-format']);
+ $this->data->setHasHeaders($settings['has-headers']);
+ $this->data->setMap($settings['map']);
+ $this->data->setMapped($settings['mapped']);
+ $this->data->setRoles($settings['roles']);
+ $this->data->setSpecifix($settings['specifix']);
+
+ return redirect(route('csv.column-roles'));
+
+ }
+}
\ No newline at end of file
diff --git a/app/Http/Controllers/CurrencyController.php b/app/Http/Controllers/CurrencyController.php
index a1e6ac294d..b808805255 100644
--- a/app/Http/Controllers/CurrencyController.php
+++ b/app/Http/Controllers/CurrencyController.php
@@ -7,7 +7,6 @@ use FireflyIII\Models\TransactionCurrency;
use FireflyIII\Repositories\Currency\CurrencyRepositoryInterface;
use Input;
use Preferences;
-use Redirect;
use Session;
use URL;
use View;
@@ -65,7 +64,7 @@ class CurrencyController extends Controller
Cache::forget('FFCURRENCYSYMBOL');
Cache::forget('FFCURRENCYCODE');
- return Redirect::route('currency.index');
+ return redirect(route('currency.index'));
}
@@ -81,7 +80,7 @@ class CurrencyController extends Controller
if ($repository->countJournals($currency) > 0) {
Session::flash('error', 'Cannot delete ' . e($currency->name) . ' because there are still transactions attached to it.');
- return Redirect::route('currency.index');
+ return redirect(route('currency.index'));
}
// put previous url in session
@@ -106,7 +105,7 @@ class CurrencyController extends Controller
if ($repository->countJournals($currency) > 0) {
Session::flash('error', 'Cannot destroy ' . e($currency->name) . ' because there are still transactions attached to it.');
- return Redirect::route('currency.index');
+ return redirect(route('currency.index'));
}
Session::flash('success', 'Currency "' . e($currency->name) . '" deleted');
@@ -114,7 +113,7 @@ class CurrencyController extends Controller
$currency->delete();
}
- return Redirect::to(Session::get('currency.delete.url'));
+ return redirect(Session::get('currency.delete.url'));
}
/**
@@ -178,11 +177,11 @@ class CurrencyController extends Controller
if (intval(Input::get('create_another')) === 1) {
Session::put('currency.create.fromStore', true);
- return Redirect::route('currency.create')->withInput();
+ return redirect(route('currency.create'))->withInput();
}
// redirect to previous URL.
- return Redirect::to(Session::get('currency.create.url'));
+ return redirect(Session::get('currency.create.url'));
}
@@ -207,11 +206,11 @@ class CurrencyController extends Controller
if (intval(Input::get('return_to_edit')) === 1) {
Session::put('currency.edit.fromUpdate', true);
- return Redirect::route('currency.edit', [$currency->id]);
+ return redirect(route('currency.edit', [$currency->id]));
}
// redirect to previous URL.
- return Redirect::to(Session::get('currency.edit.url'));
+ return redirect(Session::get('currency.edit.url'));
}
diff --git a/app/Http/Controllers/HomeController.php b/app/Http/Controllers/HomeController.php
index 987967585c..78db6cc105 100644
--- a/app/Http/Controllers/HomeController.php
+++ b/app/Http/Controllers/HomeController.php
@@ -7,7 +7,6 @@ use FireflyIII\Models\Tag;
use FireflyIII\Repositories\Account\AccountRepositoryInterface;
use Input;
use Preferences;
-use Redirect;
use Route;
use Session;
use Steam;
@@ -40,6 +39,9 @@ class HomeController extends Controller
*/
public function flush()
{
+
+ Preferences::mark();
+
// get all tags.
// update all counts:
$tags = Tag::get();
@@ -56,7 +58,7 @@ class HomeController extends Controller
Session::clear();
- return Redirect::route('index');
+ return redirect(route('index'));
}
/**
@@ -68,10 +70,11 @@ class HomeController extends Controller
{
$types = Config::get('firefly.accountTypesByIdentifier.asset');
$count = $repository->countAccounts($types);
+ bcscale(2);
if ($count == 0) {
- return Redirect::route('new-user.index');
+ return redirect(route('new-user.index'));
}
$title = 'Firefly';
@@ -90,7 +93,7 @@ class HomeController extends Controller
$savingsTotal = 0;
foreach ($savings as $savingAccount) {
- $savingsTotal += Steam::balance($savingAccount, $end);
+ $savingsTotal = bcadd($savingsTotal, Steam::balance($savingAccount, $end));
}
$sum = $repository->sumOfEverything();
@@ -123,7 +126,7 @@ class HomeController extends Controller
if (!Auth::user()->hasRole('owner')) {
Session::flash('warning', 'This page is broken.');
- return Redirect::route('index');
+ return redirect(route('index'));
}
// get all routes:
diff --git a/app/Http/Controllers/JsonController.php b/app/Http/Controllers/JsonController.php
index 6dafae3266..e543534751 100644
--- a/app/Http/Controllers/JsonController.php
+++ b/app/Http/Controllers/JsonController.php
@@ -36,6 +36,7 @@ class JsonController extends Controller
{
$start = Session::get('start', Carbon::now()->startOfMonth());
$end = Session::get('end', Carbon::now()->endOfMonth());
+ bcscale(2);
// works for json too!
$cache = new CacheProperties;
@@ -54,7 +55,7 @@ class JsonController extends Controller
/** @var Bill $bill */
foreach ($bills as $bill) {
- $amount += $repository->billPaymentsInRange($bill, $start, $end);
+ $amount = bcadd($amount, $repository->billPaymentsInRange($bill, $start, $end));
}
unset($bill, $bills);
@@ -69,7 +70,7 @@ class JsonController extends Controller
if ($balance == 0) {
// find a transfer TO the credit card which should account for
// anything paid. If not, the CC is not yet used.
- $amount += $accountRepository->getTransfersInRange($creditCard, $start, $end)->sum('amount');
+ $amount = bcadd($amount, $accountRepository->getTransfersInRange($creditCard, $start, $end)->sum('amount'));
}
}
$data = ['box' => 'bills-paid', 'amount' => Amount::format($amount, false), 'amount_raw' => $amount];
@@ -90,6 +91,7 @@ class JsonController extends Controller
$amount = 0;
$start = Session::get('start', Carbon::now()->startOfMonth());
$end = Session::get('end', Carbon::now()->endOfMonth());
+ bcscale(2);
// works for json too!
$cache = new CacheProperties;
@@ -131,7 +133,7 @@ class JsonController extends Controller
/** @var Bill $entry */
foreach ($unpaid as $entry) {
$current = ($entry[0]->amount_max + $entry[0]->amount_min) / 2;
- $amount += $current;
+ $amount = bcadd($amount, $current);
}
$data = ['box' => 'bills-unpaid', 'amount' => Amount::format($amount, false), 'amount_raw' => $amount];
diff --git a/app/Http/Controllers/NewUserController.php b/app/Http/Controllers/NewUserController.php
index 563bf81e28..c8bd931660 100644
--- a/app/Http/Controllers/NewUserController.php
+++ b/app/Http/Controllers/NewUserController.php
@@ -7,7 +7,6 @@ use FireflyIII\Http\Requests\NewUserFormRequest;
use FireflyIII\Models\AccountMeta;
use FireflyIII\Repositories\Account\AccountRepositoryInterface;
use Preferences;
-use Redirect;
use Session;
use View;
@@ -35,7 +34,7 @@ class NewUserController extends Controller
$count = $repository->countAccounts($types);
if ($count > 0) {
- return Redirect::route('index');
+ return redirect(route('index'));
}
@@ -106,6 +105,6 @@ class NewUserController extends Controller
Session::flash('success', 'New account(s) created!');
Preferences::mark();
- return Redirect::route('index');
+ return redirect(route('index'));
}
}
diff --git a/app/Http/Controllers/PiggyBankController.php b/app/Http/Controllers/PiggyBankController.php
index fecc0978c3..049f4c83b3 100644
--- a/app/Http/Controllers/PiggyBankController.php
+++ b/app/Http/Controllers/PiggyBankController.php
@@ -11,7 +11,6 @@ use FireflyIII\Repositories\PiggyBank\PiggyBankRepositoryInterface;
use Illuminate\Support\Collection;
use Input;
use Preferences;
-use Redirect;
use Session;
use Steam;
use URL;
@@ -112,7 +111,7 @@ class PiggyBankController extends Controller
Preferences::mark();
$repository->destroy($piggyBank);
- return Redirect::to(Session::get('piggy-banks.delete.url'));
+ return redirect(Session::get('piggy-banks.delete.url'));
}
/**
@@ -167,6 +166,7 @@ class PiggyBankController extends Controller
/** @var Collection $piggyBanks */
$piggyBanks = $piggyRepository->getPiggyBanks();
$end = Session::get('end', Carbon::now()->endOfMonth());
+ bcscale(2);
$accounts = [];
/** @var PiggyBank $piggyBank */
@@ -189,9 +189,9 @@ class PiggyBankController extends Controller
'leftToSave' => $piggyBank->leftToSave
];
} else {
- $accounts[$account->id]['sumOfSaved'] += $piggyBank->savedSoFar;
- $accounts[$account->id]['sumOfTargets'] += floatval($piggyBank->targetamount);
- $accounts[$account->id]['leftToSave'] += $piggyBank->leftToSave;
+ $accounts[$account->id]['sumOfSaved'] = bcadd($accounts[$account->id]['sumOfSaved'], $piggyBank->savedSoFar);
+ $accounts[$account->id]['sumOfTargets'] = bcadd($accounts[$account->id]['sumOfTargets'], $piggyBank->targetamount);
+ $accounts[$account->id]['leftToSave'] = bcadd($accounts[$account->id]['leftToSave'], $piggyBank->leftToSave);
}
}
@@ -231,10 +231,11 @@ class PiggyBankController extends Controller
$savedSoFar = $piggyBank->currentRelevantRep()->currentamount;
$leftToSave = $piggyBank->targetamount - $savedSoFar;
$maxAmount = round(min($leftOnAccount, $leftToSave), 2);
+ bcscale(2);
if ($amount <= $maxAmount) {
- $repetition = $piggyBank->currentRelevantRep();
- $repetition->currentamount += $amount;
+ $repetition = $piggyBank->currentRelevantRep();
+ $repetition->currentamount = bcadd($repetition->currentamount, $amount);
$repetition->save();
// create event
@@ -246,7 +247,7 @@ class PiggyBankController extends Controller
Session::flash('error', 'Could not add ' . Amount::format($amount, false) . ' to "' . e($piggyBank->name) . '".');
}
- return Redirect::route('piggy-banks.index');
+ return redirect(route('piggy-banks.index'));
}
/**
@@ -258,12 +259,13 @@ class PiggyBankController extends Controller
public function postRemove(PiggyBankRepositoryInterface $repository, PiggyBank $piggyBank)
{
$amount = floatval(Input::get('amount'));
+ bcscale(2);
$savedSoFar = $piggyBank->currentRelevantRep()->currentamount;
if ($amount <= $savedSoFar) {
- $repetition = $piggyBank->currentRelevantRep();
- $repetition->currentamount -= $amount;
+ $repetition = $piggyBank->currentRelevantRep();
+ $repetition->currentamount = bcsub($repetition->currentamount, $amount);
$repetition->save();
// create event
@@ -275,7 +277,7 @@ class PiggyBankController extends Controller
Session::flash('error', 'Could not remove ' . Amount::format($amount, false) . ' from "' . e($piggyBank->name) . '".');
}
- return Redirect::route('piggy-banks.index');
+ return redirect(route('piggy-banks.index'));
}
/**
@@ -331,12 +333,12 @@ class PiggyBankController extends Controller
if (intval(Input::get('create_another')) === 1) {
Session::put('piggy-banks.create.fromStore', true);
- return Redirect::route('piggy-banks.create')->withInput();
+ return redirect(route('piggy-banks.create'))->withInput();
}
// redirect to previous URL.
- return Redirect::to(Session::get('piggy-banks.create.url'));
+ return redirect(Session::get('piggy-banks.create.url'));
}
/**
@@ -366,12 +368,12 @@ class PiggyBankController extends Controller
if (intval(Input::get('return_to_edit')) === 1) {
Session::put('piggy-banks.edit.fromUpdate', true);
- return Redirect::route('piggy-banks.edit', [$piggyBank->id]);
+ return redirect(route('piggy-banks.edit', [$piggyBank->id]));
}
// redirect to previous URL.
- return Redirect::to(Session::get('piggy-banks.edit.url'));
+ return redirect(Session::get('piggy-banks.edit.url'));
}
diff --git a/app/Http/Controllers/PreferencesController.php b/app/Http/Controllers/PreferencesController.php
index 5fd6e4fd24..8bfd176f53 100644
--- a/app/Http/Controllers/PreferencesController.php
+++ b/app/Http/Controllers/PreferencesController.php
@@ -4,7 +4,6 @@ use Config;
use FireflyIII\Repositories\Account\AccountRepositoryInterface;
use Input;
use Preferences;
-use Redirect;
use Session;
use View;
@@ -79,7 +78,7 @@ class PreferencesController extends Controller
Session::flash('success', 'Preferences saved!');
Preferences::mark();
- return Redirect::route('preferences');
+ return redirect(route('preferences'));
}
}
diff --git a/app/Http/Controllers/ProfileController.php b/app/Http/Controllers/ProfileController.php
index ae39246843..8a1c02d227 100644
--- a/app/Http/Controllers/ProfileController.php
+++ b/app/Http/Controllers/ProfileController.php
@@ -5,7 +5,6 @@ use FireflyIII\Http\Requests;
use FireflyIII\Http\Requests\DeleteAccountFormRequest;
use FireflyIII\Http\Requests\ProfileFormRequest;
use Hash;
-use Redirect;
use Session;
/**
@@ -56,13 +55,13 @@ class ProfileController extends Controller
if (!Hash::check($request->get('current_password'), Auth::user()->password)) {
Session::flash('error', 'Invalid current password!');
- return Redirect::route('profile.change-password');
+ return redirect(route('profile.change-password'));
}
$result = $this->validatePassword($request->get('current_password'), $request->get('new_password'));
if (!($result === true)) {
Session::flash('error', $result);
- return Redirect::route('profile.change-password');
+ return redirect(route('profile.change-password'));
}
// update the user with the new password.
@@ -71,7 +70,7 @@ class ProfileController extends Controller
Session::flash('success', 'Password changed!');
- return Redirect::route('profile');
+ return redirect(route('profile'));
}
/**
@@ -103,7 +102,7 @@ class ProfileController extends Controller
if (!Hash::check($request->get('password'), Auth::user()->password)) {
Session::flash('error', 'Invalid password!');
- return Redirect::route('profile.delete-account');
+ return redirect(route('profile.delete-account'));
}
// DELETE!
@@ -112,7 +111,7 @@ class ProfileController extends Controller
Session::flash('gaEventCategory', 'user');
Session::flash('gaEventAction', 'delete-account');
- return Redirect::route('index');
+ return redirect(route('index'));
}
diff --git a/app/Http/Controllers/ReportController.php b/app/Http/Controllers/ReportController.php
index 4ed436aabf..4d1ca65470 100644
--- a/app/Http/Controllers/ReportController.php
+++ b/app/Http/Controllers/ReportController.php
@@ -88,7 +88,7 @@ class ReportController extends Controller
$budgets = $this->helper->getBudgetReport($start, $end, $shared);
$categories = $this->helper->getCategoryReport($start, $end, $shared);
$balance = $this->helper->getBalanceReport($start, $end, $shared);
- $bills = $this->helper->getBillReport($start, $end, $shared);
+ $bills = $this->helper->getBillReport($start, $end);
Session::flash('gaEventCategory', 'report');
Session::flash('gaEventAction', 'month');
diff --git a/app/Http/Controllers/TagController.php b/app/Http/Controllers/TagController.php
index d8a3d489c6..80a680c9ba 100644
--- a/app/Http/Controllers/TagController.php
+++ b/app/Http/Controllers/TagController.php
@@ -10,7 +10,6 @@ use FireflyIII\Models\Tag;
use FireflyIII\Repositories\Tag\TagRepositoryInterface;
use Input;
use Preferences;
-use Redirect;
use Response;
use Session;
use URL;
@@ -108,7 +107,7 @@ class TagController extends Controller
Session::flash('success', 'Tag "' . e($tagName) . '" was deleted.');
Preferences::mark();
- return Redirect::to(route('tags.index'));
+ return redirect(route('tags.index'));
}
/**
@@ -221,9 +220,9 @@ class TagController extends Controller
public function store(TagFormRequest $request, TagRepositoryInterface $repository)
{
if (Input::get('setTag') == 'true') {
- $latitude = strlen($request->get('latitude')) > 0 ? $request->get('latitude') : null;
- $longitude = strlen($request->get('longitude')) > 0 ? $request->get('longitude') : null;
- $zoomLevel = strlen($request->get('zoomLevel')) > 0 ? $request->get('zoomLevel') : null;
+ $latitude = $request->get('latitude');
+ $longitude = $request->get('longitude');
+ $zoomLevel = $request->get('zoomLevel');
} else {
$latitude = null;
$longitude = null;
@@ -248,11 +247,11 @@ class TagController extends Controller
// set value so create routine will not overwrite URL:
Session::put('tags.create.fromStore', true);
- return Redirect::route('tags.create')->withInput();
+ return redirect(route('tags.create'))->withInput();
}
// redirect to previous URL.
- return Redirect::to(Session::get('tags.create.url'));
+ return redirect(Session::get('tags.create.url'));
}
@@ -295,10 +294,10 @@ class TagController extends Controller
// set value so edit routine will not overwrite URL:
Session::put('tags.edit.fromUpdate', true);
- return Redirect::route('tags.edit', [$tag->id])->withInput(['return_to_edit' => 1]);
+ return redirect(route('tags.edit', [$tag->id]))->withInput(['return_to_edit' => 1]);
}
// redirect to previous URL.
- return Redirect::to(Session::get('tags.edit.url'));
+ return redirect(Session::get('tags.edit.url'));
}
}
diff --git a/app/Http/Controllers/TransactionController.php b/app/Http/Controllers/TransactionController.php
index 0708263271..de425e82b7 100644
--- a/app/Http/Controllers/TransactionController.php
+++ b/app/Http/Controllers/TransactionController.php
@@ -2,6 +2,7 @@
use Auth;
use Carbon\Carbon;
+use Config;
use ExpandedForm;
use FireflyIII\Events\JournalCreated;
use FireflyIII\Events\JournalSaved;
@@ -12,7 +13,6 @@ use FireflyIII\Repositories\Account\AccountRepositoryInterface;
use FireflyIII\Repositories\Journal\JournalRepositoryInterface;
use Input;
use Preferences;
-use Redirect;
use Response;
use Session;
use URL;
@@ -108,7 +108,7 @@ class TransactionController extends Controller
Preferences::mark();
// redirect to previous URL:
- return Redirect::to(Session::get('transactions.delete.url'));
+ return redirect(Session::get('transactions.delete.url'));
}
/**
@@ -190,31 +190,12 @@ class TransactionController extends Controller
*/
public function index(JournalRepositoryInterface $repository, $what)
{
- $types = [];
- switch ($what) {
- case 'expenses':
- case 'withdrawal':
- $subTitleIcon = 'fa-long-arrow-left';
- $subTitle = trans('firefly.expenses');
- $types = ['Withdrawal'];
- break;
- case 'revenue':
- case 'deposit':
- $subTitleIcon = 'fa-long-arrow-right';
- $subTitle = trans('firefly.income');
- $types = ['Deposit'];
- break;
- case 'transfer':
- case 'transfers':
- $subTitleIcon = 'fa-exchange';
- $subTitle = trans('firefly.transfers');
- $types = ['Transfer'];
- break;
- }
-
- $page = intval(Input::get('page'));
- $offset = $page > 0 ? ($page - 1) * 50 : 0;
- $journals = $repository->getJournalsOfTypes($types, $offset, $page);
+ $subTitleIcon = Config::get('firefly.transactionIconsByWhat.' . $what);
+ $types = Config::get('firefly.transactionTypesByWhat.' . $what);
+ $subTitle = trans('firefly.title_' . $what);
+ $page = intval(Input::get('page'));
+ $offset = $page > 0 ? ($page - 1) * 50 : 0;
+ $journals = $repository->getJournalsOfTypes($types, $offset, $page);
$journals->setPath('transactions/' . $what);
@@ -295,11 +276,11 @@ class TransactionController extends Controller
// set value so create routine will not overwrite URL:
Session::put('transactions.create.fromStore', true);
- return Redirect::route('transactions.create', [$request->input('what')])->withInput();
+ return redirect(route('transactions.create', [$request->input('what')]))->withInput();
}
// redirect to previous URL.
- return Redirect::to(Session::get('transactions.create.url'));
+ return redirect(Session::get('transactions.create.url'));
}
@@ -327,11 +308,11 @@ class TransactionController extends Controller
// set value so edit routine will not overwrite URL:
Session::put('transactions.edit.fromUpdate', true);
- return Redirect::route('transactions.edit', [$journal->id])->withInput(['return_to_edit' => 1]);
+ return redirect(route('transactions.edit', [$journal->id]))->withInput(['return_to_edit' => 1]);
}
// redirect to previous URL.
- return Redirect::to(Session::get('transactions.edit.url'));
+ return redirect(Session::get('transactions.edit.url'));
}
diff --git a/app/Http/Requests/AccountFormRequest.php b/app/Http/Requests/AccountFormRequest.php
index 83275c966d..a0ff4e9617 100644
--- a/app/Http/Requests/AccountFormRequest.php
+++ b/app/Http/Requests/AccountFormRequest.php
@@ -44,6 +44,7 @@ class AccountFormRequest extends Request
'id' => $idRule,
'name' => $nameRule,
'openingBalance' => 'numeric',
+ 'iban' => 'iban',
'virtualBalance' => 'numeric',
'openingBalanceDate' => 'date',
'accountRole' => 'in:' . $accountRoles,
diff --git a/app/Http/breadcrumbs.php b/app/Http/breadcrumbs.php
index d9991cbf56..d9f64ab902 100644
--- a/app/Http/breadcrumbs.php
+++ b/app/Http/breadcrumbs.php
@@ -161,6 +161,43 @@ Breadcrumbs::register(
}
);
+// CSV:
+Breadcrumbs::register(
+ 'csv.index', function (Generator $breadcrumbs) {
+ $breadcrumbs->parent('home');
+ $breadcrumbs->push(trans('firefly.csv_index_title'), route('csv.index'));
+}
+);
+
+Breadcrumbs::register(
+ 'csv.column-roles', function (Generator $breadcrumbs) {
+ $breadcrumbs->parent('csv.index');
+ $breadcrumbs->push(trans('firefly.csv_define_column_roles'), route('csv.column-roles'));
+}
+);
+
+Breadcrumbs::register(
+ 'csv.map', function (Generator $breadcrumbs) {
+ $breadcrumbs->parent('csv.index');
+ $breadcrumbs->push(trans('firefly.csv_map_values'), route('csv.map'));
+}
+);
+
+Breadcrumbs::register(
+ 'csv.download-config-page', function (Generator $breadcrumbs) {
+ $breadcrumbs->parent('csv.index');
+ $breadcrumbs->push(trans('firefly.csv_download_config'), route('csv.download-config-page'));
+}
+);
+
+Breadcrumbs::register(
+ 'csv.process', function (Generator $breadcrumbs) {
+ $breadcrumbs->parent('csv.index');
+ $breadcrumbs->push(trans('firefly.csv_process_title'), route('csv.process'));
+}
+);
+
+
// currencies.
Breadcrumbs::register(
'currency.index', function (Generator $breadcrumbs) {
diff --git a/app/Http/routes.php b/app/Http/routes.php
index 3538bbf428..956da6a26b 100644
--- a/app/Http/routes.php
+++ b/app/Http/routes.php
@@ -181,7 +181,7 @@ Route::group(
* Bills Controller
*/
Route::get('/bills', ['uses' => 'BillController@index', 'as' => 'bills.index']);
- Route::get('/bills/rescan/{bill}', ['uses' => 'BillController@rescan', 'as' => 'bills.rescan']); # rescan for matching.
+ Route::get('/bills/rescan/{bill}', ['uses' => 'BillController@rescan', 'as' => 'bills.rescan']);
Route::get('/bills/create', ['uses' => 'BillController@create', 'as' => 'bills.create']);
Route::get('/bills/edit/{bill}', ['uses' => 'BillController@edit', 'as' => 'bills.edit']);
Route::get('/bills/delete/{bill}', ['uses' => 'BillController@delete', 'as' => 'bills.delete']);
@@ -194,7 +194,7 @@ Route::group(
* Budget Controller
*/
Route::get('/budgets', ['uses' => 'BudgetController@index', 'as' => 'budgets.index']);
- Route::get('/budgets/income', ['uses' => 'BudgetController@updateIncome', 'as' => 'budgets.income']); # extra.
+ Route::get('/budgets/income', ['uses' => 'BudgetController@updateIncome', 'as' => 'budgets.income']);
Route::get('/budgets/create', ['uses' => 'BudgetController@create', 'as' => 'budgets.create']);
Route::get('/budgets/edit/{budget}', ['uses' => 'BudgetController@edit', 'as' => 'budgets.edit']);
Route::get('/budgets/delete/{budget}', ['uses' => 'BudgetController@delete', 'as' => 'budgets.delete']);
@@ -219,6 +219,21 @@ Route::group(
Route::post('/categories/update/{category}', ['uses' => 'CategoryController@update', 'as' => 'categories.update']);
Route::post('/categories/destroy/{category}', ['uses' => 'CategoryController@destroy', 'as' => 'categories.destroy']);
+
+ /**
+ * CSV controller
+ */
+ Route::get('/csv', ['uses' => 'CsvController@index', 'as' => 'csv.index']);
+ Route::post('/csv/upload', ['uses' => 'CsvController@upload', 'as' => 'csv.upload']);
+ Route::get('/csv/column_roles', ['uses' => 'CsvController@columnRoles', 'as' => 'csv.column-roles']);
+ Route::post('/csv/initial_parse', ['uses' => 'CsvController@initialParse', 'as' => 'csv.initial_parse']);
+ Route::get('/csv/map', ['uses' => 'CsvController@map', 'as' => 'csv.map']);
+ Route::get('/csv/download-config', ['uses' => 'CsvController@downloadConfig', 'as' => 'csv.download-config']);
+ Route::get('/csv/download', ['uses' => 'CsvController@downloadConfigPage', 'as' => 'csv.download-config-page']);
+ Route::post('/csv/save_mapping', ['uses' => 'CsvController@saveMapping', 'as' => 'csv.save_mapping']);
+
+ Route::get('/csv/process', ['uses' => 'CsvController@process', 'as' => 'csv.process']);
+
/**
* Currency Controller
*/
@@ -297,8 +312,8 @@ Route::group(
* Piggy Bank Controller
*/
Route::get('/piggy-banks', ['uses' => 'PiggyBankController@index', 'as' => 'piggy-banks.index']);
- Route::get('/piggy-banks/add/{piggyBank}', ['uses' => 'PiggyBankController@add', 'as' => 'piggy-banks.addMoney']); # add money
- Route::get('/piggy-banks/remove/{piggyBank}', ['uses' => 'PiggyBankController@remove', 'as' => 'piggy-banks.removeMoney']); #remove money
+ Route::get('/piggy-banks/add/{piggyBank}', ['uses' => 'PiggyBankController@add', 'as' => 'piggy-banks.addMoney']);
+ Route::get('/piggy-banks/remove/{piggyBank}', ['uses' => 'PiggyBankController@remove', 'as' => 'piggy-banks.removeMoney']);
Route::get('/piggy-banks/create', ['uses' => 'PiggyBankController@create', 'as' => 'piggy-banks.create']);
Route::get('/piggy-banks/edit/{piggyBank}', ['uses' => 'PiggyBankController@edit', 'as' => 'piggy-banks.edit']);
Route::get('/piggy-banks/delete/{piggyBank}', ['uses' => 'PiggyBankController@delete', 'as' => 'piggy-banks.delete']);
@@ -306,8 +321,8 @@ Route::group(
Route::post('/piggy-banks/store', ['uses' => 'PiggyBankController@store', 'as' => 'piggy-banks.store']);
Route::post('/piggy-banks/update/{piggyBank}', ['uses' => 'PiggyBankController@update', 'as' => 'piggy-banks.update']);
Route::post('/piggy-banks/destroy/{piggyBank}', ['uses' => 'PiggyBankController@destroy', 'as' => 'piggy-banks.destroy']);
- Route::post('/piggy-banks/add/{piggyBank}', ['uses' => 'PiggyBankController@postAdd', 'as' => 'piggy-banks.add']); # add money
- Route::post('/piggy-banks/remove/{piggyBank}', ['uses' => 'PiggyBankController@postRemove', 'as' => 'piggy-banks.remove']); # remove money.
+ Route::post('/piggy-banks/add/{piggyBank}', ['uses' => 'PiggyBankController@postAdd', 'as' => 'piggy-banks.add']);
+ Route::post('/piggy-banks/remove/{piggyBank}', ['uses' => 'PiggyBankController@postRemove', 'as' => 'piggy-banks.remove']);
Route::post('/piggy-banks/sort', ['uses' => 'PiggyBankController@order', 'as' => 'piggy-banks.order']);
/**
diff --git a/app/Models/Account.php b/app/Models/Account.php
index a09825c266..6e64f4d853 100644
--- a/app/Models/Account.php
+++ b/app/Models/Account.php
@@ -47,18 +47,21 @@ use Watson\Validating\ValidatingTrait;
* @property mixed piggyBalance
* @property mixed difference
* @property mixed percentage
+ * @property string $iban
+ * @property-read mixed $name_for_editform
+ * @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Account whereIban($value)
*/
class Account extends Model
{
use SoftDeletes, ValidatingTrait;
- protected $fillable = ['user_id', 'account_type_id', 'name', 'active', 'virtual_balance'];
+ protected $fillable = ['user_id', 'account_type_id', 'name', 'active', 'virtual_balance', 'iban'];
protected $hidden = ['virtual_balance_encrypted', 'encrypted'];
protected $rules
= [
'user_id' => 'required|exists:users,id',
'account_type_id' => 'required|exists:account_types,id',
- 'name' => 'required|between:1,1024|uniqueAccountForUser',
+ 'name' => 'required',
'active' => 'required|boolean'
];
@@ -71,11 +74,12 @@ class Account extends Model
public static function firstOrCreateEncrypted(array $fields)
{
// everything but the name:
- $query = Account::orderBy('id');
- foreach ($fields as $name => $value) {
- if ($name != 'name') {
- $query->where($name, $value);
- }
+ $query = Account::orderBy('id');
+ $search = $fields;
+ unset($search['name'], $search['iban']);
+
+ foreach ($search as $name => $value) {
+ $query->where($name, $value);
}
$set = $query->get(['accounts.*']);
/** @var Account $account */
@@ -84,6 +88,11 @@ class Account extends Model
return $account;
}
}
+ // account must have a name. If not set, use IBAN.
+ if (!isset($fields['name'])) {
+ $fields['name'] = $fields['iban'];
+ }
+
// create it!
$account = Account::create($fields);
@@ -99,11 +108,11 @@ class Account extends Model
public static function firstOrNullEncrypted(array $fields)
{
// everything but the name:
- $query = Account::orderBy('id');
- foreach ($fields as $name => $value) {
- if ($name != 'name') {
- $query->where($name, $value);
- }
+ $query = Account::orderBy('id');
+ $search = $fields;
+ unset($search['name']);
+ foreach ($search as $name => $value) {
+ $query->where($name, $value);
}
$set = $query->get(['accounts.*']);
/** @var Account $account */
@@ -143,6 +152,22 @@ class Account extends Model
return ['created_at', 'updated_at', 'deleted_at'];
}
+ /**
+ * @codeCoverageIgnore
+ *
+ * @param $value
+ *
+ * @return string
+ */
+ public function getIbanAttribute($value)
+ {
+ if (is_null($value)) {
+ return null;
+ }
+
+ return Crypt::decrypt($value);
+ }
+
/**
*
* @param string $fieldName
@@ -236,6 +261,16 @@ class Account extends Model
$query->where($joinName . '.data', json_encode($value));
}
+ /**
+ * @codeCoverageIgnore
+ *
+ * @param $value
+ */
+ public function setIbanAttribute($value)
+ {
+ $this->attributes['iban'] = Crypt::encrypt($value);
+ }
+
/**
* @codeCoverageIgnore
*
diff --git a/app/Models/Budget.php b/app/Models/Budget.php
index 83ab460422..f631a0666f 100644
--- a/app/Models/Budget.php
+++ b/app/Models/Budget.php
@@ -40,6 +40,7 @@ class Budget extends Model
/**
* @param array $fields
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
+ *
* @codeCoverageIgnore
*
* @return Budget
@@ -47,11 +48,11 @@ class Budget extends Model
public static function firstOrCreateEncrypted(array $fields)
{
// everything but the name:
- $query = Budget::orderBy('id');
- foreach ($fields as $name => $value) {
- if ($name != 'name') {
- $query->where($name, $value);
- }
+ $query = Budget::orderBy('id');
+ $search = $fields;
+ unset($search['name']);
+ foreach ($search as $name => $value) {
+ $query->where($name, $value);
}
$set = $query->get(['budgets.*']);
/** @var Budget $budget */
diff --git a/app/Models/Category.php b/app/Models/Category.php
index dc4f7cbbff..e86cfb72e3 100644
--- a/app/Models/Category.php
+++ b/app/Models/Category.php
@@ -43,11 +43,12 @@ class Category extends Model
public static function firstOrCreateEncrypted(array $fields)
{
// everything but the name:
- $query = Category::orderBy('id');
- foreach ($fields as $name => $value) {
- if ($name != 'name') {
- $query->where($name, $value);
- }
+ $query = Category::orderBy('id');
+ $search = $fields;
+ unset($search['name']);
+ foreach ($search as $name => $value) {
+ $query->where($name, $value);
+
}
$set = $query->get(['categories.*']);
/** @var Category $category */
diff --git a/app/Models/PiggyBank.php b/app/Models/PiggyBank.php
index ebe5379da2..b2e1b09dbb 100644
--- a/app/Models/PiggyBank.php
+++ b/app/Models/PiggyBank.php
@@ -37,6 +37,12 @@ use Illuminate\Database\Eloquent\SoftDeletes;
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\PiggyBank whereOrder($value)
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\PiggyBank whereEncrypted($value)
* @property PiggyBankRepetition currentRep
+ * @property string $reminder
+ * @property integer $reminder_skip
+ * @property boolean $remind_me
+ * @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\PiggyBank whereReminder($value)
+ * @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\PiggyBank whereReminderSkip($value)
+ * @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\PiggyBank whereRemindMe($value)
*/
class PiggyBank extends Model
{
diff --git a/app/Models/Tag.php b/app/Models/Tag.php
index 637f93b2c4..73f23b7699 100644
--- a/app/Models/Tag.php
+++ b/app/Models/Tag.php
@@ -62,14 +62,13 @@ class Tag extends Model
public static function firstOrCreateEncrypted(array $fields)
{
// everything but the tag:
- if (isset($fields['tagMode'])) {
- unset($fields['tagMode']);
- }
+ unset($fields['tagMode']);
+ $search = $fields;
+ unset($search['name']);
+
$query = Tag::orderBy('id');
- foreach ($fields as $name => $value) {
- if ($name != 'tag') {
- $query->where($name, $value);
- }
+ foreach ($search as $name => $value) {
+ $query->where($name, $value);
}
$set = $query->get(['tags.*']);
/** @var Tag $tag */
diff --git a/app/Providers/FireflyServiceProvider.php b/app/Providers/FireflyServiceProvider.php
index 685e9685e9..c528ab0bb6 100644
--- a/app/Providers/FireflyServiceProvider.php
+++ b/app/Providers/FireflyServiceProvider.php
@@ -91,6 +91,9 @@ class FireflyServiceProvider extends ServiceProvider
$this->app->bind('FireflyIII\Repositories\Tag\TagRepositoryInterface', 'FireflyIII\Repositories\Tag\TagRepository');
$this->app->bind('FireflyIII\Support\Search\SearchInterface', 'FireflyIII\Support\Search\Search');
+ // CSV import
+ $this->app->bind('FireflyIII\Helpers\Csv\WizardInterface', 'FireflyIII\Helpers\Csv\Wizard');
+
// make charts:
// alternative is Google instead of ChartJs
$this->app->bind('FireflyIII\Generator\Chart\Account\AccountChartGenerator', 'FireflyIII\Generator\Chart\Account\ChartJsAccountChartGenerator');
diff --git a/app/Repositories/Account/AccountRepository.php b/app/Repositories/Account/AccountRepository.php
index 8785c588ef..39b601a1c9 100644
--- a/app/Repositories/Account/AccountRepository.php
+++ b/app/Repositories/Account/AccountRepository.php
@@ -389,7 +389,9 @@ class AccountRepository implements AccountRepositoryInterface
public function store(array $data)
{
$newAccount = $this->storeAccount($data);
- $this->storeMetadata($newAccount, $data);
+ if (!is_null($newAccount)) {
+ $this->storeMetadata($newAccount, $data);
+ }
// continue with the opposing account:
@@ -401,9 +403,12 @@ class AccountRepository implements AccountRepositoryInterface
'virtualBalance' => 0,
'name' => $data['name'] . ' initial balance',
'active' => false,
+ 'iban' => '',
];
$opposing = $this->storeAccount($opposingData);
- $this->storeInitialBalance($newAccount, $opposing, $data);
+ if (!is_null($opposing) && !is_null($newAccount)) {
+ $this->storeInitialBalance($newAccount, $opposing, $data);
+ }
}
@@ -431,6 +436,7 @@ class AccountRepository implements AccountRepositoryInterface
$account->name = $data['name'];
$account->active = $data['active'] == '1' ? true : false;
$account->virtual_balance = $data['virtualBalance'];
+ $account->iban = $data['iban'];
$account->save();
$this->updateMetadata($account, $data);
@@ -453,7 +459,9 @@ class AccountRepository implements AccountRepositoryInterface
'virtualBalance' => 0,
];
$opposing = $this->storeAccount($opposingData);
- $this->storeInitialBalance($account, $opposing, $data);
+ if (!is_null($opposing)) {
+ $this->storeInitialBalance($account, $opposing, $data);
+ }
}
} else {
@@ -481,6 +489,7 @@ class AccountRepository implements AccountRepositoryInterface
'name' => $data['name'],
'virtual_balance' => $data['virtualBalance'],
'active' => $data['active'] === true ? true : false,
+ 'iban' => $data['iban'],
]
);
@@ -490,7 +499,8 @@ class AccountRepository implements AccountRepositoryInterface
'user_id' => $data['user'],
'account_type_id' => $accountType->id,
'virtual_balance' => $data['virtualBalance'],
- 'name' => $data['name']
+ 'name' => $data['name'],
+ 'iban' => $data['iban'],
];
$existingAccount = Account::firstOrNullEncrypted($searchData);
if (!$existingAccount) {
@@ -556,7 +566,6 @@ class AccountRepository implements AccountRepositoryInterface
);
$journal->save();
-
if ($data['openingBalance'] < 0) {
$firstAccount = $opposing;
$secondAccount = $account;
@@ -568,26 +577,11 @@ class AccountRepository implements AccountRepositoryInterface
$firstAmount = $data['openingBalance'];
$secondAmount = $data['openingBalance'] * -1;
}
+ $one = new Transaction(['account_id' => $firstAccount->id, 'transaction_journal_id' => $journal->id, 'amount' => $firstAmount]);
+ $one->save();// first transaction: from
- // first transaction: from
- $one = new Transaction(
- [
- 'account_id' => $firstAccount->id,
- 'transaction_journal_id' => $journal->id,
- 'amount' => $firstAmount
- ]
- );
- $one->save();
-
- // second transaction: to
- $two = new Transaction(
- [
- 'account_id' => $secondAccount->id,
- 'transaction_journal_id' => $journal->id,
- 'amount' => $secondAmount
- ]
- );
- $two->save();
+ $two = new Transaction(['account_id' => $secondAccount->id, 'transaction_journal_id' => $journal->id, 'amount' => $secondAmount]);
+ $two->save(); // second transaction: to
return $journal;
@@ -596,6 +590,8 @@ class AccountRepository implements AccountRepositoryInterface
/**
* @param Account $account
* @param array $data
+ *
+ * @SuppressWarnings(PHPMD.CyclomaticComplexity)
*/
protected function updateMetadata(Account $account, array $data)
{
diff --git a/app/Repositories/Journal/JournalRepository.php b/app/Repositories/Journal/JournalRepository.php
index 11cce176e9..169a746e40 100644
--- a/app/Repositories/Journal/JournalRepository.php
+++ b/app/Repositories/Journal/JournalRepository.php
@@ -115,14 +115,14 @@ class JournalRepository implements JournalRepositoryInterface
}
/**
- * @param $id
+ * @param int $journalId
* @param Carbon $date
*
* @return TransactionJournal
*/
- public function getWithDate($id, Carbon $date)
+ public function getWithDate($journalId, Carbon $date)
{
- return Auth::user()->transactionjournals()->where('id', $id)->where('date', $date->format('Y-m-d 00:00:00'))->first();
+ return Auth::user()->transactionjournals()->where('id', $journalId)->where('date', $date->format('Y-m-d 00:00:00'))->first();
}
/**
@@ -143,7 +143,9 @@ class JournalRepository implements JournalRepositoryInterface
foreach ($array as $name) {
if (strlen(trim($name)) > 0) {
$tag = Tag::firstOrCreateEncrypted(['tag' => $name, 'user_id' => $journal->user_id]);
- $tagRepository->connect($journal, $tag);
+ if (!is_null($tag)) {
+ $tagRepository->connect($journal, $tag);
+ }
}
}
}
@@ -186,19 +188,19 @@ class JournalRepository implements JournalRepositoryInterface
}
// store accounts (depends on type)
- list($from, $to) = $this->storeAccounts($transactionType, $data);
+ list($fromAccount, $toAccount) = $this->storeAccounts($transactionType, $data);
// store accompanying transactions.
Transaction::create( // first transaction.
[
- 'account_id' => $from->id,
+ 'account_id' => $fromAccount->id,
'transaction_journal_id' => $journal->id,
'amount' => $data['amount'] * -1
]
);
Transaction::create( // second transaction.
[
- 'account_id' => $to->id,
+ 'account_id' => $toAccount->id,
'transaction_journal_id' => $journal->id,
'amount' => $data['amount']
]
@@ -246,7 +248,7 @@ class JournalRepository implements JournalRepositoryInterface
}
// store accounts (depends on type)
- list($from, $to) = $this->storeAccounts($journal->transactionType, $data);
+ list($fromAccount, $toAccount) = $this->storeAccounts($journal->transactionType, $data);
// update the from and to transaction.
/** @var Transaction $transaction */
@@ -254,12 +256,12 @@ class JournalRepository implements JournalRepositoryInterface
if (floatval($transaction->amount) < 0) {
// this is the from transaction, negative amount:
$transaction->amount = $data['amount'] * -1;
- $transaction->account_id = $from->id;
+ $transaction->account_id = $fromAccount->id;
$transaction->save();
}
if (floatval($transaction->amount) > 0) {
$transaction->amount = $data['amount'];
- $transaction->account_id = $to->id;
+ $transaction->account_id = $toAccount->id;
$transaction->save();
}
}
diff --git a/app/Repositories/Journal/JournalRepositoryInterface.php b/app/Repositories/Journal/JournalRepositoryInterface.php
index baaee122f2..fb7ccb6cc9 100644
--- a/app/Repositories/Journal/JournalRepositoryInterface.php
+++ b/app/Repositories/Journal/JournalRepositoryInterface.php
@@ -62,12 +62,12 @@ interface JournalRepositoryInterface
public function getTransactionType($type);
/**
- * @param $id
+ * @param int $journalId
* @param Carbon $date
*
* @return TransactionJournal
*/
- public function getWithDate($id, Carbon $date);
+ public function getWithDate($journalId, Carbon $date);
/**
* @param TransactionJournal $journal
diff --git a/app/Repositories/Shared/ComponentRepository.php b/app/Repositories/Shared/ComponentRepository.php
index e4187f9e58..c97019880a 100644
--- a/app/Repositories/Shared/ComponentRepository.php
+++ b/app/Repositories/Shared/ComponentRepository.php
@@ -26,9 +26,7 @@ class ComponentRepository
*/
protected function spentInPeriod($object, Carbon $start, Carbon $end, $shared = false)
{
- // we must cache this.
-
- $cache = new CacheProperties;
+ $cache = new CacheProperties; // we must cache this.
$cache->addProperty($object->id);
$cache->addProperty(get_class($object));
$cache->addProperty($start);
@@ -40,21 +38,13 @@ class ComponentRepository
return $cache->get(); // @codeCoverageIgnore
}
-
- if ($shared === true) {
- // shared is true.
- // always ignore transfers between accounts!
- $sum
- = $object->transactionjournals()
- ->transactionTypes(['Withdrawal'])
- ->before($end)->after($start)->get(['transaction_journals.*'])->sum('amount');
-
+ if ($shared === true) { // shared is true: always ignore transfers between accounts!
+ $sum = $object->transactionjournals()->transactionTypes(['Withdrawal'])->before($end)->after($start)
+ ->get(['transaction_journals.*'])->sum('amount');
} else {
// do something else, SEE budgets.
// get all journals in this month where the asset account is NOT shared.
- $sum = $object->transactionjournals()
- ->before($end)
- ->after($start)
+ $sum = $object->transactionjournals()->before($end)->after($start)
->transactionTypes(['Withdrawal'])
->leftJoin('transactions', 'transactions.transaction_journal_id', '=', 'transaction_journals.id')
->leftJoin('accounts', 'accounts.id', '=', 'transactions.account_id')
@@ -62,9 +52,7 @@ class ComponentRepository
'account_meta', function (JoinClause $join) {
$join->on('account_meta.account_id', '=', 'accounts.id')->where('account_meta.name', '=', 'accountRole');
}
- )
- ->where('account_meta.data', '!=', '"sharedAsset"')
- ->get(['transaction_journals.*'])->sum('amount');
+ )->where('account_meta.data', '!=', '"sharedAsset"')->get(['transaction_journals.*'])->sum('amount');
}
$cache->store($sum);
diff --git a/app/Support/Amount.php b/app/Support/Amount.php
index 30259dbc68..9b4cb692fc 100644
--- a/app/Support/Amount.php
+++ b/app/Support/Amount.php
@@ -65,7 +65,6 @@ class Amount
return '' . $symbol . ' ' . $string . '';
}
- // €
return $symbol . ' ' . $string;
}
diff --git a/app/Support/ExpandedForm.php b/app/Support/ExpandedForm.php
index 4bae2bcbbb..ab4e0cfccb 100644
--- a/app/Support/ExpandedForm.php
+++ b/app/Support/ExpandedForm.php
@@ -262,6 +262,27 @@ class ExpandedForm
return $selectList;
}
+ /**
+ * @param $name
+ * @param array $list
+ * @param null $selected
+ * @param array $options
+ *
+ * @return string
+ */
+ public function multiCheckbox($name, array $list = [], $selected = null, array $options = [])
+ {
+ $label = $this->label($name, $options);
+ $options = $this->expandOptionArray($name, $label, $options);
+ $classes = $this->getHolderClasses($name);
+ $selected = $this->fillFieldValue($name, $selected);
+
+ unset($options['class']);
+ $html = View::make('form.multiCheckbox', compact('classes', 'name', 'label', 'selected', 'options', 'list'))->render();
+
+ return $html;
+ }
+
/**
* @param $name
* @param array $list
@@ -347,6 +368,23 @@ class ExpandedForm
return $html;
}
+ /**
+ * @param $name
+ * @param array $options
+ *
+ * @return string
+ */
+ public function file($name, array $options = [])
+ {
+ $label = $this->label($name, $options);
+ $options = $this->expandOptionArray($name, $label, $options);
+ $classes = $this->getHolderClasses($name);
+ $html = View::make('form.file', compact('classes', 'name', 'label', 'options'))->render();
+
+ return $html;
+
+ }
+
/**
* @param $name
* @param null $value
diff --git a/app/Support/Navigation.php b/app/Support/Navigation.php
index 2f3c15fe8c..d22b0250e6 100644
--- a/app/Support/Navigation.php
+++ b/app/Support/Navigation.php
@@ -83,7 +83,7 @@ class Navigation
$subDay = ['week', 'weekly', '1W', 'month', 'monthly', '1M', '3M', 'quarter', 'quarterly', '6M', 'half-year', 'year', 'yearly'];
if (!isset($functionMap[$repeatFreq])) {
- throw new FireflyException('Cannot do endOfPeriod for $repeat_freq "' . $repeatFreq.'"');
+ throw new FireflyException('Cannot do endOfPeriod for $repeat_freq "' . $repeatFreq . '"');
}
$function = $functionMap[$repeatFreq];
if (isset($modifierMap[$repeatFreq])) {
@@ -204,7 +204,7 @@ class Navigation
return $date;
}
- throw new FireflyException('Cannot do startOfPeriod for $repeat_freq "' . $repeatFreq.'"');
+ throw new FireflyException('Cannot do startOfPeriod for $repeat_freq "' . $repeatFreq . '"');
}
/**
@@ -246,7 +246,7 @@ class Navigation
return $date;
}
- throw new FireflyException('Cannot do subtractPeriod for $repeat_freq "' . $repeatFreq.'"');
+ throw new FireflyException('Cannot do subtractPeriod for $repeat_freq "' . $repeatFreq . '"');
}
/**
@@ -282,7 +282,7 @@ class Navigation
return $end;
}
- throw new FireflyException('updateEndDate cannot handle $range "' . $range.'"');
+ throw new FireflyException('updateEndDate cannot handle $range "' . $range . '"');
}
/**
@@ -316,7 +316,7 @@ class Navigation
return $start;
}
- throw new FireflyException('updateStartDate cannot handle $range "' . $range.'"');
+ throw new FireflyException('updateStartDate cannot handle $range "' . $range . '"');
}
diff --git a/app/User.php b/app/User.php
index 408b621188..431731aa0c 100644
--- a/app/User.php
+++ b/app/User.php
@@ -11,7 +11,6 @@ use Zizaco\Entrust\Traits\EntrustUserTrait;
* Class User
*
* @codeCoverageIgnore
- *
* @package FireflyIII
* @property integer $id
* @property \Carbon\Carbon $created_at
diff --git a/app/Validation/FireflyValidator.php b/app/Validation/FireflyValidator.php
index 4e6e1397cb..faa07a5e49 100644
--- a/app/Validation/FireflyValidator.php
+++ b/app/Validation/FireflyValidator.php
@@ -54,6 +54,41 @@ class FireflyValidator extends Validator
}
+ /**
+ * @param $attribute
+ * @param $value
+ *
+ * @return bool
+ */
+ public function validateIban($attribute, $value)
+ {
+ if (!is_string($value)) {
+ return false;
+ }
+
+ if (strlen($value) === 0) {
+ return false;
+ }
+
+ $value = strtoupper($value);
+ if (strlen($value) < 6) {
+ return false;
+ }
+
+ $search = [' ', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'];
+ $replace = ['', '10', '11', '12', '13', '14', '15', '16', '17', '18', '19', '20', '21', '22', '23', '24', '25', '26', '27', '28', '29', '30', '31',
+ '32', '33', '34', '35'];
+
+ // take
+ $first = substr($value, 0, 4);
+ $last = substr($value, 4);
+ $iban = $last . $first;
+ $iban = str_replace($search, $replace, $iban);
+ $checksum = bcmod($iban, '97');
+
+ return (intval($checksum) === 1);
+ }
+
/**
* @param $attribute
* @param $value
@@ -173,9 +208,10 @@ class FireflyValidator extends Validator
/**
* @param $value
- * @param $parameters
*
* @return bool
+ * @internal param $parameters
+ *
*/
protected function validateByAccountId($value)
{
diff --git a/codeception.yml b/codeception.yml
new file mode 100644
index 0000000000..3a8fca8145
--- /dev/null
+++ b/codeception.yml
@@ -0,0 +1,21 @@
+actor: Tester
+paths:
+ tests: tests
+ log: tests/_output
+ data: tests/_data
+ support: tests/_support
+ envs: tests/_envs
+settings:
+ bootstrap: _bootstrap.php
+ colors: true
+ memory_limit: 1024M
+extensions:
+ enabled:
+ - Codeception\Extension\RunFailed
+modules:
+ config:
+ Db:
+ dsn: ''
+ user: ''
+ password: ''
+ dump: tests/_data/dump.sql
diff --git a/composer.json b/composer.json
index b1134d9cd1..d3fb277a16 100644
--- a/composer.json
+++ b/composer.json
@@ -28,7 +28,9 @@
"illuminate/html": "~5.0",
"league/commonmark": "0.7.*",
"rcrowe/twigbridge": "0.7.x@dev",
- "zizaco/entrust": "dev-laravel-5"
+ "zizaco/entrust": "dev-laravel-5",
+ "codeception/codeception": "*",
+ "league/csv": "^7.1"
},
"require-dev": {
"barryvdh/laravel-debugbar": "@stable",
diff --git a/composer.lock b/composer.lock
index dbc3422a9f..7d5375499b 100644
--- a/composer.lock
+++ b/composer.lock
@@ -4,39 +4,33 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
"This file is @generated automatically"
],
- "hash": "c1cfabc3da3bdec86d8912a6878e0b0f",
+ "hash": "16409d4004d305517bea330fcc6591a6",
"packages": [
{
"name": "classpreloader/classpreloader",
- "version": "1.4.0",
+ "version": "2.0.0",
"source": {
"type": "git",
"url": "https://github.com/ClassPreloader/ClassPreloader.git",
- "reference": "b76f3f4f603ebbe7e64351a7ef973431ddaf7b27"
+ "reference": "8c3c14b10309e3b40bce833913a6c0c0b8c8f962"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/ClassPreloader/ClassPreloader/zipball/b76f3f4f603ebbe7e64351a7ef973431ddaf7b27",
- "reference": "b76f3f4f603ebbe7e64351a7ef973431ddaf7b27",
+ "url": "https://api.github.com/repos/ClassPreloader/ClassPreloader/zipball/8c3c14b10309e3b40bce833913a6c0c0b8c8f962",
+ "reference": "8c3c14b10309e3b40bce833913a6c0c0b8c8f962",
"shasum": ""
},
"require": {
"nikic/php-parser": "~1.3",
- "php": ">=5.3.3",
- "symfony/console": "~2.1",
- "symfony/filesystem": "~2.1",
- "symfony/finder": "~2.1"
+ "php": ">=5.5.9"
},
"require-dev": {
"phpunit/phpunit": "~4.0"
},
- "bin": [
- "classpreloader.php"
- ],
"type": "library",
"extra": {
"branch-alias": {
- "dev-master": "1.4-dev"
+ "dev-master": "2.0-dev"
}
},
"autoload": {
@@ -55,7 +49,7 @@
},
{
"name": "Graham Campbell",
- "email": "graham@cachethq.io"
+ "email": "graham@alt-three.com"
}
],
"description": "Helps class loading performance by generating a single PHP file containing all of the autoloaded files for a specific use case",
@@ -64,7 +58,89 @@
"class",
"preload"
],
- "time": "2015-05-26 10:57:51"
+ "time": "2015-06-28 21:39:13"
+ },
+ {
+ "name": "codeception/codeception",
+ "version": "2.1.0",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/Codeception/Codeception.git",
+ "reference": "b5af3aac061ffaeb65ed023534b3c50558e90d07"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/Codeception/Codeception/zipball/b5af3aac061ffaeb65ed023534b3c50558e90d07",
+ "reference": "b5af3aac061ffaeb65ed023534b3c50558e90d07",
+ "shasum": ""
+ },
+ "require": {
+ "ext-json": "*",
+ "ext-mbstring": "*",
+ "facebook/webdriver": "~0.4|~0.5",
+ "guzzlehttp/guzzle": ">=4.0|<7.0",
+ "guzzlehttp/psr7": "~1.0",
+ "php": ">=5.4.0",
+ "phpunit/phpunit": "~4.7.0",
+ "symfony/browser-kit": "~2.4",
+ "symfony/console": "~2.4",
+ "symfony/css-selector": "~2.4",
+ "symfony/dom-crawler": "~2.4,!=2.4.5",
+ "symfony/event-dispatcher": "~2.4",
+ "symfony/finder": "~2.4",
+ "symfony/yaml": "~2.4"
+ },
+ "require-dev": {
+ "codeception/specify": "~0.3",
+ "facebook/php-sdk-v4": "~4.0",
+ "flow/jsonpath": "~0.2",
+ "monolog/monolog": "~1.8",
+ "pda/pheanstalk": "~2.0",
+ "videlalvaro/php-amqplib": "~2.4"
+ },
+ "suggest": {
+ "codeception/phpbuiltinserver": "Extension to start and stop PHP built-in web server for your tests",
+ "codeception/specify": "BDD-style code blocks",
+ "codeception/verify": "BDD-style assertions",
+ "monolog/monolog": "Log test steps",
+ "phpseclib/phpseclib": "Extension required to use the SFTP option in the FTP Module."
+ },
+ "bin": [
+ "codecept"
+ ],
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "2.1-dev"
+ }
+ },
+ "autoload": {
+ "psr-4": {
+ "Codeception\\": "src\\Codeception",
+ "Codeception\\Extension\\": "ext"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Michael Bodnarchuk",
+ "email": "davert@mail.ua",
+ "homepage": "http://codegyre.com"
+ }
+ ],
+ "description": "BDD-style testing framework",
+ "homepage": "http://codeception.com/",
+ "keywords": [
+ "BDD",
+ "TDD",
+ "acceptance testing",
+ "functional testing",
+ "unit testing"
+ ],
+ "time": "2015-06-30 03:38:01"
},
{
"name": "danielstjules/stringy",
@@ -619,6 +695,60 @@
],
"time": "2014-12-20 21:24:13"
},
+ {
+ "name": "doctrine/instantiator",
+ "version": "1.0.5",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/doctrine/instantiator.git",
+ "reference": "8e884e78f9f0eb1329e445619e04456e64d8051d"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/doctrine/instantiator/zipball/8e884e78f9f0eb1329e445619e04456e64d8051d",
+ "reference": "8e884e78f9f0eb1329e445619e04456e64d8051d",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=5.3,<8.0-DEV"
+ },
+ "require-dev": {
+ "athletic/athletic": "~0.1.8",
+ "ext-pdo": "*",
+ "ext-phar": "*",
+ "phpunit/phpunit": "~4.0",
+ "squizlabs/php_codesniffer": "~2.0"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "1.0.x-dev"
+ }
+ },
+ "autoload": {
+ "psr-4": {
+ "Doctrine\\Instantiator\\": "src/Doctrine/Instantiator/"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Marco Pivetta",
+ "email": "ocramius@gmail.com",
+ "homepage": "http://ocramius.github.com/"
+ }
+ ],
+ "description": "A small, lightweight utility to instantiate objects in PHP without invoking their constructors",
+ "homepage": "https://github.com/doctrine/instantiator",
+ "keywords": [
+ "constructor",
+ "instantiate"
+ ],
+ "time": "2015-06-14 21:17:01"
+ },
{
"name": "doctrine/lexer",
"version": "v1.0.1",
@@ -673,6 +803,47 @@
],
"time": "2014-09-09 13:34:57"
},
+ {
+ "name": "facebook/webdriver",
+ "version": "v0.6.0",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/facebook/php-webdriver.git",
+ "reference": "2c5b305ea91b00ebbc433ad1663b7f16c1b31ec5"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/facebook/php-webdriver/zipball/2c5b305ea91b00ebbc433ad1663b7f16c1b31ec5",
+ "reference": "2c5b305ea91b00ebbc433ad1663b7f16c1b31ec5",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=5.3.19"
+ },
+ "require-dev": {
+ "phpdocumentor/phpdocumentor": "2.*",
+ "phpunit/phpunit": "3.7.*"
+ },
+ "type": "library",
+ "autoload": {
+ "classmap": [
+ "lib/"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "Apache-2.0"
+ ],
+ "description": "A php client for WebDriver",
+ "homepage": "https://github.com/facebook/php-webdriver",
+ "keywords": [
+ "facebook",
+ "php",
+ "selenium",
+ "webdriver"
+ ],
+ "time": "2015-02-09 19:39:34"
+ },
{
"name": "grumpydictator/gchart",
"version": "1.0.9",
@@ -709,6 +880,177 @@
"description": "GChart is a small package that allows you to easily generate data for the Google Charts API.",
"time": "2015-04-05 19:17:17"
},
+ {
+ "name": "guzzlehttp/guzzle",
+ "version": "6.0.2",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/guzzle/guzzle.git",
+ "reference": "a8dfeff00eb84616a17fea7a4d72af35e750410f"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/guzzle/guzzle/zipball/a8dfeff00eb84616a17fea7a4d72af35e750410f",
+ "reference": "a8dfeff00eb84616a17fea7a4d72af35e750410f",
+ "shasum": ""
+ },
+ "require": {
+ "guzzlehttp/promises": "~1.0",
+ "guzzlehttp/psr7": "~1.1",
+ "php": ">=5.5.0"
+ },
+ "require-dev": {
+ "ext-curl": "*",
+ "phpunit/phpunit": "~4.0",
+ "psr/log": "~1.0"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "6.0-dev"
+ }
+ },
+ "autoload": {
+ "files": [
+ "src/functions_include.php"
+ ],
+ "psr-4": {
+ "GuzzleHttp\\": "src/"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Michael Dowling",
+ "email": "mtdowling@gmail.com",
+ "homepage": "https://github.com/mtdowling"
+ }
+ ],
+ "description": "Guzzle is a PHP HTTP client library",
+ "homepage": "http://guzzlephp.org/",
+ "keywords": [
+ "client",
+ "curl",
+ "framework",
+ "http",
+ "http client",
+ "rest",
+ "web service"
+ ],
+ "time": "2015-07-04 20:09:24"
+ },
+ {
+ "name": "guzzlehttp/promises",
+ "version": "1.0.1",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/guzzle/promises.git",
+ "reference": "2ee5bc7f1a92efecc90da7f6711a53a7be26b5b7"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/guzzle/promises/zipball/2ee5bc7f1a92efecc90da7f6711a53a7be26b5b7",
+ "reference": "2ee5bc7f1a92efecc90da7f6711a53a7be26b5b7",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=5.5.0"
+ },
+ "require-dev": {
+ "phpunit/phpunit": "~4.0"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "1.0-dev"
+ }
+ },
+ "autoload": {
+ "psr-4": {
+ "GuzzleHttp\\Promise\\": "src/"
+ },
+ "files": [
+ "src/functions.php"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Michael Dowling",
+ "email": "mtdowling@gmail.com",
+ "homepage": "https://github.com/mtdowling"
+ }
+ ],
+ "description": "Guzzle promises library",
+ "keywords": [
+ "promise"
+ ],
+ "time": "2015-06-24 16:16:25"
+ },
+ {
+ "name": "guzzlehttp/psr7",
+ "version": "1.1.0",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/guzzle/psr7.git",
+ "reference": "af0e1758de355eb113917ad79c3c0e3604bce4bd"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/guzzle/psr7/zipball/af0e1758de355eb113917ad79c3c0e3604bce4bd",
+ "reference": "af0e1758de355eb113917ad79c3c0e3604bce4bd",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=5.4.0",
+ "psr/http-message": "~1.0"
+ },
+ "provide": {
+ "psr/http-message-implementation": "1.0"
+ },
+ "require-dev": {
+ "phpunit/phpunit": "~4.0"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "1.0-dev"
+ }
+ },
+ "autoload": {
+ "psr-4": {
+ "GuzzleHttp\\Psr7\\": "src/"
+ },
+ "files": [
+ "src/functions.php"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Michael Dowling",
+ "email": "mtdowling@gmail.com",
+ "homepage": "https://github.com/mtdowling"
+ }
+ ],
+ "description": "PSR-7 message implementation",
+ "keywords": [
+ "http",
+ "message",
+ "stream",
+ "uri"
+ ],
+ "time": "2015-06-24 19:55:15"
+ },
{
"name": "illuminate/html",
"version": "v5.0.0",
@@ -902,20 +1244,20 @@
},
{
"name": "laravel/framework",
- "version": "v5.1.3",
+ "version": "v5.1.6",
"source": {
"type": "git",
"url": "https://github.com/laravel/framework.git",
- "reference": "a7ebd043ca178c05cc7946ece03d3a268a5a3f84"
+ "reference": "356418f315e4f6bf55d2f4bd451606e45a7595df"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/laravel/framework/zipball/a7ebd043ca178c05cc7946ece03d3a268a5a3f84",
- "reference": "a7ebd043ca178c05cc7946ece03d3a268a5a3f84",
+ "url": "https://api.github.com/repos/laravel/framework/zipball/356418f315e4f6bf55d2f4bd451606e45a7595df",
+ "reference": "356418f315e4f6bf55d2f4bd451606e45a7595df",
"shasum": ""
},
"require": {
- "classpreloader/classpreloader": "~1.2",
+ "classpreloader/classpreloader": "~2.0",
"danielstjules/stringy": "~1.8",
"doctrine/inflector": "~1.0",
"ext-mbstring": "*",
@@ -1026,7 +1368,7 @@
"framework",
"laravel"
],
- "time": "2015-06-24 19:38:07"
+ "time": "2015-07-03 13:48:44"
},
{
"name": "league/commonmark",
@@ -1087,6 +1429,63 @@
],
"time": "2015-03-08 17:48:53"
},
+ {
+ "name": "league/csv",
+ "version": "7.1.2",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/thephpleague/csv.git",
+ "reference": "2ee1760c262c41986f6371775907fc9e8603fd26"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/thephpleague/csv/zipball/2ee1760c262c41986f6371775907fc9e8603fd26",
+ "reference": "2ee1760c262c41986f6371775907fc9e8603fd26",
+ "shasum": ""
+ },
+ "require": {
+ "ext-mbstring": "*",
+ "php": ">=5.4.0"
+ },
+ "require-dev": {
+ "phpunit/phpunit": "~4.0",
+ "scrutinizer/ocular": "~1.1"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "7.1-dev"
+ }
+ },
+ "autoload": {
+ "psr-4": {
+ "League\\Csv\\": "src"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Ignace Nyamagana Butera",
+ "email": "nyamsprod@gmail.com",
+ "homepage": "https://github.com/nyamsprod/",
+ "role": "Developer"
+ }
+ ],
+ "description": "Csv data manipulation made easy in PHP",
+ "homepage": "http://csv.thephpleague.com",
+ "keywords": [
+ "csv",
+ "export",
+ "filter",
+ "import",
+ "read",
+ "write"
+ ],
+ "time": "2015-06-10 11:12:37"
+ },
{
"name": "league/flysystem",
"version": "1.0.4",
@@ -1383,6 +1782,531 @@
],
"time": "2015-05-02 15:40:40"
},
+ {
+ "name": "phpdocumentor/reflection-docblock",
+ "version": "2.0.4",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git",
+ "reference": "d68dbdc53dc358a816f00b300704702b2eaff7b8"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/d68dbdc53dc358a816f00b300704702b2eaff7b8",
+ "reference": "d68dbdc53dc358a816f00b300704702b2eaff7b8",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=5.3.3"
+ },
+ "require-dev": {
+ "phpunit/phpunit": "~4.0"
+ },
+ "suggest": {
+ "dflydev/markdown": "~1.0",
+ "erusev/parsedown": "~1.0"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "2.0.x-dev"
+ }
+ },
+ "autoload": {
+ "psr-0": {
+ "phpDocumentor": [
+ "src/"
+ ]
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Mike van Riel",
+ "email": "mike.vanriel@naenius.com"
+ }
+ ],
+ "time": "2015-02-03 12:10:50"
+ },
+ {
+ "name": "phpspec/prophecy",
+ "version": "v1.4.1",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/phpspec/prophecy.git",
+ "reference": "3132b1f44c7bf2ec4c7eb2d3cb78fdeca760d373"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/phpspec/prophecy/zipball/3132b1f44c7bf2ec4c7eb2d3cb78fdeca760d373",
+ "reference": "3132b1f44c7bf2ec4c7eb2d3cb78fdeca760d373",
+ "shasum": ""
+ },
+ "require": {
+ "doctrine/instantiator": "^1.0.2",
+ "phpdocumentor/reflection-docblock": "~2.0",
+ "sebastian/comparator": "~1.1"
+ },
+ "require-dev": {
+ "phpspec/phpspec": "~2.0"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "1.4.x-dev"
+ }
+ },
+ "autoload": {
+ "psr-0": {
+ "Prophecy\\": "src/"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Konstantin Kudryashov",
+ "email": "ever.zet@gmail.com",
+ "homepage": "http://everzet.com"
+ },
+ {
+ "name": "Marcello Duarte",
+ "email": "marcello.duarte@gmail.com"
+ }
+ ],
+ "description": "Highly opinionated mocking framework for PHP 5.3+",
+ "homepage": "https://github.com/phpspec/prophecy",
+ "keywords": [
+ "Double",
+ "Dummy",
+ "fake",
+ "mock",
+ "spy",
+ "stub"
+ ],
+ "time": "2015-04-27 22:15:08"
+ },
+ {
+ "name": "phpunit/php-code-coverage",
+ "version": "2.1.7",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/sebastianbergmann/php-code-coverage.git",
+ "reference": "07e27765596d72c378a6103e80da5d84e802f1e4"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/07e27765596d72c378a6103e80da5d84e802f1e4",
+ "reference": "07e27765596d72c378a6103e80da5d84e802f1e4",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=5.3.3",
+ "phpunit/php-file-iterator": "~1.3",
+ "phpunit/php-text-template": "~1.2",
+ "phpunit/php-token-stream": "~1.3",
+ "sebastian/environment": "~1.0",
+ "sebastian/version": "~1.0"
+ },
+ "require-dev": {
+ "ext-xdebug": ">=2.1.4",
+ "phpunit/phpunit": "~4"
+ },
+ "suggest": {
+ "ext-dom": "*",
+ "ext-xdebug": ">=2.2.1",
+ "ext-xmlwriter": "*"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "2.1.x-dev"
+ }
+ },
+ "autoload": {
+ "classmap": [
+ "src/"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "BSD-3-Clause"
+ ],
+ "authors": [
+ {
+ "name": "Sebastian Bergmann",
+ "email": "sb@sebastian-bergmann.de",
+ "role": "lead"
+ }
+ ],
+ "description": "Library that provides collection, processing, and rendering functionality for PHP code coverage information.",
+ "homepage": "https://github.com/sebastianbergmann/php-code-coverage",
+ "keywords": [
+ "coverage",
+ "testing",
+ "xunit"
+ ],
+ "time": "2015-06-30 06:52:35"
+ },
+ {
+ "name": "phpunit/php-file-iterator",
+ "version": "1.4.0",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/sebastianbergmann/php-file-iterator.git",
+ "reference": "a923bb15680d0089e2316f7a4af8f437046e96bb"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/a923bb15680d0089e2316f7a4af8f437046e96bb",
+ "reference": "a923bb15680d0089e2316f7a4af8f437046e96bb",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=5.3.3"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "1.4.x-dev"
+ }
+ },
+ "autoload": {
+ "classmap": [
+ "src/"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "BSD-3-Clause"
+ ],
+ "authors": [
+ {
+ "name": "Sebastian Bergmann",
+ "email": "sb@sebastian-bergmann.de",
+ "role": "lead"
+ }
+ ],
+ "description": "FilterIterator implementation that filters files based on a list of suffixes.",
+ "homepage": "https://github.com/sebastianbergmann/php-file-iterator/",
+ "keywords": [
+ "filesystem",
+ "iterator"
+ ],
+ "time": "2015-04-02 05:19:05"
+ },
+ {
+ "name": "phpunit/php-text-template",
+ "version": "1.2.1",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/sebastianbergmann/php-text-template.git",
+ "reference": "31f8b717e51d9a2afca6c9f046f5d69fc27c8686"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/31f8b717e51d9a2afca6c9f046f5d69fc27c8686",
+ "reference": "31f8b717e51d9a2afca6c9f046f5d69fc27c8686",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=5.3.3"
+ },
+ "type": "library",
+ "autoload": {
+ "classmap": [
+ "src/"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "BSD-3-Clause"
+ ],
+ "authors": [
+ {
+ "name": "Sebastian Bergmann",
+ "email": "sebastian@phpunit.de",
+ "role": "lead"
+ }
+ ],
+ "description": "Simple template engine.",
+ "homepage": "https://github.com/sebastianbergmann/php-text-template/",
+ "keywords": [
+ "template"
+ ],
+ "time": "2015-06-21 13:50:34"
+ },
+ {
+ "name": "phpunit/php-timer",
+ "version": "1.0.6",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/sebastianbergmann/php-timer.git",
+ "reference": "83fe1bdc5d47658b727595c14da140da92b3d66d"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/83fe1bdc5d47658b727595c14da140da92b3d66d",
+ "reference": "83fe1bdc5d47658b727595c14da140da92b3d66d",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=5.3.3"
+ },
+ "type": "library",
+ "autoload": {
+ "classmap": [
+ "src/"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "BSD-3-Clause"
+ ],
+ "authors": [
+ {
+ "name": "Sebastian Bergmann",
+ "email": "sb@sebastian-bergmann.de",
+ "role": "lead"
+ }
+ ],
+ "description": "Utility class for timing",
+ "homepage": "https://github.com/sebastianbergmann/php-timer/",
+ "keywords": [
+ "timer"
+ ],
+ "time": "2015-06-13 07:35:30"
+ },
+ {
+ "name": "phpunit/php-token-stream",
+ "version": "1.4.3",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/sebastianbergmann/php-token-stream.git",
+ "reference": "7a9b0969488c3c54fd62b4d504b3ec758fd005d9"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/7a9b0969488c3c54fd62b4d504b3ec758fd005d9",
+ "reference": "7a9b0969488c3c54fd62b4d504b3ec758fd005d9",
+ "shasum": ""
+ },
+ "require": {
+ "ext-tokenizer": "*",
+ "php": ">=5.3.3"
+ },
+ "require-dev": {
+ "phpunit/phpunit": "~4.2"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "1.4-dev"
+ }
+ },
+ "autoload": {
+ "classmap": [
+ "src/"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "BSD-3-Clause"
+ ],
+ "authors": [
+ {
+ "name": "Sebastian Bergmann",
+ "email": "sebastian@phpunit.de"
+ }
+ ],
+ "description": "Wrapper around PHP's tokenizer extension.",
+ "homepage": "https://github.com/sebastianbergmann/php-token-stream/",
+ "keywords": [
+ "tokenizer"
+ ],
+ "time": "2015-06-19 03:43:16"
+ },
+ {
+ "name": "phpunit/phpunit",
+ "version": "4.7.6",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/sebastianbergmann/phpunit.git",
+ "reference": "0ebabb4cda7d066be8391dfdbaf57fe70ac9a99b"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/0ebabb4cda7d066be8391dfdbaf57fe70ac9a99b",
+ "reference": "0ebabb4cda7d066be8391dfdbaf57fe70ac9a99b",
+ "shasum": ""
+ },
+ "require": {
+ "ext-dom": "*",
+ "ext-json": "*",
+ "ext-pcre": "*",
+ "ext-reflection": "*",
+ "ext-spl": "*",
+ "php": ">=5.3.3",
+ "phpspec/prophecy": "~1.3,>=1.3.1",
+ "phpunit/php-code-coverage": "~2.1",
+ "phpunit/php-file-iterator": "~1.4",
+ "phpunit/php-text-template": "~1.2",
+ "phpunit/php-timer": ">=1.0.6",
+ "phpunit/phpunit-mock-objects": "~2.3",
+ "sebastian/comparator": "~1.1",
+ "sebastian/diff": "~1.2",
+ "sebastian/environment": "~1.2",
+ "sebastian/exporter": "~1.2",
+ "sebastian/global-state": "~1.0",
+ "sebastian/version": "~1.0",
+ "symfony/yaml": "~2.1|~3.0"
+ },
+ "suggest": {
+ "phpunit/php-invoker": "~1.1"
+ },
+ "bin": [
+ "phpunit"
+ ],
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "4.7.x-dev"
+ }
+ },
+ "autoload": {
+ "classmap": [
+ "src/"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "BSD-3-Clause"
+ ],
+ "authors": [
+ {
+ "name": "Sebastian Bergmann",
+ "email": "sebastian@phpunit.de",
+ "role": "lead"
+ }
+ ],
+ "description": "The PHP Unit Testing framework.",
+ "homepage": "https://phpunit.de/",
+ "keywords": [
+ "phpunit",
+ "testing",
+ "xunit"
+ ],
+ "time": "2015-06-30 06:53:57"
+ },
+ {
+ "name": "phpunit/phpunit-mock-objects",
+ "version": "2.3.5",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/sebastianbergmann/phpunit-mock-objects.git",
+ "reference": "1c330b1b6e1ea8fd15f2fbea46770576e366855c"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/1c330b1b6e1ea8fd15f2fbea46770576e366855c",
+ "reference": "1c330b1b6e1ea8fd15f2fbea46770576e366855c",
+ "shasum": ""
+ },
+ "require": {
+ "doctrine/instantiator": "~1.0,>=1.0.2",
+ "php": ">=5.3.3",
+ "phpunit/php-text-template": "~1.2"
+ },
+ "require-dev": {
+ "phpunit/phpunit": "~4.4"
+ },
+ "suggest": {
+ "ext-soap": "*"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "2.3.x-dev"
+ }
+ },
+ "autoload": {
+ "classmap": [
+ "src/"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "BSD-3-Clause"
+ ],
+ "authors": [
+ {
+ "name": "Sebastian Bergmann",
+ "email": "sb@sebastian-bergmann.de",
+ "role": "lead"
+ }
+ ],
+ "description": "Mock Object library for PHPUnit",
+ "homepage": "https://github.com/sebastianbergmann/phpunit-mock-objects/",
+ "keywords": [
+ "mock",
+ "xunit"
+ ],
+ "time": "2015-07-04 05:41:32"
+ },
+ {
+ "name": "psr/http-message",
+ "version": "1.0",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/php-fig/http-message.git",
+ "reference": "85d63699f0dbedb190bbd4b0d2b9dc707ea4c298"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/php-fig/http-message/zipball/85d63699f0dbedb190bbd4b0d2b9dc707ea4c298",
+ "reference": "85d63699f0dbedb190bbd4b0d2b9dc707ea4c298",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=5.3.0"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "1.0.x-dev"
+ }
+ },
+ "autoload": {
+ "psr-4": {
+ "Psr\\Http\\Message\\": "src/"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "PHP-FIG",
+ "homepage": "http://www.php-fig.org/"
+ }
+ ],
+ "description": "Common interface for HTTP messages",
+ "keywords": [
+ "http",
+ "http-message",
+ "psr",
+ "psr-7",
+ "request",
+ "response"
+ ],
+ "time": "2015-05-04 20:22:00"
+ },
{
"name": "psr/log",
"version": "1.0.0",
@@ -1556,6 +2480,377 @@
],
"time": "2015-05-21 13:46:00"
},
+ {
+ "name": "sebastian/comparator",
+ "version": "1.1.1",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/sebastianbergmann/comparator.git",
+ "reference": "1dd8869519a225f7f2b9eb663e225298fade819e"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/1dd8869519a225f7f2b9eb663e225298fade819e",
+ "reference": "1dd8869519a225f7f2b9eb663e225298fade819e",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=5.3.3",
+ "sebastian/diff": "~1.2",
+ "sebastian/exporter": "~1.2"
+ },
+ "require-dev": {
+ "phpunit/phpunit": "~4.4"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "1.1.x-dev"
+ }
+ },
+ "autoload": {
+ "classmap": [
+ "src/"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "BSD-3-Clause"
+ ],
+ "authors": [
+ {
+ "name": "Jeff Welch",
+ "email": "whatthejeff@gmail.com"
+ },
+ {
+ "name": "Volker Dusch",
+ "email": "github@wallbash.com"
+ },
+ {
+ "name": "Bernhard Schussek",
+ "email": "bschussek@2bepublished.at"
+ },
+ {
+ "name": "Sebastian Bergmann",
+ "email": "sebastian@phpunit.de"
+ }
+ ],
+ "description": "Provides the functionality to compare PHP values for equality",
+ "homepage": "http://www.github.com/sebastianbergmann/comparator",
+ "keywords": [
+ "comparator",
+ "compare",
+ "equality"
+ ],
+ "time": "2015-01-29 16:28:08"
+ },
+ {
+ "name": "sebastian/diff",
+ "version": "1.3.0",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/sebastianbergmann/diff.git",
+ "reference": "863df9687835c62aa423a22412d26fa2ebde3fd3"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/863df9687835c62aa423a22412d26fa2ebde3fd3",
+ "reference": "863df9687835c62aa423a22412d26fa2ebde3fd3",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=5.3.3"
+ },
+ "require-dev": {
+ "phpunit/phpunit": "~4.2"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "1.3-dev"
+ }
+ },
+ "autoload": {
+ "classmap": [
+ "src/"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "BSD-3-Clause"
+ ],
+ "authors": [
+ {
+ "name": "Kore Nordmann",
+ "email": "mail@kore-nordmann.de"
+ },
+ {
+ "name": "Sebastian Bergmann",
+ "email": "sebastian@phpunit.de"
+ }
+ ],
+ "description": "Diff implementation",
+ "homepage": "http://www.github.com/sebastianbergmann/diff",
+ "keywords": [
+ "diff"
+ ],
+ "time": "2015-02-22 15:13:53"
+ },
+ {
+ "name": "sebastian/environment",
+ "version": "1.2.2",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/sebastianbergmann/environment.git",
+ "reference": "5a8c7d31914337b69923db26c4221b81ff5a196e"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/5a8c7d31914337b69923db26c4221b81ff5a196e",
+ "reference": "5a8c7d31914337b69923db26c4221b81ff5a196e",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=5.3.3"
+ },
+ "require-dev": {
+ "phpunit/phpunit": "~4.4"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "1.3.x-dev"
+ }
+ },
+ "autoload": {
+ "classmap": [
+ "src/"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "BSD-3-Clause"
+ ],
+ "authors": [
+ {
+ "name": "Sebastian Bergmann",
+ "email": "sebastian@phpunit.de"
+ }
+ ],
+ "description": "Provides functionality to handle HHVM/PHP environments",
+ "homepage": "http://www.github.com/sebastianbergmann/environment",
+ "keywords": [
+ "Xdebug",
+ "environment",
+ "hhvm"
+ ],
+ "time": "2015-01-01 10:01:08"
+ },
+ {
+ "name": "sebastian/exporter",
+ "version": "1.2.0",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/sebastianbergmann/exporter.git",
+ "reference": "84839970d05254c73cde183a721c7af13aede943"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/84839970d05254c73cde183a721c7af13aede943",
+ "reference": "84839970d05254c73cde183a721c7af13aede943",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=5.3.3",
+ "sebastian/recursion-context": "~1.0"
+ },
+ "require-dev": {
+ "phpunit/phpunit": "~4.4"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "1.2.x-dev"
+ }
+ },
+ "autoload": {
+ "classmap": [
+ "src/"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "BSD-3-Clause"
+ ],
+ "authors": [
+ {
+ "name": "Jeff Welch",
+ "email": "whatthejeff@gmail.com"
+ },
+ {
+ "name": "Volker Dusch",
+ "email": "github@wallbash.com"
+ },
+ {
+ "name": "Bernhard Schussek",
+ "email": "bschussek@2bepublished.at"
+ },
+ {
+ "name": "Sebastian Bergmann",
+ "email": "sebastian@phpunit.de"
+ },
+ {
+ "name": "Adam Harvey",
+ "email": "aharvey@php.net"
+ }
+ ],
+ "description": "Provides the functionality to export PHP variables for visualization",
+ "homepage": "http://www.github.com/sebastianbergmann/exporter",
+ "keywords": [
+ "export",
+ "exporter"
+ ],
+ "time": "2015-01-27 07:23:06"
+ },
+ {
+ "name": "sebastian/global-state",
+ "version": "1.0.0",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/sebastianbergmann/global-state.git",
+ "reference": "c7428acdb62ece0a45e6306f1ae85e1c05b09c01"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/c7428acdb62ece0a45e6306f1ae85e1c05b09c01",
+ "reference": "c7428acdb62ece0a45e6306f1ae85e1c05b09c01",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=5.3.3"
+ },
+ "require-dev": {
+ "phpunit/phpunit": "~4.2"
+ },
+ "suggest": {
+ "ext-uopz": "*"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "1.0-dev"
+ }
+ },
+ "autoload": {
+ "classmap": [
+ "src/"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "BSD-3-Clause"
+ ],
+ "authors": [
+ {
+ "name": "Sebastian Bergmann",
+ "email": "sebastian@phpunit.de"
+ }
+ ],
+ "description": "Snapshotting of global state",
+ "homepage": "http://www.github.com/sebastianbergmann/global-state",
+ "keywords": [
+ "global state"
+ ],
+ "time": "2014-10-06 09:23:50"
+ },
+ {
+ "name": "sebastian/recursion-context",
+ "version": "1.0.0",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/sebastianbergmann/recursion-context.git",
+ "reference": "3989662bbb30a29d20d9faa04a846af79b276252"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/3989662bbb30a29d20d9faa04a846af79b276252",
+ "reference": "3989662bbb30a29d20d9faa04a846af79b276252",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=5.3.3"
+ },
+ "require-dev": {
+ "phpunit/phpunit": "~4.4"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "1.0.x-dev"
+ }
+ },
+ "autoload": {
+ "classmap": [
+ "src/"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "BSD-3-Clause"
+ ],
+ "authors": [
+ {
+ "name": "Jeff Welch",
+ "email": "whatthejeff@gmail.com"
+ },
+ {
+ "name": "Sebastian Bergmann",
+ "email": "sebastian@phpunit.de"
+ },
+ {
+ "name": "Adam Harvey",
+ "email": "aharvey@php.net"
+ }
+ ],
+ "description": "Provides functionality to recursively process PHP variables",
+ "homepage": "http://www.github.com/sebastianbergmann/recursion-context",
+ "time": "2015-01-24 09:48:32"
+ },
+ {
+ "name": "sebastian/version",
+ "version": "1.0.6",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/sebastianbergmann/version.git",
+ "reference": "58b3a85e7999757d6ad81c787a1fbf5ff6c628c6"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/58b3a85e7999757d6ad81c787a1fbf5ff6c628c6",
+ "reference": "58b3a85e7999757d6ad81c787a1fbf5ff6c628c6",
+ "shasum": ""
+ },
+ "type": "library",
+ "autoload": {
+ "classmap": [
+ "src/"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "BSD-3-Clause"
+ ],
+ "authors": [
+ {
+ "name": "Sebastian Bergmann",
+ "email": "sebastian@phpunit.de",
+ "role": "lead"
+ }
+ ],
+ "description": "Library that helps with managing the version number of Git-hosted PHP projects",
+ "homepage": "https://github.com/sebastianbergmann/version",
+ "time": "2015-06-21 13:59:46"
+ },
{
"name": "swiftmailer/swiftmailer",
"version": "v5.4.1",
@@ -1609,6 +2904,61 @@
],
"time": "2015-06-06 14:19:39"
},
+ {
+ "name": "symfony/browser-kit",
+ "version": "v2.7.1",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/symfony/BrowserKit.git",
+ "reference": "d0a144a1a96d5dc90bed2814b2096a1322761672"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/symfony/BrowserKit/zipball/d0a144a1a96d5dc90bed2814b2096a1322761672",
+ "reference": "d0a144a1a96d5dc90bed2814b2096a1322761672",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=5.3.9",
+ "symfony/dom-crawler": "~2.0,>=2.0.5"
+ },
+ "require-dev": {
+ "symfony/css-selector": "~2.0,>=2.0.5",
+ "symfony/phpunit-bridge": "~2.7",
+ "symfony/process": "~2.0,>=2.0.5"
+ },
+ "suggest": {
+ "symfony/process": ""
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "2.7-dev"
+ }
+ },
+ "autoload": {
+ "psr-4": {
+ "Symfony\\Component\\BrowserKit\\": ""
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Fabien Potencier",
+ "email": "fabien@symfony.com"
+ },
+ {
+ "name": "Symfony Community",
+ "homepage": "https://symfony.com/contributors"
+ }
+ ],
+ "description": "Symfony BrowserKit Component",
+ "homepage": "https://symfony.com",
+ "time": "2015-06-04 20:11:48"
+ },
{
"name": "symfony/console",
"version": "v2.7.1",
@@ -1890,55 +3240,6 @@
"homepage": "https://symfony.com",
"time": "2015-06-08 09:37:21"
},
- {
- "name": "symfony/filesystem",
- "version": "v2.7.1",
- "source": {
- "type": "git",
- "url": "https://github.com/symfony/Filesystem.git",
- "reference": "a0d43eb3e17d4f4c6990289805a488a0482a07f3"
- },
- "dist": {
- "type": "zip",
- "url": "https://api.github.com/repos/symfony/Filesystem/zipball/a0d43eb3e17d4f4c6990289805a488a0482a07f3",
- "reference": "a0d43eb3e17d4f4c6990289805a488a0482a07f3",
- "shasum": ""
- },
- "require": {
- "php": ">=5.3.9"
- },
- "require-dev": {
- "symfony/phpunit-bridge": "~2.7"
- },
- "type": "library",
- "extra": {
- "branch-alias": {
- "dev-master": "2.7-dev"
- }
- },
- "autoload": {
- "psr-4": {
- "Symfony\\Component\\Filesystem\\": ""
- }
- },
- "notification-url": "https://packagist.org/downloads/",
- "license": [
- "MIT"
- ],
- "authors": [
- {
- "name": "Fabien Potencier",
- "email": "fabien@symfony.com"
- },
- {
- "name": "Symfony Community",
- "homepage": "https://symfony.com/contributors"
- }
- ],
- "description": "Symfony Filesystem Component",
- "homepage": "https://symfony.com",
- "time": "2015-06-08 09:37:21"
- },
{
"name": "symfony/finder",
"version": "v2.7.1",
@@ -2361,6 +3662,55 @@
],
"time": "2015-06-08 09:37:21"
},
+ {
+ "name": "symfony/yaml",
+ "version": "v2.7.1",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/symfony/Yaml.git",
+ "reference": "9808e75c609a14f6db02f70fccf4ca4aab53c160"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/symfony/Yaml/zipball/9808e75c609a14f6db02f70fccf4ca4aab53c160",
+ "reference": "9808e75c609a14f6db02f70fccf4ca4aab53c160",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=5.3.9"
+ },
+ "require-dev": {
+ "symfony/phpunit-bridge": "~2.7"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "2.7-dev"
+ }
+ },
+ "autoload": {
+ "psr-4": {
+ "Symfony\\Component\\Yaml\\": ""
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Fabien Potencier",
+ "email": "fabien@symfony.com"
+ },
+ {
+ "name": "Symfony Community",
+ "homepage": "https://symfony.com/contributors"
+ }
+ ],
+ "description": "Symfony Yaml Component",
+ "homepage": "https://symfony.com",
+ "time": "2015-06-10 15:30:22"
+ },
{
"name": "twig/twig",
"version": "v1.18.2",
diff --git a/config/csv.php b/config/csv.php
new file mode 100644
index 0000000000..e9d57e473a
--- /dev/null
+++ b/config/csv.php
@@ -0,0 +1,197 @@
+ [
+ 'RabobankDescription',
+ 'Dummy'
+ ],
+ 'post_processors' => [
+ 'Description',
+ 'Amount',
+ 'Currency',
+ 'Bill',
+ 'OpposingAccount', // must be after Amount!
+
+ ],
+ 'roles' => [
+ '_ignore' => [
+ 'name' => '(ignore this column)',
+ 'mappable' => false,
+ 'converter' => 'Ignore',
+ 'field' => 'ignored',
+ ],
+ 'bill-id' => [
+ 'name' => 'Bill ID (matching Firefly)',
+ 'mappable' => false,
+ 'field' => 'bill',
+ 'converter' => 'BillId',
+ 'mapper' => 'Bill',
+ ],
+ 'bill-name' => [
+ 'name' => 'Bill name',
+ 'mappable' => true,
+ 'converter' => 'BillName',
+ 'field' => 'bill',
+ 'mapper' => 'Bill',
+ ],
+ 'currency-id' => [
+ 'name' => 'Currency ID (matching Firefly)',
+ 'mappable' => true,
+ 'converter' => 'CurrencyId',
+ 'field' => 'currency',
+ 'mapper' => 'TransactionCurrency'
+ ],
+ 'currency-name' => [
+ 'name' => 'Currency name (matching Firefly)',
+ 'mappable' => true,
+ 'converter' => 'CurrencyName',
+ 'field' => 'currency',
+ 'mapper' => 'TransactionCurrency'
+ ],
+ 'currency-code' => [
+ 'name' => 'Currency code (ISO 4217)',
+ 'mappable' => true,
+ 'converter' => 'CurrencyCode',
+ 'field' => 'currency',
+ 'mapper' => 'TransactionCurrency'
+ ],
+ 'currency-symbol' => [
+ 'name' => 'Currency symbol (matching Firefly)',
+ 'mappable' => true,
+ 'converter' => 'CurrencySymbol',
+ 'field' => 'currency',
+ 'mapper' => 'TransactionCurrency'
+ ],
+ 'description' => [
+ 'name' => 'Description',
+ 'mappable' => false,
+ 'converter' => 'Description',
+ 'field' => 'description',
+ ],
+ 'date-transaction' => [
+ 'name' => 'Date',
+ 'mappable' => false,
+ 'converter' => 'Date',
+ 'field' => 'date',
+ ],
+ 'date-rent' => [
+ 'name' => 'Rent calculation date',
+ 'mappable' => false,
+ 'converter' => 'Date',
+ 'field' => 'date-rent',
+ ],
+ 'budget-id' => [
+ 'name' => 'Budget ID (matching Firefly)',
+ 'mappable' => true,
+ 'converter' => 'BudgetId',
+ 'field' => 'budget',
+ 'mapper' => 'Budget',
+ ],
+ 'budget-name' => [
+ 'name' => 'Budget name',
+ 'mappable' => true,
+ 'converter' => 'BudgetName',
+ 'field' => 'budget',
+ 'mapper' => 'Budget',
+ ],
+ 'rabo-debet-credit' => [
+ 'name' => 'Rabobank specific debet/credit indicator',
+ 'mappable' => false,
+ 'converter' => 'RabobankDebetCredit',
+ 'field' => 'amount-modifier',
+ ],
+ 'category-id' => [
+ 'name' => 'Category ID (matching Firefly)',
+ 'mappable' => true,
+ 'converter' => 'CategoryId',
+ 'field' => 'category',
+ 'mapper' => 'Category',
+ ],
+ 'category-name' => [
+ 'name' => 'Category name',
+ 'mappable' => true,
+ 'converter' => 'CategoryName',
+ 'field' => 'category',
+ 'mapper' => 'Category',
+ ],
+ 'tags-comma' => [
+ 'name' => 'Tags (comma separated)',
+ 'mappable' => true,
+ 'field' => 'tags',
+ 'converter' => 'TagsComma',
+ 'mapper' => 'Tag',
+ ],
+ 'tags-space' => [
+ 'name' => 'Tags (space separated)',
+ 'mappable' => true,
+ 'field' => 'tags',
+ 'converter' => 'TagsSpace',
+ 'mapper' => 'Tag',
+ ],
+ 'account-id' => [
+ 'name' => 'Asset account ID (matching Firefly)',
+ 'mappable' => true,
+ 'mapper' => 'AssetAccount',
+ 'field' => 'asset-account',
+ 'converter' => 'AccountId'
+ ],
+ 'account-name' => [
+ 'name' => 'Asset account name',
+ 'mappable' => true,
+ 'mapper' => 'AssetAccount',
+ 'field' => 'asset-account',
+ 'converter' => 'AssetAccountName'
+ ],
+ 'account-iban' => [
+ 'name' => 'Asset account IBAN',
+ 'mappable' => true,
+ 'converter' => 'AssetAccountIban',
+ 'field' => 'asset-account',
+ 'mapper' => 'AssetAccount'
+ ],
+ 'opposing-id' => [
+ 'name' => 'Opposing account account ID (matching Firefly)',
+ 'mappable' => true,
+ 'field' => 'opposing-account-id',
+ 'converter' => 'OpposingAccountId',
+ 'mapper' => 'AnyAccount',
+ ],
+ 'opposing-name' => [
+ 'name' => 'Opposing account name',
+ 'mappable' => true,
+ 'field' => 'opposing-account-name',
+ 'converter' => 'OpposingAccountName',
+ 'mapper' => 'AnyAccount',
+ ],
+ 'opposing-iban' => [
+ 'name' => 'Opposing account IBAN',
+ 'mappable' => true,
+ 'field' => 'opposing-account-iban',
+ 'converter' => 'OpposingAccountIban',
+ 'mapper' => 'AnyAccount',
+ ],
+ 'amount' => [
+ 'name' => 'Amount',
+ 'mappable' => false,
+ 'converter' => 'Amount',
+ 'field' => 'amount',
+ ],
+ 'sepa-ct-id' => [
+ 'name' => 'SEPA Credit Transfer end-to-end ID',
+ 'mappable' => false,
+ 'converter' => 'Description',
+ 'field' => 'description',
+ ],
+ 'sepa-ct-op' => [
+ 'name' => 'SEPA Credit Transfer opposing account',
+ 'mappable' => false,
+ 'converter' => 'Description',
+ 'field' => 'description',
+ ],
+ 'sepa-db' => [
+ 'name' => 'SEPA Direct Debet',
+ 'mappable' => false,
+ 'converter' => 'Description',
+ 'field' => 'description',
+ ],
+ ]
+];
\ No newline at end of file
diff --git a/config/firefly.php b/config/firefly.php
index e56f64e13e..aa34693bf9 100644
--- a/config/firefly.php
+++ b/config/firefly.php
@@ -1,10 +1,11 @@
'chartjs', // or 'chartjs'
- 'version' => '3.4.6',
+ 'chart' => 'chartjs',
+ 'version' => '3.4.7',
'index_periods' => ['1D', '1W', '1M', '3M', '6M', '1Y', 'custom'],
'budget_periods' => ['daily', 'weekly', 'monthly', 'quarterly', 'half-year', 'yearly'],
+ 'csv_import_enabled' => true,
'piggy_bank_periods' => [
'week' => 'Week',
'month' => 'Month',
@@ -101,6 +102,24 @@ return [
'en' => ['en', 'English', 'en_US', 'en_US.utf8'],
'nl' => ['nl', 'Dutch', 'nl_NL', 'nl_NL.utf8'],
],
+ 'transactionTypesByWhat' => [
+ 'expenses' => ['Withdrawal'],
+ 'withdrawal' => ['Withdrawal'],
+ 'revenue' => ['Deposit'],
+ 'deposit' => ['Deposit'],
+ 'transfer' => ['Transfer'],
+ 'transfers' => ['Transfer'],
+ ],
+ 'transactionIconsByWhat' => [
+ 'expenses' => 'fa-long-arrow-left',
+ 'withdrawal' => 'fa-long-arrow-left',
+ 'revenue' => 'fa-long-arrow-right',
+ 'deposit' => 'fa-long-arrow-right',
+ 'transfer' => 'fa-exchange',
+ 'transfers' => 'fa-exchange',
+
+ ],
+
'month' => [
'en' => '%B %Y',
'nl' => '%B %Y',
diff --git a/config/twigbridge.php b/config/twigbridge.php
index 04d882d65e..dd60091875 100644
--- a/config/twigbridge.php
+++ b/config/twigbridge.php
@@ -145,12 +145,12 @@ return [
'ExpandedForm' => [
'is_safe' => [
'date', 'text', 'select', 'balance', 'optionsList', 'checkbox', 'amount', 'tags', 'integer', 'textarea', 'location',
- 'multiRadio'
+ 'multiRadio','file','multiCheckbox'
]
],
'Form' => [
'is_safe' => [
- 'input', 'select', 'checkbox', 'model', 'open', 'radio', 'textarea'
+ 'input', 'select', 'checkbox', 'model', 'open', 'radio', 'textarea','file'
]
],
],
diff --git a/database/migrations/2015_06_23_050233_changes_for_v3451.php b/database/migrations/2015_06_23_050233_changes_for_v3451.php
deleted file mode 100644
index 7c2ee2ccaa..0000000000
--- a/database/migrations/2015_06_23_050233_changes_for_v3451.php
+++ /dev/null
@@ -1,33 +0,0 @@
-smallInteger('reminder_skip')->unsigned();
- //$table->boolean('remind_me');
-
- /**
- * Run the migrations.
- *
- * @return void
- */
- public function up()
- {
-
-
- }
-}
diff --git a/database/migrations/2015_07_03_102450_changes_for_v3462.php b/database/migrations/2015_07_03_102450_changes_for_v3462.php
new file mode 100644
index 0000000000..930c8b0bab
--- /dev/null
+++ b/database/migrations/2015_07_03_102450_changes_for_v3462.php
@@ -0,0 +1,39 @@
+dropColumn('iban');
+ }
+ );
+ }
+
+ /**
+ * Run the migrations.
+ *
+ * @return void
+ */
+ public function up()
+ {
+ // add IBAN to accounts:
+ Schema::table(
+ 'accounts', function (Blueprint $table) {
+ $table->string('iban')->nullable();
+ }
+ );
+ }
+}
diff --git a/database/seeds/TestDataSeeder.php b/database/seeds/TestDataSeeder.php
index 2ef6f90674..cca8a151fd 100644
--- a/database/seeds/TestDataSeeder.php
+++ b/database/seeds/TestDataSeeder.php
@@ -7,6 +7,7 @@ use FireflyIII\Models\Budget;
use FireflyIII\Models\BudgetLimit;
use FireflyIII\Models\Category;
use FireflyIII\Models\PiggyBank;
+use FireflyIII\Models\PiggyBankEvent;
use FireflyIII\Models\Role;
use FireflyIII\Models\Tag;
use FireflyIII\Models\Transaction;
@@ -45,6 +46,7 @@ class TestDataSeeder extends Seeder
$this->createExpenseAccounts();
$this->createRevenueAccounts();
$this->createBills();
+ $this->createPiggybanks();
// dates:
$start = Carbon::now()->subyear()->startOfMonth();
@@ -98,7 +100,7 @@ class TestDataSeeder extends Seeder
protected function createAssetAccounts()
{
- $assets = ['MyBank Checking Account', 'Savings', 'Shared', 'Creditcard'];
+ $assets = ['MyBank Checking Account', 'Savings', 'Shared', 'Creditcard', 'Emergencies', 'STE'];
$assetMeta = [
[
'accountRole' => 'defaultAsset',
@@ -114,6 +116,12 @@ class TestDataSeeder extends Seeder
'ccMonthlyPaymentDate' => '2015-05-27',
'ccType' => 'monthlyFull'
],
+ [
+ 'accountRole' => 'savingAsset',
+ ],
+ [
+ 'accountRole' => 'savingAsset',
+ ],
];
@@ -126,6 +134,7 @@ class TestDataSeeder extends Seeder
'name' => $name,
'active' => 1,
'encrypted' => 1,
+ 'iban' => 'GB82WEST12345698765432'
]
);
foreach ($assetMeta[$index] as $name => $value) {
@@ -206,6 +215,144 @@ class TestDataSeeder extends Seeder
);
}
+ protected function createPiggybanks()
+ {
+ $account = $this->findAccount('Savings');
+
+ $camera = PiggyBank::create(
+ [
+ 'account_id' => $account->id,
+ 'name' => 'New camera',
+ 'targetamount' => 1000,
+ 'startdate' => '2015-04-01',
+ 'reminder_skip' => 0,
+ 'remind_me' => 0,
+ 'order' => 1,
+ ]
+ );
+ $repetition = $camera->piggyBankRepetitions()->first();
+ $repetition->currentamount = 735;
+ $repetition->save();
+
+ // events:
+ PiggyBankEvent::create(
+ [
+ 'piggy_bank_id' => $camera->id,
+ 'date' => '2015-05-01',
+ 'amount' => '245'
+ ]
+ );
+ PiggyBankEvent::create(
+ [
+ 'piggy_bank_id' => $camera->id,
+ 'date' => '2015-06-01',
+ 'amount' => '245'
+ ]
+ );
+ PiggyBankEvent::create(
+ [
+ 'piggy_bank_id' => $camera->id,
+ 'date' => '2015-07-01',
+ 'amount' => '245'
+ ]
+ );
+
+
+ $phone = PiggyBank::create(
+ [
+ 'account_id' => $account->id,
+ 'name' => 'New phone',
+ 'targetamount' => 600,
+ 'startdate' => '2015-04-01',
+ 'reminder_skip' => 0,
+ 'remind_me' => 0,
+ 'order' => 1,
+ ]
+ );
+ $repetition = $phone->piggyBankRepetitions()->first();
+ $repetition->currentamount = 333;
+ $repetition->save();
+
+ // events:
+ PiggyBankEvent::create(
+ [
+ 'piggy_bank_id' => $phone->id,
+ 'date' => '2015-05-01',
+ 'amount' => '111'
+ ]
+ );
+ PiggyBankEvent::create(
+ [
+ 'piggy_bank_id' => $phone->id,
+ 'date' => '2015-06-01',
+ 'amount' => '111'
+ ]
+ );
+ PiggyBankEvent::create(
+ [
+ 'piggy_bank_id' => $phone->id,
+ 'date' => '2015-07-01',
+ 'amount' => '111'
+ ]
+ );
+
+ $couch = PiggyBank::create(
+ [
+ 'account_id' => $account->id,
+ 'name' => 'New couch',
+ 'targetamount' => 500,
+ 'startdate' => '2015-04-01',
+ 'reminder_skip' => 0,
+ 'remind_me' => 0,
+ 'order' => 1,
+ ]
+ );
+ $repetition = $couch->piggyBankRepetitions()->first();
+ $repetition->currentamount = 120;
+ $repetition->save();
+
+ // events:
+ PiggyBankEvent::create(
+ [
+ 'piggy_bank_id' => $couch->id,
+ 'date' => '2015-05-01',
+ 'amount' => '40'
+ ]
+ );
+ PiggyBankEvent::create(
+ [
+ 'piggy_bank_id' => $couch->id,
+ 'date' => '2015-06-01',
+ 'amount' => '40'
+ ]
+ );
+ PiggyBankEvent::create(
+ [
+ 'piggy_bank_id' => $couch->id,
+ 'date' => '2015-07-01',
+ 'amount' => '40'
+ ]
+ );
+ }
+
+ /**
+ * @param $name
+ *
+ * @return Account|null
+ */
+ protected function findAccount($name)
+ {
+ /** @var Account $account */
+ foreach (Account::get() as $account) {
+ if ($account->name == $name && $this->user->id == $account->user_id) {
+ return $account;
+ break;
+ }
+ }
+
+ return null;
+ }
+
/**
* @param $description
* @param Carbon $date
@@ -253,24 +400,6 @@ class TestDataSeeder extends Seeder
}
- /**
- * @param $name
- *
- * @return Account|null
- */
- protected function findAccount($name)
- {
- /** @var Account $account */
- foreach (Account::get() as $account) {
- if ($account->name == $name && $this->user->id == $account->user_id) {
- return $account;
- break;
- }
- }
-
- return null;
- }
-
/**
* @param $description
* @param Carbon $date
@@ -586,7 +715,7 @@ class TestDataSeeder extends Seeder
$journal = TransactionJournal::create(
[
'user_id' => $this->user->id,
- 'transaction_type_id' => 2,
+ 'transaction_type_id' => 3,
'transaction_currency_id' => 1,
'description' => 'Save money',
'completed' => 1,
diff --git a/resources/lang/en/firefly.php b/resources/lang/en/firefly.php
index d6feb0f661..81c8a5cc7f 100644
--- a/resources/lang/en/firefly.php
+++ b/resources/lang/en/firefly.php
@@ -2,290 +2,389 @@
return [
// general stuff:
- 'test' => 'You have selected English.',
- 'close' => 'Close',
- 'pleaseHold' => 'Please hold...',
- 'actions' => 'Actions',
- 'edit' => 'Edit',
- 'delete' => 'Delete',
- 'welcomeBack' => 'What\'s playing?',
- 'everything' => 'Everything',
- 'customRange' => 'Custom range',
- 'apply' => 'Apply',
- 'cancel' => 'Cancel',
- 'from' => 'From',
- 'to' => 'To',
- 'showEverything' => 'Show everything',
- 'never' => 'Never',
- 'search_results_for' => 'Search results for ":query"',
+ 'test' => 'You have selected English.',
+ 'close' => 'Close',
+ 'pleaseHold' => 'Please hold...',
+ 'actions' => 'Actions',
+ 'edit' => 'Edit',
+ 'delete' => 'Delete',
+ 'welcomeBack' => 'What\'s playing?',
+ 'everything' => 'Everything',
+ 'customRange' => 'Custom range',
+ 'apply' => 'Apply',
+ 'cancel' => 'Cancel',
+ 'from' => 'From',
+ 'to' => 'To',
+ 'showEverything' => 'Show everything',
+ 'never' => 'Never',
+ 'search_results_for' => 'Search results for ":query"',
+
+ // transaction index
+ 'title_expenses' => 'Expenses',
+ 'title_withdrawal' => 'Expenses',
+ 'title_revenue' => 'Revenue / income',
+ 'title_deposit' => 'Revenue / income',
+ 'title_transfer' => 'Transfers',
+ 'title_transfers' => 'Transfers',
+
+ // csv import:
+ 'csv_import' => 'Import CSV file',
+ 'csv' => 'CSV',
+ 'csv_index_title' => 'Upload and import a CSV file',
+ 'csv_define_column_roles' => 'Define column roles',
+ 'csv_map_values' => 'Map found values to existing values',
+ 'csv_download_config' => 'Download CSV configuration file.',
+ 'csv_index_text' =>
+ 'This form allows you to import a CSV file with transactions into Firefly. It is based on the excellent CSV importer made by' .
+ ' the folks at Atlassian. Simply upload your CSV file and follow the instructions.' .
+ ' If you would like to learn more, please click on the button at the top of this page.',
+ 'csv_index_beta_warning' => 'This tool is very much in beta. Please proceed with caution',
+ 'csv_header_help' => 'Check this box when your CSV file\'s first row consists of column names, not actual data',
+ 'csv_date_help' => 'Date time format in your CSV. Follow the format like this' .
+ ' page indicates. The default value will parse dates that look like this: ' . date('Ymd'),
+ 'csv_csv_file_help' => 'Select the CSV file here. You can only upload one file at a time',
+ 'csv_csv_config_file_help' => 'Select your CSV import configuration here. If you do not know what this is, ignore it. It will be explained later.',
+ 'csv_upload_button' => 'Start importing CSV',
+ 'csv_column_roles_title' => 'Define column roles',
+ 'csv_column_roles_text' =>
+ 'Firefly does not know what each column means. You need to indicate what every column is. Please check out the example '
+ . 'data if you\'re not sure yourself. Click on the question mark (top right of the page) to learn what'
+ . ' each column means. If you want to map imported data onto existing data in Firefly, use the checkbox. '
+ . 'The next step will show you what this button does.',
+ 'csv_column_roles_table' => 'Column roles',
+ 'csv_column' => 'CSV column',
+ 'cvs_column_name' => 'CSV column name',
+ 'cvs_column_example' => 'Column example data',
+ 'cvs_column_role' => 'Column contains?',
+ 'csv_do_map_value' => 'Map value?',
+ 'csv_continue' => 'Continue to the next step',
+ 'csv_go_back' => 'Go back to the previous step',
+ 'csv_map_title' => 'Map found values to existing values',
+ 'csv_map_text' =>
+ 'This page allows you to map the values from the CSV file to existing entries in your database. This ensures that accounts and other'
+ . ' things won\'t be created twice.',
+ 'cvs_field_value' => 'Field value from CSV',
+ 'csv_field_mapped_to' => 'Must be mapped to...',
+ 'csv_download_config_title' => 'Download CSV configuration',
+ 'csv_download_config_text' => 'Everything you\'ve just set up can be downloaded as a configuration file. Click the button to do so.',
+ 'csv_more_information_text' => 'If the import fails, you can use this configuration file so you don\'t have to start all over again.'
+ . ' But, if the import succeeds, it will be easier to upload similar CSV files.',
+ 'csv_do_download_config' => 'Download configuration file.',
+ 'csv_empty_description' => '(empty description)',
+ 'csv_upload_form' => 'CSV upload form',
+ 'csv_index_unsupported_warning' => 'The CSV importer is yet incapable of doing the following:',
+ 'csv_unsupported_map' => 'The importer cannot map the column ":columnRole" to existing values in the database.',
+ 'csv_unsupported_value' => 'The importer does not know how to handle values in columns marked as ":columnRole".',
+ 'csv_cannot_store_value' => 'The importer has not reserved space for columns marked ":columnRole" and will be incapable of processing them.',
+ 'csv_process_title' => 'CVS import finished!',
+ 'csv_process_text' => 'The CVS importer has finished and has processed :rows rows',
+ 'csv_row' => 'Row',
+ 'csv_import_with_errors' => 'There was one error.|There were :errors errors.',
+ 'csv_error_see_logs' => 'Check the log files to see details.',
+ 'csv_process_new_entries' => 'Firefly has created :imported new transaction(s).',
+ 'csv_start_over' => 'Import again',
+ 'csv_to_index' => 'Back home',
+ 'csv_do_not_map' => 'Do not map this value',
+ 'csv_upload_not_writeable' => 'Cannot write to the path mentioned here. Cannot upload',
+
+ 'csv_column__ignore' => '(ignore this column)',
+ 'csv_column_account-iban' => 'Asset account (IBAN)',
+ 'csv_column_account-id' => 'Asset account ID (matching Firefly)',
+ 'csv_column_account-name' => 'Asset account (name)',
+ 'csv_column_amount' => 'Amount',
+ 'csv_column_bill-id' => 'Bill ID (matching Firefly)',
+ 'csv_column_bill-name' => 'Bill name',
+ 'csv_column_budget-id' => 'Budget ID (matching Firefly)',
+ 'csv_column_budget-name' => 'Budget name',
+ 'csv_column_category-id' => 'Category ID (matching Firefly)',
+ 'csv_column_category-name' => 'Category name',
+ 'csv_column_currency-code' => 'Currency code (ISO 4217)',
+ 'csv_column_currency-id' => 'Currency ID (matching Firefly)',
+ 'csv_column_currency-name' => 'Currency name (matching Firefly)',
+ 'csv_column_currency-symbol' => 'Currency symbol (matching Firefly)',
+ 'csv_column_date-rent' => 'Rent calculation date',
+ 'csv_column_date-transaction' => 'Date',
+ 'csv_column_description' => 'Description',
+ 'csv_column_opposing-iban' => 'Opposing account (IBAN)',
+ 'csv_column_opposing-id' => 'Opposing account ID (matching Firefly)',
+ 'csv_column_opposing-name' => 'Opposing account (name)',
+ 'csv_column_rabo-debet-credit' => 'Rabobank specific debet/credit indicator',
+ 'csv_column_sepa-ct-id' => 'SEPA Credit Transfer end-to-end ID',
+ 'csv_column_sepa-ct-op' => 'SEPA Credit Transfer opposing account',
+ 'csv_column_sepa-db' => 'SEPA Direct Debet',
+ 'csv_column_tags-comma' => 'Tags (comma separated)',
+ 'csv_column_tags-space' => 'Tags (space separated)',
+ 'csv_specifix_RabobankDescription' => 'Select this when you\'re importing Rabobank CSV export files.',
+ 'csv_specifix_Dummy' => 'Checking this has no effect whatsoever.',
// create new stuff:
- 'create_new_withdrawal' => 'Create new withdrawal',
- 'create_new_deposit' => 'Create new deposit',
- 'create_new_transfer' => 'Create new transfer',
- 'create_new_asset' => 'Create new asset account',
- 'create_new_expense' => 'Create new expense account',
- 'create_new_revenue' => 'Create new revenue account',
- 'create_new_piggy_bank' => 'Create new piggy bank',
- 'create_new_bill' => 'Create new bill',
+ 'create_new_withdrawal' => 'Create new withdrawal',
+ 'create_new_deposit' => 'Create new deposit',
+ 'create_new_transfer' => 'Create new transfer',
+ 'create_new_asset' => 'Create new asset account',
+ 'create_new_expense' => 'Create new expense account',
+ 'create_new_revenue' => 'Create new revenue account',
+ 'create_new_piggy_bank' => 'Create new piggy bank',
+ 'create_new_bill' => 'Create new bill',
// currencies:
- 'create_currency' => 'Create a new currency',
- 'edit_currency' => 'Edit currency ":name"',
+ 'create_currency' => 'Create a new currency',
+ 'edit_currency' => 'Edit currency ":name"',
// new user:
- 'submit' => 'Submit',
- 'getting_started' => 'Getting started',
- 'to_get_started' => 'To get started with Firefly, please enter your current bank\'s name, and the balance of your checking account:',
- 'savings_balance_text' => 'If you have a savings account, please enter the current balance of your savings account:',
- 'cc_balance_text' => 'If you have a credit card, please enter your credit card\'s limit.',
+ 'submit' => 'Submit',
+ 'getting_started' => 'Getting started',
+ 'to_get_started' => 'To get started with Firefly, please enter your current bank\'s name, and the balance of your checking account:',
+ 'savings_balance_text' => 'If you have a savings account, please enter the current balance of your savings account:',
+ 'cc_balance_text' => 'If you have a credit card, please enter your credit card\'s limit.',
// forms:
- 'mandatoryFields' => 'Mandatory fields',
- 'optionalFields' => 'Optional fields',
- 'options' => 'Options',
- 'something' => 'Something!',
+ 'mandatoryFields' => 'Mandatory fields',
+ 'optionalFields' => 'Optional fields',
+ 'options' => 'Options',
+ 'something' => 'Something!',
// budgets:
- 'create_new_budget' => 'Create a new budget',
- 'store_new_budget' => ' Store new budget',
- 'availableIn' => 'Available in :date',
- 'transactionsWithoutBudget' => 'Expenses without budget',
- 'transactionsWithoutBudgetDate' => 'Expenses without budget in :date',
- 'createBudget' => 'New budget',
- 'inactiveBudgets' => 'Inactive budgets',
- 'without_budget_between' => 'Transactions without a budget between :start and :end',
- 'budget_in_month' => ':name in :month',
- 'delete_budget' => 'Delete budget ":name"',
- 'edit_budget' => 'Edit budget ":name"',
- 'update_amount' => 'Update amount',
+ 'create_new_budget' => 'Create a new budget',
+ 'store_new_budget' => ' Store new budget',
+ 'availableIn' => 'Available in :date',
+ 'transactionsWithoutBudget' => 'Expenses without budget',
+ 'transactionsWithoutBudgetDate' => 'Expenses without budget in :date',
+ 'createBudget' => 'New budget',
+ 'inactiveBudgets' => 'Inactive budgets',
+ 'without_budget_between' => 'Transactions without a budget between :start and :end',
+ 'budget_in_month' => ':name in :month',
+ 'delete_budget' => 'Delete budget ":name"',
+ 'edit_budget' => 'Edit budget ":name"',
+ 'update_amount' => 'Update amount',
// bills:
- 'delete_bill' => 'Delete bill ":name"',
- 'edit_bill' => 'Edit bill ":name"',
+ 'delete_bill' => 'Delete bill ":name"',
+ 'edit_bill' => 'Edit bill ":name"',
// accounts:
- 'details_for_asset' => 'Details for asset account ":name"',
- 'details_for_expense' => 'Details for expense account ":name"',
- 'details_for_revenue' => 'Details for revenue account ":name"',
- 'details_for_cash' => 'Details for cash account ":name"',
+ 'details_for_asset' => 'Details for asset account ":name"',
+ 'details_for_expense' => 'Details for expense account ":name"',
+ 'details_for_revenue' => 'Details for revenue account ":name"',
+ 'details_for_cash' => 'Details for cash account ":name"',
- 'store_new_asset_account' => 'Store new asset account',
- 'store_new_expense_account' => 'Store new expense account',
- 'store_new_revenue_account' => 'Store new revenue account',
+ 'store_new_asset_account' => 'Store new asset account',
+ 'store_new_expense_account' => 'Store new expense account',
+ 'store_new_revenue_account' => 'Store new revenue account',
- 'edit_asset_account' => 'Edit asset account ":name"',
- 'edit_expense_account' => 'Edit expense account ":name"',
- 'edit_revenue_account' => 'Edit revenue account ":name"',
+ 'edit_asset_account' => 'Edit asset account ":name"',
+ 'edit_expense_account' => 'Edit expense account ":name"',
+ 'edit_revenue_account' => 'Edit revenue account ":name"',
- 'delete_asset_account' => 'Delete asset account ":name"',
- 'delete_expense_account' => 'Delete expense account ":name"',
- 'delete_revenue_account' => 'Delete revenue account ":name"',
+ 'delete_asset_account' => 'Delete asset account ":name"',
+ 'delete_expense_account' => 'Delete expense account ":name"',
+ 'delete_revenue_account' => 'Delete revenue account ":name"',
- 'asset_deleted' => 'Successfully deleted asset account ":name"',
- 'expense_deleted' => 'Successfully deleted expense account ":name"',
- 'revenue_deleted' => 'Successfully deleted revenue account ":name"',
+ 'asset_deleted' => 'Successfully deleted asset account ":name"',
+ 'expense_deleted' => 'Successfully deleted expense account ":name"',
+ 'revenue_deleted' => 'Successfully deleted revenue account ":name"',
- 'update_asset_account' => 'Update asset account',
- 'update_expense_account' => 'Update expense account',
- 'update_revenue_account' => 'Update revenue account',
+ 'update_asset_account' => 'Update asset account',
+ 'update_expense_account' => 'Update expense account',
+ 'update_revenue_account' => 'Update revenue account',
- 'make_new_asset_account' => 'Create a new asset account',
- 'make_new_expense_account' => 'Create a new expense account',
- 'make_new_revenue_account' => 'Create a new revenue account',
+ 'make_new_asset_account' => 'Create a new asset account',
+ 'make_new_expense_account' => 'Create a new expense account',
+ 'make_new_revenue_account' => 'Create a new revenue account',
- 'asset_accounts' => 'Asset accounts',
- 'expense_accounts' => 'Expense accounts',
- 'revenue_accounts' => 'Revenue accounts',
+ 'asset_accounts' => 'Asset accounts',
+ 'expense_accounts' => 'Expense accounts',
+ 'revenue_accounts' => 'Revenue accounts',
- 'accountExtraHelp_asset' => '',
- 'accountExtraHelp_expense' => '',
- 'accountExtraHelp_revenue' => '',
- 'account_type' => 'Account type',
+ 'accountExtraHelp_asset' => '',
+ 'accountExtraHelp_expense' => '',
+ 'accountExtraHelp_revenue' => '',
+ 'account_type' => 'Account type',
// categories:
- 'new_category' => 'New category',
- 'create_new_category' => 'Create a new category',
- 'without_category' => 'Without a category',
- 'update_category' => 'Wijzig categorie',
- 'categories' => 'Categories',
- 'edit_category' => 'Edit category ":name"',
- 'no_category' => '(no category)',
- 'category' => 'Category',
- 'delete_category' => 'Delete category ":name"',
+ 'new_category' => 'New category',
+ 'create_new_category' => 'Create a new category',
+ 'without_category' => 'Without a category',
+ 'update_category' => 'Wijzig categorie',
+ 'categories' => 'Categories',
+ 'edit_category' => 'Edit category ":name"',
+ 'no_category' => '(no category)',
+ 'category' => 'Category',
+ 'delete_category' => 'Delete category ":name"',
// transactions:
- 'update_withdrawal' => 'Update withdrawal',
- 'update_deposit' => 'Update deposit',
- 'update_transfer' => 'Update transfer',
- 'delete_withdrawal' => 'Delete withdrawal ":description"',
- 'delete_deposit' => 'Delete deposit ":description"',
- 'delete_transfer' => 'Delete transfer ":description"',
+ 'update_withdrawal' => 'Update withdrawal',
+ 'update_deposit' => 'Update deposit',
+ 'update_transfer' => 'Update transfer',
+ 'delete_withdrawal' => 'Delete withdrawal ":description"',
+ 'delete_deposit' => 'Delete deposit ":description"',
+ 'delete_transfer' => 'Delete transfer ":description"',
// new user:
- 'welcome' => 'Welcome to Firefly!',
- 'createNewAsset' => 'Create a new asset account to get started. ' .
- 'This will allow you to create transactions and start your financial management',
- 'createNewAssetButton' => 'Create new asset account',
+ 'welcome' => 'Welcome to Firefly!',
+ 'createNewAsset' => 'Create a new asset account to get started. ' .
+ 'This will allow you to create transactions and start your financial management',
+ 'createNewAssetButton' => 'Create new asset account',
// home page:
- 'yourAccounts' => 'Your accounts',
- 'budgetsAndSpending' => 'Budgets and spending',
- 'savings' => 'Savings',
- 'markAsSavingsToContinue' => 'Mark your asset accounts as "Savings account" to fill this panel',
- 'createPiggyToContinue' => 'Create piggy banks to fill this panel.',
- 'newWithdrawal' => 'New expense',
- 'newDeposit' => 'New deposit',
- 'newTransfer' => 'New transfer',
- 'moneyIn' => 'Money in',
- 'moneyOut' => 'Money out',
- 'billsToPay' => 'Bills to pay',
- 'billsPaid' => 'Bills paid',
- 'viewDetails' => 'View details',
- 'divided' => 'divided',
- 'toDivide' => 'left to divide',
+ 'yourAccounts' => 'Your accounts',
+ 'budgetsAndSpending' => 'Budgets and spending',
+ 'savings' => 'Savings',
+ 'markAsSavingsToContinue' => 'Mark your asset accounts as "Savings account" to fill this panel',
+ 'createPiggyToContinue' => 'Create piggy banks to fill this panel.',
+ 'newWithdrawal' => 'New expense',
+ 'newDeposit' => 'New deposit',
+ 'newTransfer' => 'New transfer',
+ 'moneyIn' => 'Money in',
+ 'moneyOut' => 'Money out',
+ 'billsToPay' => 'Bills to pay',
+ 'billsPaid' => 'Bills paid',
+ 'viewDetails' => 'View details',
+ 'divided' => 'divided',
+ 'toDivide' => 'left to divide',
// menu and titles, should be recycled as often as possible:
- 'toggleNavigation' => 'Toggle navigation',
- 'currency' => 'Currency',
- 'preferences' => 'Preferences',
- 'logout' => 'Logout',
- 'searchPlaceholder' => 'Search...',
- 'dashboard' => 'Dashboard',
- 'currencies' => 'Currencies',
- 'accounts' => 'Accounts',
- 'Asset account' => 'Asset account',
- 'Default account' => 'Asset account',
- 'Expense account' => 'Expense account',
- 'Revenue account' => 'Revenue account',
- 'budgets' => 'Budgets',
- 'tags' => 'Tags',
- 'reports' => 'Reports',
- 'transactions' => 'Transactions',
- 'expenses' => 'Expenses',
- 'income' => 'Revenue / income',
- 'transfers' => 'Transfers',
- 'moneyManagement' => 'Money management',
- 'piggyBanks' => 'Piggy banks',
- 'bills' => 'Bills',
- 'createNew' => 'Create new',
- 'withdrawal' => 'Withdrawal',
- 'deposit' => 'Deposit',
- 'account' => 'Account',
- 'transfer' => 'Transfer',
- 'Withdrawal' => 'Withdrawal',
- 'Deposit' => 'Deposit',
- 'Transfer' => 'Transfer',
- 'bill' => 'Bill',
- 'yes' => 'Yes',
- 'no' => 'No',
- 'amount' => 'Amount',
- 'newBalance' => 'New balance',
- 'overview' => 'Overview',
- 'saveOnAccount' => 'Save on account',
- 'unknown' => 'Unknown',
- 'daily' => 'Daily',
- 'weekly' => 'Weekly',
- 'monthly' => 'Monthly',
- 'quarterly' => 'Quarterly',
- 'half-year' => 'Every six months',
- 'yearly' => 'Yearly',
+ 'toggleNavigation' => 'Toggle navigation',
+ 'currency' => 'Currency',
+ 'preferences' => 'Preferences',
+ 'logout' => 'Logout',
+ 'searchPlaceholder' => 'Search...',
+ 'dashboard' => 'Dashboard',
+ 'currencies' => 'Currencies',
+ 'accounts' => 'Accounts',
+ 'Asset account' => 'Asset account',
+ 'Default account' => 'Asset account',
+ 'Expense account' => 'Expense account',
+ 'Revenue account' => 'Revenue account',
+ 'budgets' => 'Budgets',
+ 'tags' => 'Tags',
+ 'reports' => 'Reports',
+ 'transactions' => 'Transactions',
+ 'expenses' => 'Expenses',
+ 'income' => 'Revenue / income',
+ 'transfers' => 'Transfers',
+ 'moneyManagement' => 'Money management',
+ 'piggyBanks' => 'Piggy banks',
+ 'bills' => 'Bills',
+ 'createNew' => 'Create new',
+ 'withdrawal' => 'Withdrawal',
+ 'deposit' => 'Deposit',
+ 'account' => 'Account',
+ 'transfer' => 'Transfer',
+ 'Withdrawal' => 'Withdrawal',
+ 'Deposit' => 'Deposit',
+ 'Transfer' => 'Transfer',
+ 'bill' => 'Bill',
+ 'yes' => 'Yes',
+ 'no' => 'No',
+ 'amount' => 'Amount',
+ 'newBalance' => 'New balance',
+ 'overview' => 'Overview',
+ 'saveOnAccount' => 'Save on account',
+ 'unknown' => 'Unknown',
+ 'daily' => 'Daily',
+ 'weekly' => 'Weekly',
+ 'monthly' => 'Monthly',
+ 'quarterly' => 'Quarterly',
+ 'half-year' => 'Every six months',
+ 'yearly' => 'Yearly',
// reports:
- 'reportForYear' => 'Yearly report for :year',
- 'reportForYearShared' => 'Yearly report for :year (including shared accounts)',
- 'reportForMonth' => 'Montly report for :month',
- 'reportForMonthShared' => 'Montly report for :month (including shared accounts)',
- 'incomeVsExpenses' => 'Income vs. expenses',
- 'accountBalances' => 'Account balances',
- 'balanceStartOfYear' => 'Balance at start of year',
- 'balanceEndOfYear' => 'Balance at end of year',
- 'balanceStartOfMonth' => 'Balance at start of month',
- 'balanceEndOfMonth' => 'Balance at end of month',
- 'balanceStart' => 'Balance at start of period',
- 'balanceEnd' => 'Balance at end of period',
- 'reportsOwnAccounts' => 'Reports for your own accounts',
- 'reportsOwnAccountsAndShared' => 'Reports for your own accounts and shared accounts',
- 'splitByAccount' => 'Split by account',
- 'balancedByTransfersAndTags' => 'Balanced by transfers and tags',
- 'coveredWithTags' => 'Covered with tags',
- 'leftUnbalanced' => 'Left unbalanced',
- 'expectedBalance' => 'Expected balance',
- 'outsideOfBudgets' => 'Outside of budgets',
- 'leftInBudget' => 'Left in budget',
- 'sumOfSums' => 'Sum of sums',
- 'notCharged' => 'Not charged (yet)',
- 'inactive' => 'Inactive',
- 'difference' => 'Difference',
- 'in' => 'In',
- 'out' => 'Out',
- 'topX' => 'top :number',
- 'showTheRest' => 'Show everything',
- 'hideTheRest' => 'Show only the top :number',
+ 'reportForYear' => 'Yearly report for :year',
+ 'reportForYearShared' => 'Yearly report for :year (including shared accounts)',
+ 'reportForMonth' => 'Montly report for :month',
+ 'reportForMonthShared' => 'Montly report for :month (including shared accounts)',
+ 'incomeVsExpenses' => 'Income vs. expenses',
+ 'accountBalances' => 'Account balances',
+ 'balanceStartOfYear' => 'Balance at start of year',
+ 'balanceEndOfYear' => 'Balance at end of year',
+ 'balanceStartOfMonth' => 'Balance at start of month',
+ 'balanceEndOfMonth' => 'Balance at end of month',
+ 'balanceStart' => 'Balance at start of period',
+ 'balanceEnd' => 'Balance at end of period',
+ 'reportsOwnAccounts' => 'Reports for your own accounts',
+ 'reportsOwnAccountsAndShared' => 'Reports for your own accounts and shared accounts',
+ 'splitByAccount' => 'Split by account',
+ 'balancedByTransfersAndTags' => 'Balanced by transfers and tags',
+ 'coveredWithTags' => 'Covered with tags',
+ 'leftUnbalanced' => 'Left unbalanced',
+ 'expectedBalance' => 'Expected balance',
+ 'outsideOfBudgets' => 'Outside of budgets',
+ 'leftInBudget' => 'Left in budget',
+ 'sumOfSums' => 'Sum of sums',
+ 'notCharged' => 'Not charged (yet)',
+ 'inactive' => 'Inactive',
+ 'difference' => 'Difference',
+ 'in' => 'In',
+ 'out' => 'Out',
+ 'topX' => 'top :number',
+ 'showTheRest' => 'Show everything',
+ 'hideTheRest' => 'Show only the top :number',
// charts:
- 'dayOfMonth' => 'Day of the month',
- 'month' => 'Month',
- 'budget' => 'Budget',
- 'spent' => 'Spent',
- 'overspent' => 'Overspent',
- 'left' => 'Left',
- 'noBudget' => '(no budget)',
- 'maxAmount' => 'Maximum amount',
- 'minAmount' => 'Minumum amount',
- 'billEntry' => 'Current bill entry',
- 'name' => 'Name',
- 'date' => 'Date',
- 'paid' => 'Paid',
- 'unpaid' => 'Unpaid',
- 'day' => 'Day',
- 'budgeted' => 'Budgeted',
- 'period' => 'Period',
- 'balance' => 'Balance',
- 'summary' => 'Summary',
- 'sum' => 'Sum',
- 'average' => 'Average',
- 'balanceFor' => 'Balance for :name',
+ 'dayOfMonth' => 'Day of the month',
+ 'month' => 'Month',
+ 'budget' => 'Budget',
+ 'spent' => 'Spent',
+ 'overspent' => 'Overspent',
+ 'left' => 'Left',
+ 'noBudget' => '(no budget)',
+ 'maxAmount' => 'Maximum amount',
+ 'minAmount' => 'Minumum amount',
+ 'billEntry' => 'Current bill entry',
+ 'name' => 'Name',
+ 'date' => 'Date',
+ 'paid' => 'Paid',
+ 'unpaid' => 'Unpaid',
+ 'day' => 'Day',
+ 'budgeted' => 'Budgeted',
+ 'period' => 'Period',
+ 'balance' => 'Balance',
+ 'summary' => 'Summary',
+ 'sum' => 'Sum',
+ 'average' => 'Average',
+ 'balanceFor' => 'Balance for :name',
// piggy banks:
- 'piggy_bank' => 'Piggy bank',
- 'new_piggy_bank' => 'Create new piggy bank',
- 'create_new_piggybank' => 'Create new piggy bank',
- 'account_status' => 'Account status',
- 'left_for_piggy_banks' => 'Left for piggy banks',
- 'sum_of_piggy_banks' => 'Sum of piggy banks',
- 'saved_so_far' => 'Saved so far',
- 'left_to_save' => 'Left to save',
- 'add_money_to_piggy_title' => 'Add money to piggy bank ":name"',
- 'remove_money_from_piggy_title' => 'Remove money from piggy bank ":name"',
- 'add' => 'Add',
- 'remove' => 'Remove',
- 'max_amount_add' => 'The maximum amount you can add is',
- 'max_amount_remove' => 'The maximum amount you can remove is',
- 'update_piggy_button' => 'Update piggy bank',
- 'update_piggy_title' => 'Update piggy bank ":name"',
- 'details' => 'Details',
- 'events' => 'Events',
- 'target_amount' => 'Target amount',
- 'start_date' => 'Start date',
- 'target_date' => 'Target date',
- 'no_target_date' => 'No target date',
- 'todo' => 'to do',
- 'table' => 'Table',
- 'piggy_bank_not_exists' => 'Piggy bank no longer exists.',
- 'add_any_amount_to_piggy' => 'Add money to this piggy bank to reach your target of :amount.',
- 'add_set_amount_to_piggy' => 'Add :amount to fill this piggy bank on :date',
- 'delete_piggy_bank' => 'Delete piggy bank ":name"',
+ 'piggy_bank' => 'Piggy bank',
+ 'new_piggy_bank' => 'Create new piggy bank',
+ 'create_new_piggybank' => 'Create new piggy bank',
+ 'account_status' => 'Account status',
+ 'left_for_piggy_banks' => 'Left for piggy banks',
+ 'sum_of_piggy_banks' => 'Sum of piggy banks',
+ 'saved_so_far' => 'Saved so far',
+ 'left_to_save' => 'Left to save',
+ 'add_money_to_piggy_title' => 'Add money to piggy bank ":name"',
+ 'remove_money_from_piggy_title' => 'Remove money from piggy bank ":name"',
+ 'add' => 'Add',
+ 'remove' => 'Remove',
+ 'max_amount_add' => 'The maximum amount you can add is',
+ 'max_amount_remove' => 'The maximum amount you can remove is',
+ 'update_piggy_button' => 'Update piggy bank',
+ 'update_piggy_title' => 'Update piggy bank ":name"',
+ 'details' => 'Details',
+ 'events' => 'Events',
+ 'target_amount' => 'Target amount',
+ 'start_date' => 'Start date',
+ 'target_date' => 'Target date',
+ 'no_target_date' => 'No target date',
+ 'todo' => 'to do',
+ 'table' => 'Table',
+ 'piggy_bank_not_exists' => 'Piggy bank no longer exists.',
+ 'add_any_amount_to_piggy' => 'Add money to this piggy bank to reach your target of :amount.',
+ 'add_set_amount_to_piggy' => 'Add :amount to fill this piggy bank on :date',
+ 'delete_piggy_bank' => 'Delete piggy bank ":name"',
// tags
- 'delete_tag' => 'Delete tag ":name"',
- 'new_tag' => 'Make new tag',
- 'edit_tag' => 'Edit tag ":tag"',
- 'no_year' => 'No year set',
- 'no_month' => 'No month set',
- 'tag_title_nothing' => 'Default tags',
- 'tag_title_balancingAct' => 'Balancing act tags',
- 'tag_title_advancePayment' => 'Advance payment tags',
+ 'delete_tag' => 'Delete tag ":name"',
+ 'new_tag' => 'Make new tag',
+ 'edit_tag' => 'Edit tag ":tag"',
+ 'no_year' => 'No year set',
+ 'no_month' => 'No month set',
+ 'tag_title_nothing' => 'Default tags',
+ 'tag_title_balancingAct' => 'Balancing act tags',
+ 'tag_title_advancePayment' => 'Advance payment tags',
];
diff --git a/resources/lang/en/form.php b/resources/lang/en/form.php
index 4fbb9a44f3..9172e7520c 100644
--- a/resources/lang/en/form.php
+++ b/resources/lang/en/form.php
@@ -45,6 +45,12 @@ return [
'under' => 'Under',
'symbol' => 'Symbol',
'code' => 'Code',
+ 'iban' => 'IBAN',
+ 'csv' => 'CSV file',
+ 'has_headers' => 'Headers',
+ 'date_format' => 'Date format',
+ 'csv_config' => 'CSV import configuration',
+ 'specifix' => 'Bank- or file specific fixes',
'store_new_withdrawal' => 'Store new withdrawal',
'store_new_deposit' => 'Store new deposit',
diff --git a/resources/lang/en/help.php b/resources/lang/en/help.php
index e46f28061e..e8949bff78 100644
--- a/resources/lang/en/help.php
+++ b/resources/lang/en/help.php
@@ -28,6 +28,7 @@ return [
'categories-delete' => 'categories.delete',
'categories-show' => 'categories.show',
'categories-noCategory' => 'categories.noCategory',
+ 'csv-index' => 'Upload and import a CSV file',
'currency-index' => 'currency.index',
'currency-create' => 'currency.create',
'currency-edit' => 'currency.edit',
diff --git a/resources/lang/en/list.php b/resources/lang/en/list.php
index 4ad2805ede..d2c541c490 100644
--- a/resources/lang/en/list.php
+++ b/resources/lang/en/list.php
@@ -29,4 +29,5 @@ return [
'transfer' => 'Transfer',
'type' => 'Type',
'completed' => 'Completed',
+ 'iban' => 'IBAN',
];
diff --git a/resources/lang/nl/firefly.php b/resources/lang/nl/firefly.php
index bdab21f817..c60a0aa951 100644
--- a/resources/lang/nl/firefly.php
+++ b/resources/lang/nl/firefly.php
@@ -2,298 +2,391 @@
return [
// general stuff:
- 'test' => 'Nederlands geselecteerd!',
- 'close' => 'Sluiten',
- 'pleaseHold' => 'Momentje...',
- 'actions' => 'Acties',
- 'edit' => 'Wijzig',
- 'delete' => 'Verwijder',
- 'welcomeBack' => 'Hoe staat het er voor?',
- 'everything' => 'Alles',
- 'customRange' => 'Zelf bereik kiezen',
- 'apply' => 'Go',
- 'cancel' => 'Annuleren',
- 'from' => 'Van',
- 'to' => 'Tot',
- 'showEverything' => 'Laat alles zien',
- 'never' => 'Nooit',
- 'search_results_for' => 'Zoekresultaten voor ":query"',
+ 'test' => 'Nederlands geselecteerd!',
+ 'close' => 'Sluiten',
+ 'pleaseHold' => 'Momentje...',
+ 'actions' => 'Acties',
+ 'edit' => 'Wijzig',
+ 'delete' => 'Verwijder',
+ 'welcomeBack' => 'Hoe staat het er voor?',
+ 'everything' => 'Alles',
+ 'customRange' => 'Zelf bereik kiezen',
+ 'apply' => 'Go',
+ 'cancel' => 'Annuleren',
+ 'from' => 'Van',
+ 'to' => 'Tot',
+ 'showEverything' => 'Laat alles zien',
+ 'never' => 'Nooit',
+ 'search_results_for' => 'Zoekresultaten voor ":query"',
+ // transaction index
+ 'title_expenses' => 'Uitgaven',
+ 'title_withdrawal' => 'Uitgaven',
+ 'title_revenue' => 'Inkomsten',
+ 'title_deposit' => 'Inkomsten',
+ 'title_transfer' => 'Overboekingen',
+ 'title_transfers' => 'Overboekingen',
+
+ // csv import:
+ 'csv_import' => 'Importeer CSV-bestand',
+ 'csv' => 'CSV',
+ 'csv_index_title' => 'Upload en importeer een kommagescheiden tekstbestand',
+ 'csv_index_text' => 'Met deze (en de komende) pagina\'s kan je kommagescheiden tekstbestanden importeren. Deze tool is gebaseerd '
+ . 'op de prachtige tool van Atlassian. Om te beginnen selecteer' .
+ ' je jouw tekstbestand bij "CSV-bestand". '
+ . 'Als je hulp nodig hebt, klik dan op het -icoontje rechtsboven.',
+ 'csv_index_beta_warning' => 'Deze tool is nog erg experimenteel. Wees dus voorzichtig.',
+ 'csv_header_help' => 'Zet hier een vinkje als de eerste rij van je tekstbestand bestaat uit kolomnamen, en niet uit daadwerkelijke gegevens.',
+ 'csv_date_help' => 'Het gebruikte datumformaat in jouw bestand. Gebruik het formaat zoals deze' .
+ ' pagina het uitlegt (Engels). Het standaardformaat kan omgaan met data zoals deze: ' . date('Ymd'),
+ 'csv_csv_file_help' => 'Voer hier je kommagescheiden tekstbestand in. Je kan er maar één tegelijkertijd invoeren.',
+ 'csv_csv_config_file_help' => 'Voer hier je configuratiebestand in. Als je deze niet hebt, geen zorgen. Latere stappen leggen dit uit.',
+ 'csv_upload_button' => 'Begin de import',
+ 'csv_define_column_roles' => 'Bepaal kolominhoud',
+ 'csv_column_roles_title' => 'Bepaal de inhoud van elke kolom',
+ 'csv_column_roles_text' => 'Firefly kan niet automatisch ontdekken wat elke kolom betekent. Je moet het zelf aangeven. Gebruik de' .
+ ' voorbeeldgegevens als je het ook niet zeker weet. Klik op het -icoontje ' .
+ 'rechtsboven om te ontdekken wat elke kolomsoort precies is. Als de kolominhoud een directe relatie heeft met gegevens'
+ .
+ ' die al in Firefly staan, gebruik dan het vinkje. Tijdens de volgende stap komt Firefly hier dan op terug.',
+ 'csv_column' => 'CSV-kolom',
+ 'cvs_column_name' => 'CSV-kolomnaam',
+ 'cvs_column_example' => 'Voorbeeldgegevens',
+ 'cvs_column_role' => 'Kolom bevat?',
+ 'csv_do_map_value' => 'Directe relatie?',
+ 'csv_column__ignore' => '(negeer deze kolom)',
+ 'csv_column_account-iban' => 'Betaalrekening (IBAN)',
+ 'csv_column_account-id' => 'Betaalrekening (ID gelijk aan Firefly)',
+ 'csv_column_account-name' => 'Betaalrekeningnaam',
+ 'csv_column_amount' => 'Bedrag',
+ 'csv_column_bill-id' => 'Contract (ID gelijk aan Firefly)',
+ 'csv_column_bill-name' => 'Contractnaam',
+ 'csv_column_budget-id' => 'Budget (ID gelijk aan Firefly)',
+ 'csv_column_budget-name' => 'Budgetnaam',
+ 'csv_column_category-id' => 'Categorie (ID gelijk aan Firefly)',
+ 'csv_column_category-name' => 'Categorienaam',
+ 'csv_column_currency-code' => 'Valutacode (ISO 4217)',
+ 'csv_column_currency-id' => 'Valuta (ID gelijk aan Firefly)',
+ 'csv_column_currency-name' => 'Valutanaam',
+ 'csv_column_currency-symbol' => 'Valuta',
+ 'csv_column_date-rent' => 'Datum (renteberekening)',
+ 'csv_column_date-transaction' => 'Datum (transactie)',
+ 'csv_column_description' => 'Beschrijving',
+ 'csv_column_opposing-iban' => 'Tegenrekening (IBAN)',
+ 'csv_column_opposing-id' => 'Tegenrekening (ID gelijk aan Firefly)',
+ 'csv_column_opposing-name' => 'Tegenrekeningnaam',
+ 'csv_column_rabo-debet-credit' => 'Rabobankspecifiek bij/af indicator',
+ 'csv_column_sepa-ct-id' => 'SEPA transactienummer',
+ 'csv_column_sepa-ct-op' => 'SEPA tegenrekeningnummer',
+ 'csv_column_sepa-db' => 'SEPA "direct debet"-nummer',
+ 'csv_column_tags-comma' => 'Tags (kommagescheiden)',
+ 'csv_column_tags-space' => 'Tags (spatiegescheiden)',
+ 'csv_column_roles_table' => 'Kolominhoud',
+ 'csv_continue' => 'Naar de volgende stap',
+ 'csv_go_back' => 'Terug naar de vorige stap',
+ 'csv_map_values' => 'Leg relaties met kolomwaardes',
+ 'csv_map_title' => 'Leg relaties met kolomwaardes',
+ 'csv_map_text' => 'Sommige kolommen bevatten waardes die misschien al in Firefly bestaan. Selecteer hier de juiste combinaties' .
+ 'zodat het importeren netjes aansluit bij je huidige gegevens.',
+ 'cvs_field_value' => 'Veldwaarde',
+ 'csv_field_mapped_to' => 'Is gelijk aan',
+ 'csv_do_not_map' => 'Geen relatie',
+ 'csv_download_config_title' => 'Download importconfiguratie',
+ 'csv_download_config_text' =>
+ 'Firefly is klaar om je bestand te importeren. De instellingen en selecties die je zojuist hebt gemaakt kan je downloaden'
+ . ' en opslaan. Bij de volgende keer kan je dit bestand ook uploaden. Als je kommagescheiden bestand dezelfde indeling'
+ . ' heeft, zullen alle selecties goed staan. Dat scheelt weer!',
+ 'csv_more_information_text' =>
+ 'Ook als het importeren fout gaat is dit bestand handig. Na het importeren krijg je nogmaals de gelegenheid dit bestand'
+ . 'te downloaden.',
+ 'csv_do_download_config' => 'Download het configuratiebestand',
+ 'csv_process_title' => 'Het importeren is klaar',
+ 'csv_row' => 'Rij',
+ 'csv_error_see_logs' => 'De logboeken bevatten mogelijk meer details.',
+ 'csv_process_new_entries' => 'Firefly heeft :imported nieuwe transactie(s) gemaakt.',
+ 'csv_start_over' => 'Begin opnieuw',
+ 'csv_to_index' => 'Naar de index',
+ 'csv_process_text' => ':rows rijen zijn verwerkt.',
+ 'csv_import_with_errors' => 'Er was één fout. Deze foutmelding is mogelijk in het Engels.|Er zijn :errors fouten opgetreden. De foutmeldingen'
+ . ' zijn mogelijk in het Engels.',
+ 'csv_specifix_RabobankDescription' => 'Vink dit aan als je Rabobank bestanden importeert.',
+ 'csv_specifix_Dummy' => 'Dit vinkje doet niks (dummy).',
// create new stuff:
- 'create_new_withdrawal' => 'Nieuwe uitgave',
- 'create_new_deposit' => 'Nieuwe inkomsten',
- 'create_new_transfer' => 'Nieuwe overschrijving',
- 'create_new_asset' => 'Nieuwe betaalrekening',
- 'create_new_expense' => 'Nieuwe crediteur',
- 'create_new_revenue' => 'Nieuwe debiteur',
- 'create_new_piggy_bank' => 'Nieuw spaarpotje',
- 'create_new_bill' => 'Nieuw contract',
+ 'create_new_withdrawal' => 'Nieuwe uitgave',
+ 'create_new_deposit' => 'Nieuwe inkomsten',
+ 'create_new_transfer' => 'Nieuwe overschrijving',
+ 'create_new_asset' => 'Nieuwe betaalrekening',
+ 'create_new_expense' => 'Nieuwe crediteur',
+ 'create_new_revenue' => 'Nieuwe debiteur',
+ 'create_new_piggy_bank' => 'Nieuw spaarpotje',
+ 'create_new_bill' => 'Nieuw contract',
// currencies:
- 'create_currency' => 'Maak nieuwe munteenheid',
- 'edit_currency' => 'Wijzig munteenheid ":name"',
+ 'create_currency' => 'Maak nieuwe munteenheid',
+ 'edit_currency' => 'Wijzig munteenheid ":name"',
// new user:
- 'submit' => 'Invoeren',
- 'getting_started' => 'Aan de start!',
- 'to_get_started' => 'Begin met de naam van de bank waar je je betaalrekening hebt, en het saldo van die rekening.',
- 'savings_balance_text' => 'Voer ook het saldo van je spaarrekening in, als je die hebt.',
- 'cc_balance_text' => 'Als je een credit card hebt, vul dan hier je credit cardlimiet in.',
+ 'submit' => 'Invoeren',
+ 'getting_started' => 'Aan de start!',
+ 'to_get_started' => 'Begin met de naam van de bank waar je je betaalrekening hebt, en het saldo van die rekening.',
+ 'savings_balance_text' => 'Voer ook het saldo van je spaarrekening in, als je die hebt.',
+ 'cc_balance_text' => 'Als je een credit card hebt, vul dan hier je credit cardlimiet in.',
// forms:
- 'mandatoryFields' => 'Verplichte velden',
- 'optionalFields' => 'Optionele velden',
- 'options' => 'Opties',
- 'something' => 'Iets!',
+ 'mandatoryFields' => 'Verplichte velden',
+ 'optionalFields' => 'Optionele velden',
+ 'options' => 'Opties',
+ 'something' => 'Iets!',
// budgets:
- 'create_new_budget' => 'Maak een nieuw budget',
- 'store_new_budget' => 'Sla nieuw budget op',
- 'availableIn' => 'Beschikbaar in :date',
- 'transactionsWithoutBudget' => 'Uitgaven zonder budget',
- 'transactionsWithoutBudgetDate' => 'Uitgaven zonder budget in :date',
- 'createBudget' => 'Maak nieuw budget',
- 'inactiveBudgets' => 'Inactieve budgetten',
- 'without_budget_between' => 'Transacties zonder budget tussen :start en :end',
- 'budget_in_month' => ':name in :month',
- 'delete_budget' => 'Verwijder budget ":name"',
- 'edit_budget' => 'Wijzig budget ":name"',
- 'update_amount' => 'Bedrag bijwerken',
+ 'create_new_budget' => 'Maak een nieuw budget',
+ 'store_new_budget' => 'Sla nieuw budget op',
+ 'availableIn' => 'Beschikbaar in :date',
+ 'transactionsWithoutBudget' => 'Uitgaven zonder budget',
+ 'transactionsWithoutBudgetDate' => 'Uitgaven zonder budget in :date',
+ 'createBudget' => 'Maak nieuw budget',
+ 'inactiveBudgets' => 'Inactieve budgetten',
+ 'without_budget_between' => 'Transacties zonder budget tussen :start en :end',
+ 'budget_in_month' => ':name in :month',
+ 'delete_budget' => 'Verwijder budget ":name"',
+ 'edit_budget' => 'Wijzig budget ":name"',
+ 'update_amount' => 'Bedrag bijwerken',
// bills:
- 'delete_bill' => 'Verwijder contract ":name"',
- 'edit_bill' => 'Wijzig contract ":name"',
+ 'delete_bill' => 'Verwijder contract ":name"',
+ 'edit_bill' => 'Wijzig contract ":name"',
// accounts:
- 'details_for_asset' => 'Overzicht voor betaalrekening ":name"',
- 'details_for_expense' => 'Overzicht voor crediteur ":name"',
- 'details_for_revenue' => 'Overzicht voor debiteur ":name"',
- 'details_for_cash' => 'Overzicht voor contant geldrekening ":name"',
+ 'details_for_asset' => 'Overzicht voor betaalrekening ":name"',
+ 'details_for_expense' => 'Overzicht voor crediteur ":name"',
+ 'details_for_revenue' => 'Overzicht voor debiteur ":name"',
+ 'details_for_cash' => 'Overzicht voor contant geldrekening ":name"',
- 'store_new_asset_account' => 'Sla nieuwe betaalrekening op',
- 'store_new_expense_account' => 'Sla nieuwe crediteur op',
- 'store_new_revenue_account' => 'Sla nieuwe debiteur op',
+ 'store_new_asset_account' => 'Sla nieuwe betaalrekening op',
+ 'store_new_expense_account' => 'Sla nieuwe crediteur op',
+ 'store_new_revenue_account' => 'Sla nieuwe debiteur op',
- 'edit_asset_account' => 'Wijzig betaalrekening ":name"',
- 'edit_expense_account' => 'Wijzig crediteur ":name"',
- 'edit_revenue_account' => 'Wijzig debiteur ":name"',
+ 'edit_asset_account' => 'Wijzig betaalrekening ":name"',
+ 'edit_expense_account' => 'Wijzig crediteur ":name"',
+ 'edit_revenue_account' => 'Wijzig debiteur ":name"',
- 'delete_asset_account' => 'Verwijder betaalrekening ":name"',
- 'delete_expense_account' => 'Verwijder crediteur ":name"',
- 'delete_revenue_account' => 'Verwijder debiteur ":name"',
+ 'delete_asset_account' => 'Verwijder betaalrekening ":name"',
+ 'delete_expense_account' => 'Verwijder crediteur ":name"',
+ 'delete_revenue_account' => 'Verwijder debiteur ":name"',
- 'asset_deleted' => 'Betaalrekening ":name" is verwijderd.',
- 'expense_deleted' => 'Crediteur ":name" is verwijderd.',
- 'revenue_deleted' => 'Debiteur ":name" is verwijderd.',
+ 'asset_deleted' => 'Betaalrekening ":name" is verwijderd.',
+ 'expense_deleted' => 'Crediteur ":name" is verwijderd.',
+ 'revenue_deleted' => 'Debiteur ":name" is verwijderd.',
- 'update_asset_account' => 'Wijzig betaalrekening',
- 'update_expense_account' => 'Wijzig crediteur',
- 'update_revenue_account' => 'Wijzig debiteur',
+ 'update_asset_account' => 'Wijzig betaalrekening',
+ 'update_expense_account' => 'Wijzig crediteur',
+ 'update_revenue_account' => 'Wijzig debiteur',
- 'make_new_asset_account' => 'Nieuwe betaalrekening',
- 'make_new_expense_account' => 'Nieuwe crediteur',
- 'make_new_revenue_account' => 'Nieuwe debiteur',
+ 'make_new_asset_account' => 'Nieuwe betaalrekening',
+ 'make_new_expense_account' => 'Nieuwe crediteur',
+ 'make_new_revenue_account' => 'Nieuwe debiteur',
- 'asset_accounts' => 'Betaalrekeningen',
- 'expense_accounts' => 'Crediteuren',
- 'revenue_accounts' => 'Debiteuren',
- 'account_type' => 'Account type',
+ 'asset_accounts' => 'Betaalrekeningen',
+ 'expense_accounts' => 'Crediteuren',
+ 'revenue_accounts' => 'Debiteuren',
+ 'account_type' => 'Account type',
// some extra help:
- 'accountExtraHelp_asset' => '',
- 'accountExtraHelp_expense' =>
+ 'accountExtraHelp_asset' => '',
+ 'accountExtraHelp_expense' =>
'Een crediteur is een persoon of een bedrijf waar je geld aan moet betalen. Je staat bij ze in het krijt. Een verwarrende' .
' term misschien, maar zo werkt het nou eenmaal. De supermarkt, je huurbaas of de bank zijn crediteuren. Jouw ' .
'geld (krediet) gaat naar hen toe. De term komt uit de wereld van de boekhouding. De uitgaves die je hier ziet zijn ' .
'positief, want je kijkt uit hun perspectief. Zodra jij afrekent in een winkel, komt het geld er bij hen bij (positief).',
- 'accountExtraHelp_revenue' => 'Als je geld krijgt van een bedrijf of een persoon is dat een debiteur. ' .
- 'Dat kan salaris zijn, of een andere betaling. ' .
- ' Ze hebben een schuld (debet) aan jou. De term komt uit de wereld van de boekhouding.' .
- ' De inkomsten die je hier ziet zijn negatief, want je kijkt uit hun perspectief. Zodra een debiteur geld naar jou ' .
- 'overmaakt gaat het er bij hen af (negatief).',
+ 'accountExtraHelp_revenue' => 'Als je geld krijgt van een bedrijf of een persoon is dat een debiteur. ' .
+ 'Dat kan salaris zijn, of een andere betaling. ' .
+ ' Ze hebben een schuld (debet) aan jou. De term komt uit de wereld van de boekhouding.' .
+ ' De inkomsten die je hier ziet zijn negatief, want je kijkt uit hun perspectief. Zodra een debiteur geld naar jou ' .
+ 'overmaakt gaat het er bij hen af (negatief).',
// categories:
- 'new_category' => 'Nieuwe categorie',
- 'create_new_category' => 'Nieuwe categorie',
- 'without_category' => 'Zonder categorie',
- 'update_category' => 'Wijzig categorie',
- 'edit_category' => 'Wijzig categorie ":name"',
- 'categories' => 'Categorieën',
- 'no_category' => '(geen categorie)',
- 'category' => 'Categorie',
- 'delete_category' => 'Verwijder categorie ":name"',
+ 'new_category' => 'Nieuwe categorie',
+ 'create_new_category' => 'Nieuwe categorie',
+ 'without_category' => 'Zonder categorie',
+ 'update_category' => 'Wijzig categorie',
+ 'edit_category' => 'Wijzig categorie ":name"',
+ 'categories' => 'Categorieën',
+ 'no_category' => '(geen categorie)',
+ 'category' => 'Categorie',
+ 'delete_category' => 'Verwijder categorie ":name"',
// transactions:
- 'update_withdrawal' => 'Wijzig uitgave',
- 'update_deposit' => 'Wijzig inkomsten',
- 'update_transfer' => 'Wijzig overschrijving',
- 'delete_withdrawal' => 'Verwijder uitgave ":description"',
- 'delete_deposit' => 'Verwijder inkomsten ":description"',
- 'delete_transfer' => 'Verwijder overschrijving ":description"',
+ 'update_withdrawal' => 'Wijzig uitgave',
+ 'update_deposit' => 'Wijzig inkomsten',
+ 'update_transfer' => 'Wijzig overschrijving',
+ 'delete_withdrawal' => 'Verwijder uitgave ":description"',
+ 'delete_deposit' => 'Verwijder inkomsten ":description"',
+ 'delete_transfer' => 'Verwijder overschrijving ":description"',
// new user:
- 'welcome' => 'Welkom bij Firefly!',
- 'createNewAsset' => 'Maak om te beginnen een nieuwe betaalrekening. Dit is je start van je financiële beheer.',
- 'createNewAssetButton' => 'Maak een nieuwe betaalrekening',
+ 'welcome' => 'Welkom bij Firefly!',
+ 'createNewAsset' => 'Maak om te beginnen een nieuwe betaalrekening. Dit is je start van je financiële beheer.',
+ 'createNewAssetButton' => 'Maak een nieuwe betaalrekening',
// home page:
- 'yourAccounts' => 'Je betaalrekeningen',
- 'budgetsAndSpending' => 'Budgetten en uitgaven',
- 'savings' => 'Sparen',
- 'markAsSavingsToContinue' => 'Om hier wat te zien stel je je betaalrekeningen in als "spaarrekening".',
- 'createPiggyToContinue' => 'Maak spaarpotjes om hier iets te zien.',
- 'newWithdrawal' => 'Nieuwe uitgave',
- 'newDeposit' => 'Nieuwe inkomsten',
- 'newTransfer' => 'Nieuwe overschrijving',
- 'moneyIn' => 'Inkomsten',
- 'moneyOut' => 'Uitgaven',
- 'billsToPay' => 'Openstaande contracten',
- 'billsPaid' => 'Betaalde contracten',
- 'viewDetails' => 'Meer info',
- 'divided' => 'verdeeld',
- 'toDivide' => 'te verdelen',
+ 'yourAccounts' => 'Je betaalrekeningen',
+ 'budgetsAndSpending' => 'Budgetten en uitgaven',
+ 'savings' => 'Sparen',
+ 'markAsSavingsToContinue' => 'Om hier wat te zien stel je je betaalrekeningen in als "spaarrekening".',
+ 'createPiggyToContinue' => 'Maak spaarpotjes om hier iets te zien.',
+ 'newWithdrawal' => 'Nieuwe uitgave',
+ 'newDeposit' => 'Nieuwe inkomsten',
+ 'newTransfer' => 'Nieuwe overschrijving',
+ 'moneyIn' => 'Inkomsten',
+ 'moneyOut' => 'Uitgaven',
+ 'billsToPay' => 'Openstaande contracten',
+ 'billsPaid' => 'Betaalde contracten',
+ 'viewDetails' => 'Meer info',
+ 'divided' => 'verdeeld',
+ 'toDivide' => 'te verdelen',
// menu and titles, should be recycled as often as possible:
- 'toggleNavigation' => 'Navigatie aan of uit',
- 'currency' => 'Munteenheden',
- 'preferences' => 'Voorkeuren',
- 'logout' => 'Uitloggen',
- 'searchPlaceholder' => 'Zoeken...',
- 'dashboard' => 'Dashboard',
- 'currencies' => 'Munteenheden',
- 'accounts' => 'Rekeningen',
- 'Asset account' => 'Betaalrekening',
- 'Default account' => 'Betaalrekening',
- 'Expense account' => 'Crediteur',
- 'Revenue account' => 'Debiteur',
- 'budgets' => 'Budgetten',
- 'tags' => 'Tags',
- 'reports' => 'Overzichten',
- 'transactions' => 'Transacties',
- 'expenses' => 'Uitgaven',
- 'income' => 'Inkomsten',
- 'transfers' => 'Overschrijvingen',
- 'moneyManagement' => 'Geldbeheer',
- 'piggyBanks' => 'Spaarpotjes',
- 'bills' => 'Contracten',
- 'createNew' => 'Nieuw',
- 'withdrawal' => 'Uitgave',
- 'deposit' => 'Inkomsten',
- 'account' => 'Rekening',
- 'transfer' => 'Overschrijving',
- 'Withdrawal' => 'Uitgave',
- 'Deposit' => 'Inkomsten',
- 'Transfer' => 'Overschrijving',
- 'bill' => 'Contract',
- 'yes' => 'Ja',
- 'no' => 'Nee',
- 'amount' => 'Bedrag',
- 'newBalance' => 'Nieuw saldo',
- 'overview' => 'Overzicht',
- 'saveOnAccount' => 'Sparen op rekening',
- 'unknown' => 'Onbekend',
- 'daily' => 'Dagelijks',
- 'weekly' => 'Wekelijks',
- 'monthly' => 'Maandelijks',
- 'quarterly' => 'Elk kwartaal',
- 'half-year' => 'Elk half jaar',
- 'yearly' => 'Jaarlijks',
+ 'toggleNavigation' => 'Navigatie aan of uit',
+ 'currency' => 'Munteenheden',
+ 'preferences' => 'Voorkeuren',
+ 'logout' => 'Uitloggen',
+ 'searchPlaceholder' => 'Zoeken...',
+ 'dashboard' => 'Dashboard',
+ 'currencies' => 'Munteenheden',
+ 'accounts' => 'Rekeningen',
+ 'Asset account' => 'Betaalrekening',
+ 'Default account' => 'Betaalrekening',
+ 'Expense account' => 'Crediteur',
+ 'Revenue account' => 'Debiteur',
+ 'budgets' => 'Budgetten',
+ 'tags' => 'Tags',
+ 'reports' => 'Overzichten',
+ 'transactions' => 'Transacties',
+ 'expenses' => 'Uitgaven',
+ 'income' => 'Inkomsten',
+ 'transfers' => 'Overschrijvingen',
+ 'moneyManagement' => 'Geldbeheer',
+ 'piggyBanks' => 'Spaarpotjes',
+ 'bills' => 'Contracten',
+ 'createNew' => 'Nieuw',
+ 'withdrawal' => 'Uitgave',
+ 'deposit' => 'Inkomsten',
+ 'account' => 'Rekening',
+ 'transfer' => 'Overschrijving',
+ 'Withdrawal' => 'Uitgave',
+ 'Deposit' => 'Inkomsten',
+ 'Transfer' => 'Overschrijving',
+ 'bill' => 'Contract',
+ 'yes' => 'Ja',
+ 'no' => 'Nee',
+ 'amount' => 'Bedrag',
+ 'newBalance' => 'Nieuw saldo',
+ 'overview' => 'Overzicht',
+ 'saveOnAccount' => 'Sparen op rekening',
+ 'unknown' => 'Onbekend',
+ 'daily' => 'Dagelijks',
+ 'weekly' => 'Wekelijks',
+ 'monthly' => 'Maandelijks',
+ 'quarterly' => 'Elk kwartaal',
+ 'half-year' => 'Elk half jaar',
+ 'yearly' => 'Jaarlijks',
// reports:
- 'reportForYear' => 'Jaaroverzicht :year',
- 'reportForYearShared' => 'Jaaroverzicht :year (inclusief gedeelde rekeningen)',
- 'reportForMonth' => 'Maandoverzicht van :date',
- 'reportForMonthShared' => 'Maandoverzicht van :date (inclusief gedeelde rekeningen)',
- 'incomeVsExpenses' => 'Inkomsten tegenover uitgaven',
- 'accountBalances' => 'Rekeningsaldi',
- 'balanceStartOfYear' => 'Saldo aan het begin van het jaar',
- 'balanceEndOfYear' => 'Saldo aan het einde van het jaar',
- 'balanceStartOfMonth' => 'Saldo aan het begin van de maand',
- 'balanceEndOfMonth' => 'Saldo aan het einde van de maand',
- 'balanceStart' => 'Saldo aan het begin van de periode',
- 'balanceEnd' => 'Saldo aan het einde van de periode',
- 'reportsOwnAccounts' => 'Overzichten voor je eigen betaalrekeningen',
- 'reportsOwnAccountsAndShared' => 'Overzichten voor je eigen betaalrekeningen en gedeelde rekeningen',
- 'splitByAccount' => 'Per betaalrekening',
- 'balancedByTransfersAndTags' => 'Gecorrigeerd met overschrijvingen en tags',
- 'coveredWithTags' => 'Gecorrigeerd met tags',
- 'leftUnbalanced' => 'Ongecorrigeerd',
- 'expectedBalance' => 'Verwacht saldo',
- 'outsideOfBudgets' => 'Buiten budgetten',
- 'leftInBudget' => 'Over van budget',
- 'sumOfSums' => 'Alles bij elkaar',
- 'notCharged' => '(Nog) niet betaald',
- 'inactive' => 'Niet actief',
- 'difference' => 'Verschil',
- 'in' => 'In',
- 'out' => 'Uit',
- 'topX' => 'top :number',
- 'showTheRest' => 'Laat alles zien',
- 'hideTheRest' => 'Laat alleen de top :number zien',
+ 'reportForYear' => 'Jaaroverzicht :year',
+ 'reportForYearShared' => 'Jaaroverzicht :year (inclusief gedeelde rekeningen)',
+ 'reportForMonth' => 'Maandoverzicht van :date',
+ 'reportForMonthShared' => 'Maandoverzicht van :date (inclusief gedeelde rekeningen)',
+ 'incomeVsExpenses' => 'Inkomsten tegenover uitgaven',
+ 'accountBalances' => 'Rekeningsaldi',
+ 'balanceStartOfYear' => 'Saldo aan het begin van het jaar',
+ 'balanceEndOfYear' => 'Saldo aan het einde van het jaar',
+ 'balanceStartOfMonth' => 'Saldo aan het begin van de maand',
+ 'balanceEndOfMonth' => 'Saldo aan het einde van de maand',
+ 'balanceStart' => 'Saldo aan het begin van de periode',
+ 'balanceEnd' => 'Saldo aan het einde van de periode',
+ 'reportsOwnAccounts' => 'Overzichten voor je eigen betaalrekeningen',
+ 'reportsOwnAccountsAndShared' => 'Overzichten voor je eigen betaalrekeningen en gedeelde rekeningen',
+ 'splitByAccount' => 'Per betaalrekening',
+ 'balancedByTransfersAndTags' => 'Gecorrigeerd met overschrijvingen en tags',
+ 'coveredWithTags' => 'Gecorrigeerd met tags',
+ 'leftUnbalanced' => 'Ongecorrigeerd',
+ 'expectedBalance' => 'Verwacht saldo',
+ 'outsideOfBudgets' => 'Buiten budgetten',
+ 'leftInBudget' => 'Over van budget',
+ 'sumOfSums' => 'Alles bij elkaar',
+ 'notCharged' => '(Nog) niet betaald',
+ 'inactive' => 'Niet actief',
+ 'difference' => 'Verschil',
+ 'in' => 'In',
+ 'out' => 'Uit',
+ 'topX' => 'top :number',
+ 'showTheRest' => 'Laat alles zien',
+ 'hideTheRest' => 'Laat alleen de top :number zien',
// charts:
- 'dayOfMonth' => 'Dag vd maand',
- 'month' => 'Maand',
- 'budget' => 'Budget',
- 'spent' => 'Uitgegeven',
- 'overspent' => 'Teveel uitgegeven',
- 'left' => 'Over',
- 'noBudget' => '(geen budget)',
- 'maxAmount' => 'Maximaal bedrag',
- 'minAmount' => 'Minimaal bedrag',
- 'billEntry' => 'Bedrag voor dit contract',
- 'name' => 'Naam',
- 'date' => 'Datum',
- 'paid' => 'Betaald',
- 'unpaid' => 'Niet betaald',
- 'day' => 'Dag',
- 'budgeted' => 'Gebudgetteerd',
- 'period' => 'Periode',
- 'balance' => 'Saldo',
- 'summary' => 'Samenvatting',
- 'sum' => 'Som',
- 'average' => 'Gemiddeld',
- 'balanceFor' => 'Saldo op :name',
+ 'dayOfMonth' => 'Dag vd maand',
+ 'month' => 'Maand',
+ 'budget' => 'Budget',
+ 'spent' => 'Uitgegeven',
+ 'overspent' => 'Teveel uitgegeven',
+ 'left' => 'Over',
+ 'noBudget' => '(geen budget)',
+ 'maxAmount' => 'Maximaal bedrag',
+ 'minAmount' => 'Minimaal bedrag',
+ 'billEntry' => 'Bedrag voor dit contract',
+ 'name' => 'Naam',
+ 'date' => 'Datum',
+ 'paid' => 'Betaald',
+ 'unpaid' => 'Niet betaald',
+ 'day' => 'Dag',
+ 'budgeted' => 'Gebudgetteerd',
+ 'period' => 'Periode',
+ 'balance' => 'Saldo',
+ 'summary' => 'Samenvatting',
+ 'sum' => 'Som',
+ 'average' => 'Gemiddeld',
+ 'balanceFor' => 'Saldo op :name',
// piggy banks:
- 'piggy_bank' => 'Spaarpotje',
- 'new_piggy_bank' => 'Nieuw spaarpotje',
- 'create_new_piggybank' => 'Nieuw spaarpotje',
- 'account_status' => 'Rekeningoverzicht',
- 'left_for_piggy_banks' => 'Over voor spaarpotjes',
- 'sum_of_piggy_banks' => 'Som van spaarpotjes',
- 'saved_so_far' => 'Gespaard',
- 'left_to_save' => 'Te sparen',
- 'add_money_to_piggy_title' => 'Stop geld in spaarpotje ":name"',
- 'remove_money_from_piggy_title' => 'Haal geld uit spaarpotje ":name"',
- 'add' => 'Toevoegen',
- 'remove' => 'Verwijderen',
- 'max_amount_add' => 'Hooguit toe te voegen',
- 'max_amount_remove' => 'Hooguit te verwijderen',
- 'update_piggy_button' => 'Wijzig spaarpotje',
- 'update_piggy_title' => 'Wijzig spaarpotje ":name"',
- 'details' => 'Details',
- 'events' => 'Gebeurtenissen',
- 'target_amount' => 'Doelbedrag',
- 'start_date' => 'Startdatum',
- 'target_date' => 'Doeldatum',
- 'no_target_date' => 'Geen doeldatum',
- 'todo' => 'te doen',
- 'table' => 'Tabel',
- 'piggy_bank_not_exists' => 'Dit spaarpotje bestaat niet meer.',
- 'add_any_amount_to_piggy' => 'Stop geld in dit spaarpotje om het doel van :amount te halen.',
- 'add_set_amount_to_piggy' => 'Stop voor :date :amount in dit spaarpotje om hem op tijd te vullen.',
- 'delete_piggy_bank' => 'Verwijder spaarpotje ":name"',
+ 'piggy_bank' => 'Spaarpotje',
+ 'new_piggy_bank' => 'Nieuw spaarpotje',
+ 'create_new_piggybank' => 'Nieuw spaarpotje',
+ 'account_status' => 'Rekeningoverzicht',
+ 'left_for_piggy_banks' => 'Over voor spaarpotjes',
+ 'sum_of_piggy_banks' => 'Som van spaarpotjes',
+ 'saved_so_far' => 'Gespaard',
+ 'left_to_save' => 'Te sparen',
+ 'add_money_to_piggy_title' => 'Stop geld in spaarpotje ":name"',
+ 'remove_money_from_piggy_title' => 'Haal geld uit spaarpotje ":name"',
+ 'add' => 'Toevoegen',
+ 'remove' => 'Verwijderen',
+ 'max_amount_add' => 'Hooguit toe te voegen',
+ 'max_amount_remove' => 'Hooguit te verwijderen',
+ 'update_piggy_button' => 'Wijzig spaarpotje',
+ 'update_piggy_title' => 'Wijzig spaarpotje ":name"',
+ 'details' => 'Details',
+ 'events' => 'Gebeurtenissen',
+ 'target_amount' => 'Doelbedrag',
+ 'start_date' => 'Startdatum',
+ 'target_date' => 'Doeldatum',
+ 'no_target_date' => 'Geen doeldatum',
+ 'todo' => 'te doen',
+ 'table' => 'Tabel',
+ 'piggy_bank_not_exists' => 'Dit spaarpotje bestaat niet meer.',
+ 'add_any_amount_to_piggy' => 'Stop geld in dit spaarpotje om het doel van :amount te halen.',
+ 'add_set_amount_to_piggy' => 'Stop voor :date :amount in dit spaarpotje om hem op tijd te vullen.',
+ 'delete_piggy_bank' => 'Verwijder spaarpotje ":name"',
// tags
- 'delete_tag' => 'Verwijder tag ":name"',
- 'new_tag' => 'Maak nieuwe tag',
- 'edit_tag' => 'Wijzig tag ":tag"',
- 'no_year' => 'Zonder jaar',
- 'no_maand' => 'Zonder jaar',
- 'tag_title_nothing' => 'Standaard tags',
- 'tag_title_balancingAct' => 'Balancing act tags',
- 'tag_title_advancePayment' => 'Advance payment tags',
+ 'delete_tag' => 'Verwijder tag ":name"',
+ 'new_tag' => 'Maak nieuwe tag',
+ 'edit_tag' => 'Wijzig tag ":tag"',
+ 'no_year' => 'Zonder jaar',
+ 'no_maand' => 'Zonder jaar',
+ 'tag_title_nothing' => 'Standaard tags',
+ 'tag_title_balancingAct' => 'Balancing act tags',
+ 'tag_title_advancePayment' => 'Advance payment tags',
];
diff --git a/resources/lang/nl/form.php b/resources/lang/nl/form.php
index 5ab0cd308b..6e62b37901 100644
--- a/resources/lang/nl/form.php
+++ b/resources/lang/nl/form.php
@@ -45,6 +45,12 @@ return [
'under' => 'Onder',
'symbol' => 'Symbool',
'code' => 'Code',
+ 'iban' => 'IBAN',
+ 'csv' => 'CSV-bestand',
+ 'has_headers' => 'Kolomnamen op de eerste rij?',
+ 'date_format' => 'Datumformaat',
+ 'csv_config' => 'Configuratiebestand',
+ 'specifix' => 'Bank- or of bestandsspecifieke opties',
'store_new_withdrawal' => 'Nieuwe uitgave opslaan',
'store_new_deposit' => 'Nieuwe inkomsten opslaan',
diff --git a/resources/lang/nl/list.php b/resources/lang/nl/list.php
index a9a8a30b02..8eb2ac36e7 100644
--- a/resources/lang/nl/list.php
+++ b/resources/lang/nl/list.php
@@ -28,6 +28,6 @@ return [
'deposit' => 'Inkomsten',
'transfer' => 'Overschrijving',
'type' => 'Type',
- 'completed' => 'Opgeslagen'
-
+ 'completed' => 'Opgeslagen',
+ 'iban' => 'IBAN',
];
diff --git a/resources/twig/accounts/create.twig b/resources/twig/accounts/create.twig
index da6437d0e7..c52b5321ea 100644
--- a/resources/twig/accounts/create.twig
+++ b/resources/twig/accounts/create.twig
@@ -29,6 +29,7 @@
+ {{ ExpandedForm.text('iban') }}
{{ ExpandedForm.balance('openingBalance') }}
{{ ExpandedForm.date('openingBalanceDate', phpdate('Y-m-d')) }}
{{ ExpandedForm.select('accountRole', Config.get('firefly.accountRoles'),null,{'helpText' : 'Any extra options resulting from your choice can be set later.'}) }}
diff --git a/resources/twig/accounts/edit.twig b/resources/twig/accounts/edit.twig
index 78d846f546..32e0c55972 100644
--- a/resources/twig/accounts/edit.twig
+++ b/resources/twig/accounts/edit.twig
@@ -27,6 +27,7 @@
{{ 'optionalFields'|_ }}
+ {{ ExpandedForm.text('iban') }}
{% if account.accounttype.type == 'Default account' or account.accounttype.type == 'Asset account' %}
{{ ExpandedForm.balance('openingBalance',null, {'currency' : openingBalance ? openingBalance.transactionCurrency : null}) }}
{{ ExpandedForm.date('openingBalanceDate') }}
diff --git a/resources/twig/csv/column-roles.twig b/resources/twig/csv/column-roles.twig
new file mode 100644
index 0000000000..3f186e89ff
--- /dev/null
+++ b/resources/twig/csv/column-roles.twig
@@ -0,0 +1,87 @@
+{% extends "./layout/default.twig" %}
+
+{% block breadcrumbs %}
+ {{ Breadcrumbs.renderIfExists(Route.getCurrentRoute.getName) }}
+{% endblock %}
+
+{% block content %}
+
+
+
+
+
+
+
+
{{ 'csv_column_roles_text'|_ }}
+
+
+
+
+
+
+{% endblock %}
diff --git a/resources/twig/csv/download-config.twig b/resources/twig/csv/download-config.twig
new file mode 100644
index 0000000000..c1f8a7eb88
--- /dev/null
+++ b/resources/twig/csv/download-config.twig
@@ -0,0 +1,50 @@
+{% extends "./layout/default.twig" %}
+
+{% block breadcrumbs %}
+ {{ Breadcrumbs.renderIfExists(Route.getCurrentRoute.getName) }}
+{% endblock %}
+
+{% block content %}
+
+
+
+
+
+
+{% endblock %}
diff --git a/resources/twig/csv/index.twig b/resources/twig/csv/index.twig
new file mode 100644
index 0000000000..1de0109ae5
--- /dev/null
+++ b/resources/twig/csv/index.twig
@@ -0,0 +1,102 @@
+{% extends "./layout/default.twig" %}
+
+{% block breadcrumbs %}
+ {{ Breadcrumbs.renderIfExists(Route.getCurrentRoute.getName) }}
+{% endblock %}
+
+{% block content %}
+
+
+
+
+
+
+
+ {{ 'csv_index_text'|_ }}
+
{{ 'csv_index_beta_warning'|_ }}
+ {% if unsupported|length > 0 %}
+
{{ 'csv_index_unsupported_warning'|_ }}
+
+ {% for message in unsupported %}
+ - {{ message }}
+ {% endfor %}
+
+ {% endif %}
+
+
+
+
+
+
+
+
+
+
+
+{% endblock %}
diff --git a/resources/twig/csv/map.twig b/resources/twig/csv/map.twig
new file mode 100644
index 0000000000..ccd26c0e50
--- /dev/null
+++ b/resources/twig/csv/map.twig
@@ -0,0 +1,92 @@
+{% extends "./layout/default.twig" %}
+
+{% block breadcrumbs %}
+ {{ Breadcrumbs.renderIfExists(Route.getCurrentRoute.getName) }}
+{% endblock %}
+
+{% block content %}
+
+
+
+
+
+
+
+
+ {{ 'csv_map_text'|_ }}
+
+
+
+
+
+
+
+
+
+{% endblock %}
diff --git a/resources/twig/csv/process.twig b/resources/twig/csv/process.twig
new file mode 100644
index 0000000000..89911bc291
--- /dev/null
+++ b/resources/twig/csv/process.twig
@@ -0,0 +1,56 @@
+{% extends "./layout/default.twig" %}
+
+{% block breadcrumbs %}
+ {{ Breadcrumbs.renderIfExists(Route.getCurrentRoute.getName) }}
+{% endblock %}
+
+{% block content %}
+
+
+
+
+
+
+
+
+
+ {{ trans('firefly.csv_process_text',{rows: rows}) }}
+
+
+ {% if errors|length > 0 %}
+
{{ Lang.choice('firefly.csv_import_with_errors',errors|length,{errors: errors|length}) }}
+
+ {% for index,err in errors %}
+ - {{ 'csv_row'|_ }} #{{ index }}: {{ err }}
+ {% endfor %}
+
+
+ {{ trans('firefly.csv_error_see_logs') }}
+
+ {% endif %}
+
+
+
+ {{ trans('firefly.csv_process_new_entries',{imported: imported}) }}
+
+
+
+ {{ 'csv_start_over'|_ }}
+ {{ 'csv_to_index'|_ }}
+ {{ 'csv_do_download_config'|_ }}
+
+
+
+
+
+
+
+{% endblock %}
diff --git a/resources/twig/error.twig b/resources/twig/error.twig
index e0621f17d8..4390f9c05c 100644
--- a/resources/twig/error.twig
+++ b/resources/twig/error.twig
@@ -4,9 +4,7 @@
-
Firefly
- Error
-
+ Sorry, an error occurred.
diff --git a/resources/twig/form/checkbox.twig b/resources/twig/form/checkbox.twig
index bea165b856..b2bc258cd0 100644
--- a/resources/twig/form/checkbox.twig
+++ b/resources/twig/form/checkbox.twig
@@ -7,6 +7,7 @@
{{ Form.checkbox(name, value, options.checked, options) }}
+ {% include 'form/help.twig' %}
{% include 'form/feedback.twig' %}
diff --git a/resources/twig/form/file.twig b/resources/twig/form/file.twig
new file mode 100644
index 0000000000..0596ef7dbd
--- /dev/null
+++ b/resources/twig/form/file.twig
@@ -0,0 +1,9 @@
+
+
+
+
+ {{ Form.file(name, options) }}
+ {% include 'form/help.twig' %}
+ {% include 'form/feedback.twig' %}
+
+
diff --git a/resources/twig/form/help.twig b/resources/twig/form/help.twig
index e1e2d011ea..d402fb623b 100644
--- a/resources/twig/form/help.twig
+++ b/resources/twig/form/help.twig
@@ -1,3 +1,3 @@
{% if options.helpText %}
- {{ options.helpText }}
+ {{ options.helpText|raw }}
{% endif %}
diff --git a/resources/twig/form/multiCheckbox.twig b/resources/twig/form/multiCheckbox.twig
new file mode 100644
index 0000000000..ef43eedd67
--- /dev/null
+++ b/resources/twig/form/multiCheckbox.twig
@@ -0,0 +1,17 @@
+
+
+
+
+ {% for value,description in list %}
+
+
+
+ {% endfor %}
+ {% include 'form/help.twig' %}
+ {% include 'form/feedback.twig' %}
+
+
+
diff --git a/resources/twig/form/options.twig b/resources/twig/form/options.twig
index 718110186d..8a25895f34 100644
--- a/resources/twig/form/options.twig
+++ b/resources/twig/form/options.twig
@@ -24,7 +24,7 @@
diff --git a/resources/twig/form/text.twig b/resources/twig/form/text.twig
index 0b199f9117..c2f890c0fe 100644
--- a/resources/twig/form/text.twig
+++ b/resources/twig/form/text.twig
@@ -3,6 +3,7 @@
{{ Form.input('text', name, value, options) }}
+ {% include 'form/help.twig' %}
{% include 'form/feedback.twig' %}
diff --git a/resources/twig/list/accounts.twig b/resources/twig/list/accounts.twig
index 4d782b7f57..cf06a1a359 100644
--- a/resources/twig/list/accounts.twig
+++ b/resources/twig/list/accounts.twig
@@ -6,6 +6,7 @@
{% if what == 'asset' %}
{{ trans('list.role') }} |
{% endif %}
+ {{ trans('list.iban') }} |
{{ trans('list.currentBalance') }} |
{{ trans('list.active') }} |
{{ trans('list.lastActivity') }} |
@@ -31,6 +32,7 @@
{% endfor %}
{% endif %}
+ {{ account.iban }} |
{{ account|balance|formatAmount }} |
{% if account.active %}
diff --git a/resources/twig/partials/menu-sidebar.twig b/resources/twig/partials/menu-sidebar.twig
index ba080666f2..c3bfafa52c 100644
--- a/resources/twig/partials/menu-sidebar.twig
+++ b/resources/twig/partials/menu-sidebar.twig
@@ -123,6 +123,11 @@
{{ 'currencies'|_ }}
+ {% if Config.get('firefly.csv_import_enabled') %}
+
+ {{ 'csv_import'|_ }}
+
+ {% endif %}
diff --git a/storage/upload/.gitignore b/storage/upload/.gitignore
new file mode 100644
index 0000000000..d6b7ef32c8
--- /dev/null
+++ b/storage/upload/.gitignore
@@ -0,0 +1,2 @@
+*
+!.gitignore
diff --git a/tests/TestCase.php b/tests/TestCase.php
index 8b972b79d0..dc5d0dda48 100644
--- a/tests/TestCase.php
+++ b/tests/TestCase.php
@@ -32,41 +32,6 @@ class TestCase extends Illuminate\Foundation\Testing\TestCase
public function setUp()
{
parent::setUp();
-
- // if the database copy does not exist, call migrate.
- $copy = __DIR__ . '/../storage/database/testing-copy.db';
- $original = __DIR__ . '/../storage/database/testing.db';
-
- FactoryMuffin::loadFactories(__DIR__ . '/factories');
-
- if (!file_exists($copy)) {
- touch($original);
- Artisan::call('migrate');
-
-
- // create EUR currency
- /** @var TransactionCurrency $currency */
- $currency = FactoryMuffin::create('FireflyIII\Models\TransactionCurrency');
- $currency->code = 'EUR';
- $currency->save();
- copy($original, $copy);
- } else {
-
- if (file_exists($copy)) {
- copy($copy, $original);
- }
- }
- // if the database copy does exists, copy back as original.
-
- $this->session(
- [
- 'start' => Carbon::now()->startOfMonth(),
- 'end' => Carbon::now()->endOfMonth(),
- 'first' => Carbon::now()->startOfYear()
- ]
- );
-
-
}
/**
@@ -86,11 +51,6 @@ class TestCase extends Illuminate\Foundation\Testing\TestCase
public function tearDown()
{
parent::tearDown();
-
- // delete copy original.
- //$original = __DIR__.'/../storage/database/testing.db';
- //unlink($original);
-
}
/**
diff --git a/tests/_bootstrap.php b/tests/_bootstrap.php
new file mode 100644
index 0000000000..243f9c85bc
--- /dev/null
+++ b/tests/_bootstrap.php
@@ -0,0 +1,2 @@
+setHeader('X-Requested-With', 'Codeception');
+ * $I->amOnPage('test-headers.php');
+ * ?>
+ * ```
+ *
+ * @param string $name the name of the request header
+ * @param string $value the value to set it to for subsequent
+ * requests
+ * @see \Codeception\Module\PhpBrowser::setHeader()
+ */
+ public function setHeader($name, $value) {
+ return $this->getScenario()->runStep(new \Codeception\Step\Action('setHeader', func_get_args()));
+ }
+
+
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Deletes the header with the passed name. Subsequent requests
+ * will not have the deleted header in its request.
+ *
+ * Example:
+ * ```php
+ * setHeader('X-Requested-With', 'Codeception');
+ * $I->amOnPage('test-headers.php');
+ * // ...
+ * $I->deleteHeader('X-Requested-With');
+ * $I->amOnPage('some-other-page.php');
+ * ?>
+ * ```
+ *
+ * @param string $name the name of the header to delete.
+ * @see \Codeception\Module\PhpBrowser::deleteHeader()
+ */
+ public function deleteHeader($name) {
+ return $this->getScenario()->runStep(new \Codeception\Step\Action('deleteHeader', func_get_args()));
+ }
+
+
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Authenticates user for HTTP_AUTH
+ *
+ * @param $username
+ * @param $password
+ * @see \Codeception\Module\PhpBrowser::amHttpAuthenticated()
+ */
+ public function amHttpAuthenticated($username, $password) {
+ return $this->getScenario()->runStep(new \Codeception\Step\Condition('amHttpAuthenticated', func_get_args()));
+ }
+
+
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Open web page at the given absolute URL and sets its hostname as the base host.
+ *
+ * ``` php
+ * amOnUrl('http://codeception.com');
+ * $I->amOnPage('/quickstart'); // moves to http://codeception.com/quickstart
+ * ?>
+ * ```
+ * @see \Codeception\Module\PhpBrowser::amOnUrl()
+ */
+ public function amOnUrl($url) {
+ return $this->getScenario()->runStep(new \Codeception\Step\Condition('amOnUrl', func_get_args()));
+ }
+
+
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Changes the subdomain for the 'url' configuration parameter.
+ * Does not open a page; use `amOnPage` for that.
+ *
+ * ``` php
+ * amOnSubdomain('user');
+ * $I->amOnPage('/');
+ * // moves to http://user.mysite.com/
+ * ?>
+ * ```
+ *
+ * @param $subdomain
+ *
+ * @return mixed
+ * @see \Codeception\Module\PhpBrowser::amOnSubdomain()
+ */
+ public function amOnSubdomain($subdomain) {
+ return $this->getScenario()->runStep(new \Codeception\Step\Condition('amOnSubdomain', func_get_args()));
+ }
+
+
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Low-level API method.
+ * If Codeception commands are not enough, use [Guzzle HTTP Client](http://guzzlephp.org/) methods directly
+ *
+ * Example:
+ *
+ * ``` php
+ * executeInGuzzle(function (\GuzzleHttp\Client $client) {
+ * $client->get('/get', ['query' => ['foo' => 'bar']]);
+ * });
+ * ?>
+ * ```
+ *
+ * It is not recommended to use this command on a regular basis.
+ * If Codeception lacks important Guzzle Client methods, implement them and submit patches.
+ *
+ * @param callable $function
+ * @see \Codeception\Module\PhpBrowser::executeInGuzzle()
+ */
+ public function executeInGuzzle($function) {
+ return $this->getScenario()->runStep(new \Codeception\Step\Action('executeInGuzzle', func_get_args()));
+ }
+
+
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Opens the page for the given relative URI.
+ *
+ * ``` php
+ * amOnPage('/');
+ * // opens /register page
+ * $I->amOnPage('/register');
+ * ?>
+ * ```
+ *
+ * @param $page
+ * @see \Codeception\Lib\InnerBrowser::amOnPage()
+ */
+ public function amOnPage($page) {
+ return $this->getScenario()->runStep(new \Codeception\Step\Condition('amOnPage', func_get_args()));
+ }
+
+
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Perform a click on a link or a button, given by a locator.
+ * If a fuzzy locator is given, the page will be searched for a button, link, or image matching the locator string.
+ * For buttons, the "value" attribute, "name" attribute, and inner text are searched.
+ * For links, the link text is searched.
+ * For images, the "alt" attribute and inner text of any parent links are searched.
+ *
+ * The second parameter is a context (CSS or XPath locator) to narrow the search.
+ *
+ * Note that if the locator matches a button of type `submit`, the form will be submitted.
+ *
+ * ``` php
+ * click('Logout');
+ * // button of form
+ * $I->click('Submit');
+ * // CSS button
+ * $I->click('#form input[type=submit]');
+ * // XPath
+ * $I->click('//form/*[@type=submit]');
+ * // link in context
+ * $I->click('Logout', '#nav');
+ * // using strict locator
+ * $I->click(['link' => 'Login']);
+ * ?>
+ * ```
+ *
+ * @param $link
+ * @param $context
+ * @see \Codeception\Lib\InnerBrowser::click()
+ */
+ public function click($link, $context = null) {
+ return $this->getScenario()->runStep(new \Codeception\Step\Action('click', func_get_args()));
+ }
+
+
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Checks that the current page contains the given string.
+ * Specify a locator as the second parameter to match a specific region.
+ *
+ * ``` php
+ * see('Logout'); // I can suppose user is logged in
+ * $I->see('Sign Up','h1'); // I can suppose it's a signup page
+ * $I->see('Sign Up','//body/h1'); // with XPath
+ * ?>
+ * ```
+ *
+ * @param $text
+ * @param null $selector
+ * Conditional Assertion: Test won't be stopped on fail
+ * @see \Codeception\Lib\InnerBrowser::see()
+ */
+ public function canSee($text, $selector = null) {
+ return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('see', func_get_args()));
+ }
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Checks that the current page contains the given string.
+ * Specify a locator as the second parameter to match a specific region.
+ *
+ * ``` php
+ * see('Logout'); // I can suppose user is logged in
+ * $I->see('Sign Up','h1'); // I can suppose it's a signup page
+ * $I->see('Sign Up','//body/h1'); // with XPath
+ * ?>
+ * ```
+ *
+ * @param $text
+ * @param null $selector
+ * @see \Codeception\Lib\InnerBrowser::see()
+ */
+ public function see($text, $selector = null) {
+ return $this->getScenario()->runStep(new \Codeception\Step\Assertion('see', func_get_args()));
+ }
+
+
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Checks that the current page doesn't contain the text specified.
+ * Give a locator as the second parameter to match a specific region.
+ *
+ * ```php
+ * dontSee('Login'); // I can suppose user is already logged in
+ * $I->dontSee('Sign Up','h1'); // I can suppose it's not a signup page
+ * $I->dontSee('Sign Up','//body/h1'); // with XPath
+ * ?>
+ * ```
+ *
+ * @param $text
+ * @param null $selector
+ * Conditional Assertion: Test won't be stopped on fail
+ * @see \Codeception\Lib\InnerBrowser::dontSee()
+ */
+ public function cantSee($text, $selector = null) {
+ return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('dontSee', func_get_args()));
+ }
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Checks that the current page doesn't contain the text specified.
+ * Give a locator as the second parameter to match a specific region.
+ *
+ * ```php
+ * dontSee('Login'); // I can suppose user is already logged in
+ * $I->dontSee('Sign Up','h1'); // I can suppose it's not a signup page
+ * $I->dontSee('Sign Up','//body/h1'); // with XPath
+ * ?>
+ * ```
+ *
+ * @param $text
+ * @param null $selector
+ * @see \Codeception\Lib\InnerBrowser::dontSee()
+ */
+ public function dontSee($text, $selector = null) {
+ return $this->getScenario()->runStep(new \Codeception\Step\Assertion('dontSee', func_get_args()));
+ }
+
+
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Checks that there's a link with the specified text.
+ * Give a full URL as the second parameter to match links with that exact URL.
+ *
+ * ``` php
+ * seeLink('Logout'); // matches Logout
+ * $I->seeLink('Logout','/logout'); // matches Logout
+ * ?>
+ * ```
+ *
+ * @param $text
+ * @param null $url
+ * Conditional Assertion: Test won't be stopped on fail
+ * @see \Codeception\Lib\InnerBrowser::seeLink()
+ */
+ public function canSeeLink($text, $url = null) {
+ return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeLink', func_get_args()));
+ }
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Checks that there's a link with the specified text.
+ * Give a full URL as the second parameter to match links with that exact URL.
+ *
+ * ``` php
+ * seeLink('Logout'); // matches Logout
+ * $I->seeLink('Logout','/logout'); // matches Logout
+ * ?>
+ * ```
+ *
+ * @param $text
+ * @param null $url
+ * @see \Codeception\Lib\InnerBrowser::seeLink()
+ */
+ public function seeLink($text, $url = null) {
+ return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeLink', func_get_args()));
+ }
+
+
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Checks that the page doesn't contain a link with the given string.
+ * If the second parameter is given, only links with a matching "href" attribute will be checked.
+ *
+ * ``` php
+ * dontSeeLink('Logout'); // I suppose user is not logged in
+ * $I->dontSeeLink('Checkout now', '/store/cart.php');
+ * ?>
+ * ```
+ *
+ * @param $text
+ * @param null $url
+ * Conditional Assertion: Test won't be stopped on fail
+ * @see \Codeception\Lib\InnerBrowser::dontSeeLink()
+ */
+ public function cantSeeLink($text, $url = null) {
+ return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeLink', func_get_args()));
+ }
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Checks that the page doesn't contain a link with the given string.
+ * If the second parameter is given, only links with a matching "href" attribute will be checked.
+ *
+ * ``` php
+ * dontSeeLink('Logout'); // I suppose user is not logged in
+ * $I->dontSeeLink('Checkout now', '/store/cart.php');
+ * ?>
+ * ```
+ *
+ * @param $text
+ * @param null $url
+ * @see \Codeception\Lib\InnerBrowser::dontSeeLink()
+ */
+ public function dontSeeLink($text, $url = null) {
+ return $this->getScenario()->runStep(new \Codeception\Step\Assertion('dontSeeLink', func_get_args()));
+ }
+
+
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Checks that current URI contains the given string.
+ *
+ * ``` php
+ * seeInCurrentUrl('home');
+ * // to match: /users/1
+ * $I->seeInCurrentUrl('/users/');
+ * ?>
+ * ```
+ *
+ * @param $uri
+ * Conditional Assertion: Test won't be stopped on fail
+ * @see \Codeception\Lib\InnerBrowser::seeInCurrentUrl()
+ */
+ public function canSeeInCurrentUrl($uri) {
+ return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeInCurrentUrl', func_get_args()));
+ }
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Checks that current URI contains the given string.
+ *
+ * ``` php
+ * seeInCurrentUrl('home');
+ * // to match: /users/1
+ * $I->seeInCurrentUrl('/users/');
+ * ?>
+ * ```
+ *
+ * @param $uri
+ * @see \Codeception\Lib\InnerBrowser::seeInCurrentUrl()
+ */
+ public function seeInCurrentUrl($uri) {
+ return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeInCurrentUrl', func_get_args()));
+ }
+
+
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Checks that the current URI doesn't contain the given string.
+ *
+ * ``` php
+ * dontSeeInCurrentUrl('/users/');
+ * ?>
+ * ```
+ *
+ * @param $uri
+ * Conditional Assertion: Test won't be stopped on fail
+ * @see \Codeception\Lib\InnerBrowser::dontSeeInCurrentUrl()
+ */
+ public function cantSeeInCurrentUrl($uri) {
+ return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeInCurrentUrl', func_get_args()));
+ }
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Checks that the current URI doesn't contain the given string.
+ *
+ * ``` php
+ * dontSeeInCurrentUrl('/users/');
+ * ?>
+ * ```
+ *
+ * @param $uri
+ * @see \Codeception\Lib\InnerBrowser::dontSeeInCurrentUrl()
+ */
+ public function dontSeeInCurrentUrl($uri) {
+ return $this->getScenario()->runStep(new \Codeception\Step\Assertion('dontSeeInCurrentUrl', func_get_args()));
+ }
+
+
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Checks that the current URL is equal to the given string.
+ * Unlike `seeInCurrentUrl`, this only matches the full URL.
+ *
+ * ``` php
+ * seeCurrentUrlEquals('/');
+ * ?>
+ * ```
+ *
+ * @param $uri
+ * Conditional Assertion: Test won't be stopped on fail
+ * @see \Codeception\Lib\InnerBrowser::seeCurrentUrlEquals()
+ */
+ public function canSeeCurrentUrlEquals($uri) {
+ return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeCurrentUrlEquals', func_get_args()));
+ }
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Checks that the current URL is equal to the given string.
+ * Unlike `seeInCurrentUrl`, this only matches the full URL.
+ *
+ * ``` php
+ * seeCurrentUrlEquals('/');
+ * ?>
+ * ```
+ *
+ * @param $uri
+ * @see \Codeception\Lib\InnerBrowser::seeCurrentUrlEquals()
+ */
+ public function seeCurrentUrlEquals($uri) {
+ return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeCurrentUrlEquals', func_get_args()));
+ }
+
+
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Checks that the current URL doesn't equal the given string.
+ * Unlike `dontSeeInCurrentUrl`, this only matches the full URL.
+ *
+ * ``` php
+ * dontSeeCurrentUrlEquals('/');
+ * ?>
+ * ```
+ *
+ * @param $uri
+ * Conditional Assertion: Test won't be stopped on fail
+ * @see \Codeception\Lib\InnerBrowser::dontSeeCurrentUrlEquals()
+ */
+ public function cantSeeCurrentUrlEquals($uri) {
+ return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeCurrentUrlEquals', func_get_args()));
+ }
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Checks that the current URL doesn't equal the given string.
+ * Unlike `dontSeeInCurrentUrl`, this only matches the full URL.
+ *
+ * ``` php
+ * dontSeeCurrentUrlEquals('/');
+ * ?>
+ * ```
+ *
+ * @param $uri
+ * @see \Codeception\Lib\InnerBrowser::dontSeeCurrentUrlEquals()
+ */
+ public function dontSeeCurrentUrlEquals($uri) {
+ return $this->getScenario()->runStep(new \Codeception\Step\Assertion('dontSeeCurrentUrlEquals', func_get_args()));
+ }
+
+
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Checks that the current URL matches the given regular expression.
+ *
+ * ``` php
+ * seeCurrentUrlMatches('~$/users/(\d+)~');
+ * ?>
+ * ```
+ *
+ * @param $uri
+ * Conditional Assertion: Test won't be stopped on fail
+ * @see \Codeception\Lib\InnerBrowser::seeCurrentUrlMatches()
+ */
+ public function canSeeCurrentUrlMatches($uri) {
+ return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeCurrentUrlMatches', func_get_args()));
+ }
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Checks that the current URL matches the given regular expression.
+ *
+ * ``` php
+ * seeCurrentUrlMatches('~$/users/(\d+)~');
+ * ?>
+ * ```
+ *
+ * @param $uri
+ * @see \Codeception\Lib\InnerBrowser::seeCurrentUrlMatches()
+ */
+ public function seeCurrentUrlMatches($uri) {
+ return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeCurrentUrlMatches', func_get_args()));
+ }
+
+
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Checks that current url doesn't match the given regular expression.
+ *
+ * ``` php
+ * dontSeeCurrentUrlMatches('~$/users/(\d+)~');
+ * ?>
+ * ```
+ *
+ * @param $uri
+ * Conditional Assertion: Test won't be stopped on fail
+ * @see \Codeception\Lib\InnerBrowser::dontSeeCurrentUrlMatches()
+ */
+ public function cantSeeCurrentUrlMatches($uri) {
+ return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeCurrentUrlMatches', func_get_args()));
+ }
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Checks that current url doesn't match the given regular expression.
+ *
+ * ``` php
+ * dontSeeCurrentUrlMatches('~$/users/(\d+)~');
+ * ?>
+ * ```
+ *
+ * @param $uri
+ * @see \Codeception\Lib\InnerBrowser::dontSeeCurrentUrlMatches()
+ */
+ public function dontSeeCurrentUrlMatches($uri) {
+ return $this->getScenario()->runStep(new \Codeception\Step\Assertion('dontSeeCurrentUrlMatches', func_get_args()));
+ }
+
+
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Executes the given regular expression against the current URI and returns the first match.
+ * If no parameters are provided, the full URI is returned.
+ *
+ * ``` php
+ * grabFromCurrentUrl('~$/user/(\d+)/~');
+ * $uri = $I->grabFromCurrentUrl();
+ * ?>
+ * ```
+ *
+ * @param null $uri
+ *
+ * @internal param $url
+ * @return mixed
+ * @see \Codeception\Lib\InnerBrowser::grabFromCurrentUrl()
+ */
+ public function grabFromCurrentUrl($uri = null) {
+ return $this->getScenario()->runStep(new \Codeception\Step\Action('grabFromCurrentUrl', func_get_args()));
+ }
+
+
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Checks that the specified checkbox is checked.
+ *
+ * ``` php
+ * seeCheckboxIsChecked('#agree'); // I suppose user agreed to terms
+ * $I->seeCheckboxIsChecked('#signup_form input[type=checkbox]'); // I suppose user agreed to terms, If there is only one checkbox in form.
+ * $I->seeCheckboxIsChecked('//form/input[@type=checkbox and @name=agree]');
+ * ?>
+ * ```
+ *
+ * @param $checkbox
+ * Conditional Assertion: Test won't be stopped on fail
+ * @see \Codeception\Lib\InnerBrowser::seeCheckboxIsChecked()
+ */
+ public function canSeeCheckboxIsChecked($checkbox) {
+ return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeCheckboxIsChecked', func_get_args()));
+ }
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Checks that the specified checkbox is checked.
+ *
+ * ``` php
+ * seeCheckboxIsChecked('#agree'); // I suppose user agreed to terms
+ * $I->seeCheckboxIsChecked('#signup_form input[type=checkbox]'); // I suppose user agreed to terms, If there is only one checkbox in form.
+ * $I->seeCheckboxIsChecked('//form/input[@type=checkbox and @name=agree]');
+ * ?>
+ * ```
+ *
+ * @param $checkbox
+ * @see \Codeception\Lib\InnerBrowser::seeCheckboxIsChecked()
+ */
+ public function seeCheckboxIsChecked($checkbox) {
+ return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeCheckboxIsChecked', func_get_args()));
+ }
+
+
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Check that the specified checkbox is unchecked.
+ *
+ * ``` php
+ * dontSeeCheckboxIsChecked('#agree'); // I suppose user didn't agree to terms
+ * $I->seeCheckboxIsChecked('#signup_form input[type=checkbox]'); // I suppose user didn't check the first checkbox in form.
+ * ?>
+ * ```
+ *
+ * @param $checkbox
+ * Conditional Assertion: Test won't be stopped on fail
+ * @see \Codeception\Lib\InnerBrowser::dontSeeCheckboxIsChecked()
+ */
+ public function cantSeeCheckboxIsChecked($checkbox) {
+ return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeCheckboxIsChecked', func_get_args()));
+ }
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Check that the specified checkbox is unchecked.
+ *
+ * ``` php
+ * dontSeeCheckboxIsChecked('#agree'); // I suppose user didn't agree to terms
+ * $I->seeCheckboxIsChecked('#signup_form input[type=checkbox]'); // I suppose user didn't check the first checkbox in form.
+ * ?>
+ * ```
+ *
+ * @param $checkbox
+ * @see \Codeception\Lib\InnerBrowser::dontSeeCheckboxIsChecked()
+ */
+ public function dontSeeCheckboxIsChecked($checkbox) {
+ return $this->getScenario()->runStep(new \Codeception\Step\Assertion('dontSeeCheckboxIsChecked', func_get_args()));
+ }
+
+
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Checks that the given input field or textarea contains the given value.
+ * For fuzzy locators, fields are matched by label text, the "name" attribute, CSS, and XPath.
+ *
+ * ``` php
+ * seeInField('Body','Type your comment here');
+ * $I->seeInField('form textarea[name=body]','Type your comment here');
+ * $I->seeInField('form input[type=hidden]','hidden_value');
+ * $I->seeInField('#searchform input','Search');
+ * $I->seeInField('//form/*[@name=search]','Search');
+ * $I->seeInField(['name' => 'search'], 'Search');
+ * ?>
+ * ```
+ *
+ * @param $field
+ * @param $value
+ * Conditional Assertion: Test won't be stopped on fail
+ * @see \Codeception\Lib\InnerBrowser::seeInField()
+ */
+ public function canSeeInField($field, $value) {
+ return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeInField', func_get_args()));
+ }
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Checks that the given input field or textarea contains the given value.
+ * For fuzzy locators, fields are matched by label text, the "name" attribute, CSS, and XPath.
+ *
+ * ``` php
+ * seeInField('Body','Type your comment here');
+ * $I->seeInField('form textarea[name=body]','Type your comment here');
+ * $I->seeInField('form input[type=hidden]','hidden_value');
+ * $I->seeInField('#searchform input','Search');
+ * $I->seeInField('//form/*[@name=search]','Search');
+ * $I->seeInField(['name' => 'search'], 'Search');
+ * ?>
+ * ```
+ *
+ * @param $field
+ * @param $value
+ * @see \Codeception\Lib\InnerBrowser::seeInField()
+ */
+ public function seeInField($field, $value) {
+ return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeInField', func_get_args()));
+ }
+
+
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Checks that an input field or textarea doesn't contain the given value.
+ * For fuzzy locators, the field is matched by label text, CSS and XPath.
+ *
+ * ``` php
+ * dontSeeInField('Body','Type your comment here');
+ * $I->dontSeeInField('form textarea[name=body]','Type your comment here');
+ * $I->dontSeeInField('form input[type=hidden]','hidden_value');
+ * $I->dontSeeInField('#searchform input','Search');
+ * $I->dontSeeInField('//form/*[@name=search]','Search');
+ * $I->dontSeeInField(['name' => 'search'], 'Search');
+ * ?>
+ * ```
+ *
+ * @param $field
+ * @param $value
+ * Conditional Assertion: Test won't be stopped on fail
+ * @see \Codeception\Lib\InnerBrowser::dontSeeInField()
+ */
+ public function cantSeeInField($field, $value) {
+ return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeInField', func_get_args()));
+ }
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Checks that an input field or textarea doesn't contain the given value.
+ * For fuzzy locators, the field is matched by label text, CSS and XPath.
+ *
+ * ``` php
+ * dontSeeInField('Body','Type your comment here');
+ * $I->dontSeeInField('form textarea[name=body]','Type your comment here');
+ * $I->dontSeeInField('form input[type=hidden]','hidden_value');
+ * $I->dontSeeInField('#searchform input','Search');
+ * $I->dontSeeInField('//form/*[@name=search]','Search');
+ * $I->dontSeeInField(['name' => 'search'], 'Search');
+ * ?>
+ * ```
+ *
+ * @param $field
+ * @param $value
+ * @see \Codeception\Lib\InnerBrowser::dontSeeInField()
+ */
+ public function dontSeeInField($field, $value) {
+ return $this->getScenario()->runStep(new \Codeception\Step\Assertion('dontSeeInField', func_get_args()));
+ }
+
+
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Checks if the array of form parameters (name => value) are set on the form matched with the
+ * passed selector.
+ *
+ * ``` php
+ * seeInFormFields('form[name=myform]', [
+ * 'input1' => 'value',
+ * 'input2' => 'other value',
+ * ]);
+ * ?>
+ * ```
+ *
+ * For multi-select elements, or to check values of multiple elements with the same name, an
+ * array may be passed:
+ *
+ * ``` php
+ * seeInFormFields('.form-class', [
+ * 'multiselect' => [
+ * 'value1',
+ * 'value2',
+ * ],
+ * 'checkbox[]' => [
+ * 'a checked value',
+ * 'another checked value',
+ * ],
+ * ]);
+ * ?>
+ * ```
+ *
+ * Additionally, checkbox values can be checked with a boolean.
+ *
+ * ``` php
+ * seeInFormFields('#form-id', [
+ * 'checkbox1' => true, // passes if checked
+ * 'checkbox2' => false, // passes if unchecked
+ * ]);
+ * ?>
+ * ```
+ *
+ * Pair this with submitForm for quick testing magic.
+ *
+ * ``` php
+ * 'value',
+ * 'field2' => 'another value',
+ * 'checkbox1' => true,
+ * // ...
+ * ];
+ * $I->submitForm('//form[@id=my-form]', $form, 'submitButton');
+ * // $I->amOnPage('/path/to/form-page') may be needed
+ * $I->seeInFormFields('//form[@id=my-form]', $form);
+ * ?>
+ * ```
+ *
+ * @param $formSelector
+ * @param $params
+ * Conditional Assertion: Test won't be stopped on fail
+ * @see \Codeception\Lib\InnerBrowser::seeInFormFields()
+ */
+ public function canSeeInFormFields($formSelector, $params) {
+ return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeInFormFields', func_get_args()));
+ }
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Checks if the array of form parameters (name => value) are set on the form matched with the
+ * passed selector.
+ *
+ * ``` php
+ * seeInFormFields('form[name=myform]', [
+ * 'input1' => 'value',
+ * 'input2' => 'other value',
+ * ]);
+ * ?>
+ * ```
+ *
+ * For multi-select elements, or to check values of multiple elements with the same name, an
+ * array may be passed:
+ *
+ * ``` php
+ * seeInFormFields('.form-class', [
+ * 'multiselect' => [
+ * 'value1',
+ * 'value2',
+ * ],
+ * 'checkbox[]' => [
+ * 'a checked value',
+ * 'another checked value',
+ * ],
+ * ]);
+ * ?>
+ * ```
+ *
+ * Additionally, checkbox values can be checked with a boolean.
+ *
+ * ``` php
+ * seeInFormFields('#form-id', [
+ * 'checkbox1' => true, // passes if checked
+ * 'checkbox2' => false, // passes if unchecked
+ * ]);
+ * ?>
+ * ```
+ *
+ * Pair this with submitForm for quick testing magic.
+ *
+ * ``` php
+ * 'value',
+ * 'field2' => 'another value',
+ * 'checkbox1' => true,
+ * // ...
+ * ];
+ * $I->submitForm('//form[@id=my-form]', $form, 'submitButton');
+ * // $I->amOnPage('/path/to/form-page') may be needed
+ * $I->seeInFormFields('//form[@id=my-form]', $form);
+ * ?>
+ * ```
+ *
+ * @param $formSelector
+ * @param $params
+ * @see \Codeception\Lib\InnerBrowser::seeInFormFields()
+ */
+ public function seeInFormFields($formSelector, $params) {
+ return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeInFormFields', func_get_args()));
+ }
+
+
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Checks if the array of form parameters (name => value) are not set on the form matched with
+ * the passed selector.
+ *
+ * ``` php
+ * dontSeeInFormFields('form[name=myform]', [
+ * 'input1' => 'non-existent value',
+ * 'input2' => 'other non-existent value',
+ * ]);
+ * ?>
+ * ```
+ *
+ * To check that an element hasn't been assigned any one of many values, an array can be passed
+ * as the value:
+ *
+ * ``` php
+ * dontSeeInFormFields('.form-class', [
+ * 'fieldName' => [
+ * 'This value shouldn\'t be set',
+ * 'And this value shouldn\'t be set',
+ * ],
+ * ]);
+ * ?>
+ * ```
+ *
+ * Additionally, checkbox values can be checked with a boolean.
+ *
+ * ``` php
+ * dontSeeInFormFields('#form-id', [
+ * 'checkbox1' => true, // fails if checked
+ * 'checkbox2' => false, // fails if unchecked
+ * ]);
+ * ?>
+ * ```
+ *
+ * @param $formSelector
+ * @param $params
+ * Conditional Assertion: Test won't be stopped on fail
+ * @see \Codeception\Lib\InnerBrowser::dontSeeInFormFields()
+ */
+ public function cantSeeInFormFields($formSelector, $params) {
+ return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeInFormFields', func_get_args()));
+ }
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Checks if the array of form parameters (name => value) are not set on the form matched with
+ * the passed selector.
+ *
+ * ``` php
+ * dontSeeInFormFields('form[name=myform]', [
+ * 'input1' => 'non-existent value',
+ * 'input2' => 'other non-existent value',
+ * ]);
+ * ?>
+ * ```
+ *
+ * To check that an element hasn't been assigned any one of many values, an array can be passed
+ * as the value:
+ *
+ * ``` php
+ * dontSeeInFormFields('.form-class', [
+ * 'fieldName' => [
+ * 'This value shouldn\'t be set',
+ * 'And this value shouldn\'t be set',
+ * ],
+ * ]);
+ * ?>
+ * ```
+ *
+ * Additionally, checkbox values can be checked with a boolean.
+ *
+ * ``` php
+ * dontSeeInFormFields('#form-id', [
+ * 'checkbox1' => true, // fails if checked
+ * 'checkbox2' => false, // fails if unchecked
+ * ]);
+ * ?>
+ * ```
+ *
+ * @param $formSelector
+ * @param $params
+ * @see \Codeception\Lib\InnerBrowser::dontSeeInFormFields()
+ */
+ public function dontSeeInFormFields($formSelector, $params) {
+ return $this->getScenario()->runStep(new \Codeception\Step\Assertion('dontSeeInFormFields', func_get_args()));
+ }
+
+
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Submits the given form on the page, optionally with the given form
+ * values. Give the form fields values as an array.
+ *
+ * Skipped fields will be filled by their values from the page.
+ * You don't need to click the 'Submit' button afterwards.
+ * This command itself triggers the request to form's action.
+ *
+ * You can optionally specify what button's value to include
+ * in the request with the last parameter as an alternative to
+ * explicitly setting its value in the second parameter, as
+ * button values are not otherwise included in the request.
+ *
+ * Examples:
+ *
+ * ``` php
+ * submitForm('#login', [
+ * 'login' => 'davert',
+ * 'password' => '123456'
+ * ]);
+ * // or
+ * $I->submitForm('#login', [
+ * 'login' => 'davert',
+ * 'password' => '123456'
+ * ], 'submitButtonName');
+ *
+ * ```
+ *
+ * For example, given this sample "Sign Up" form:
+ *
+ * ``` html
+ *
+ * ```
+ *
+ * You could write the following to submit it:
+ *
+ * ``` php
+ * submitForm(
+ * '#userForm',
+ * [
+ * 'user' => [
+ * 'login' => 'Davert',
+ * 'password' => '123456',
+ * 'agree' => true
+ * ]
+ * ],
+ * 'submitButton'
+ * );
+ * ```
+ * Note that "2" will be the submitted value for the "plan" field, as it is
+ * the selected option.
+ *
+ * You can also emulate a JavaScript submission by not specifying any
+ * buttons in the third parameter to submitForm.
+ *
+ * ```php
+ * submitForm(
+ * '#userForm',
+ * [
+ * 'user' => [
+ * 'login' => 'Davert',
+ * 'password' => '123456',
+ * 'agree' => true
+ * ]
+ * ]
+ * );
+ * ```
+ *
+ * Pair this with seeInFormFields for quick testing magic.
+ *
+ * ``` php
+ * 'value',
+ * 'field2' => 'another value',
+ * 'checkbox1' => true,
+ * // ...
+ * ];
+ * $I->submitForm('//form[@id=my-form]', $form, 'submitButton');
+ * // $I->amOnPage('/path/to/form-page') may be needed
+ * $I->seeInFormFields('//form[@id=my-form]', $form);
+ * ?>
+ * ```
+ *
+ * Parameter values can be set to arrays for multiple input fields
+ * of the same name, or multi-select combo boxes. For checkboxes,
+ * either the string value can be used, or boolean values which will
+ * be replaced by the checkbox's value in the DOM.
+ *
+ * ``` php
+ * submitForm('#my-form', [
+ * 'field1' => 'value',
+ * 'checkbox' => [
+ * 'value of first checkbox',
+ * 'value of second checkbox,
+ * ],
+ * 'otherCheckboxes' => [
+ * true,
+ * false,
+ * false
+ * ],
+ * 'multiselect' => [
+ * 'first option value',
+ * 'second option value'
+ * ]
+ * ]);
+ * ?>
+ * ```
+ *
+ * Mixing string and boolean values for a checkbox's value is not supported
+ * and may produce unexpected results.
+ *
+ * Field names ending in "[]" must be passed without the trailing square
+ * bracket characters, and must contain an array for its value. This allows
+ * submitting multiple values with the same name, consider:
+ *
+ * ```php
+ * $I->submitForm('#my-form', [
+ * 'field[]' => 'value',
+ * 'field[]' => 'another value', // 'field[]' is already a defined key
+ * ]);
+ * ```
+ *
+ * The solution is to pass an array value:
+ *
+ * ```php
+ * // this way both values are submitted
+ * $I->submitForm('#my-form', [
+ * 'field' => [
+ * 'value',
+ * 'another value',
+ * ]
+ * ]);
+ * ```
+ *
+ * @param $selector
+ * @param $params
+ * @param $button
+ * @see \Codeception\Lib\InnerBrowser::submitForm()
+ */
+ public function submitForm($selector, $params, $button = null) {
+ return $this->getScenario()->runStep(new \Codeception\Step\Action('submitForm', func_get_args()));
+ }
+
+
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Fills a text field or textarea with the given string.
+ *
+ * ``` php
+ * fillField("//input[@type='text']", "Hello World!");
+ * $I->fillField(['name' => 'email'], 'jon@mail.com');
+ * ?>
+ * ```
+ *
+ * @param $field
+ * @param $value
+ * @see \Codeception\Lib\InnerBrowser::fillField()
+ */
+ public function fillField($field, $value) {
+ return $this->getScenario()->runStep(new \Codeception\Step\Action('fillField', func_get_args()));
+ }
+
+
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Selects an option in a select tag or in radio button group.
+ *
+ * ``` php
+ * selectOption('form select[name=account]', 'Premium');
+ * $I->selectOption('form input[name=payment]', 'Monthly');
+ * $I->selectOption('//form/select[@name=account]', 'Monthly');
+ * ?>
+ * ```
+ *
+ * Provide an array for the second argument to select multiple options:
+ *
+ * ``` php
+ * selectOption('Which OS do you use?', array('Windows','Linux'));
+ * ?>
+ * ```
+ *
+ * @param $select
+ * @param $option
+ * @see \Codeception\Lib\InnerBrowser::selectOption()
+ */
+ public function selectOption($select, $option) {
+ return $this->getScenario()->runStep(new \Codeception\Step\Action('selectOption', func_get_args()));
+ }
+
+
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Ticks a checkbox. For radio buttons, use the `selectOption` method instead.
+ *
+ * ``` php
+ * checkOption('#agree');
+ * ?>
+ * ```
+ *
+ * @param $option
+ * @see \Codeception\Lib\InnerBrowser::checkOption()
+ */
+ public function checkOption($option) {
+ return $this->getScenario()->runStep(new \Codeception\Step\Action('checkOption', func_get_args()));
+ }
+
+
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Unticks a checkbox.
+ *
+ * ``` php
+ * uncheckOption('#notify');
+ * ?>
+ * ```
+ *
+ * @param $option
+ * @see \Codeception\Lib\InnerBrowser::uncheckOption()
+ */
+ public function uncheckOption($option) {
+ return $this->getScenario()->runStep(new \Codeception\Step\Action('uncheckOption', func_get_args()));
+ }
+
+
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Attaches a file relative to the Codeception data directory to the given file upload field.
+ *
+ * ``` php
+ * attachFile('input[@type="file"]', 'prices.xls');
+ * ?>
+ * ```
+ *
+ * @param $field
+ * @param $filename
+ * @see \Codeception\Lib\InnerBrowser::attachFile()
+ */
+ public function attachFile($field, $filename) {
+ return $this->getScenario()->runStep(new \Codeception\Step\Action('attachFile', func_get_args()));
+ }
+
+
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * If your page triggers an ajax request, you can perform it manually.
+ * This action sends a GET ajax request with specified params.
+ *
+ * See ->sendAjaxPostRequest for examples.
+ *
+ * @param $uri
+ * @param $params
+ * @see \Codeception\Lib\InnerBrowser::sendAjaxGetRequest()
+ */
+ public function sendAjaxGetRequest($uri, $params = null) {
+ return $this->getScenario()->runStep(new \Codeception\Step\Action('sendAjaxGetRequest', func_get_args()));
+ }
+
+
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * If your page triggers an ajax request, you can perform it manually.
+ * This action sends a POST ajax request with specified params.
+ * Additional params can be passed as array.
+ *
+ * Example:
+ *
+ * Imagine that by clicking checkbox you trigger ajax request which updates user settings.
+ * We emulate that click by running this ajax request manually.
+ *
+ * ``` php
+ * sendAjaxPostRequest('/updateSettings', array('notifications' => true)); // POST
+ * $I->sendAjaxGetRequest('/updateSettings', array('notifications' => true)); // GET
+ *
+ * ```
+ *
+ * @param $uri
+ * @param $params
+ * @see \Codeception\Lib\InnerBrowser::sendAjaxPostRequest()
+ */
+ public function sendAjaxPostRequest($uri, $params = null) {
+ return $this->getScenario()->runStep(new \Codeception\Step\Action('sendAjaxPostRequest', func_get_args()));
+ }
+
+
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * If your page triggers an ajax request, you can perform it manually.
+ * This action sends an ajax request with specified method and params.
+ *
+ * Example:
+ *
+ * You need to perform an ajax request specifying the HTTP method.
+ *
+ * ``` php
+ * sendAjaxRequest('PUT', '/posts/7', array('title' => 'new title'));
+ *
+ * ```
+ *
+ * @param $method
+ * @param $uri
+ * @param $params
+ * @see \Codeception\Lib\InnerBrowser::sendAjaxRequest()
+ */
+ public function sendAjaxRequest($method, $uri, $params = null) {
+ return $this->getScenario()->runStep(new \Codeception\Step\Action('sendAjaxRequest', func_get_args()));
+ }
+
+
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Finds and returns the text contents of the given element.
+ * If a fuzzy locator is used, the element is found using CSS, XPath, and by matching the full page source by regular expression.
+ *
+ * ``` php
+ * grabTextFrom('h1');
+ * $heading = $I->grabTextFrom('descendant-or-self::h1');
+ * $value = $I->grabTextFrom('~
+ * ```
+ *
+ * @param $cssOrXPathOrRegex
+ *
+ * @return mixed
+ * @see \Codeception\Lib\InnerBrowser::grabTextFrom()
+ */
+ public function grabTextFrom($cssOrXPathOrRegex) {
+ return $this->getScenario()->runStep(new \Codeception\Step\Action('grabTextFrom', func_get_args()));
+ }
+
+
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Grabs the value of the given attribute value from the given element.
+ * Fails if element is not found.
+ *
+ * ``` php
+ * grabAttributeFrom('#tooltip', 'title');
+ * ?>
+ * ```
+ *
+ *
+ * @param $cssOrXpath
+ * @param $attribute
+ * @internal param $element
+ * @return mixed
+ * @see \Codeception\Lib\InnerBrowser::grabAttributeFrom()
+ */
+ public function grabAttributeFrom($cssOrXpath, $attribute) {
+ return $this->getScenario()->runStep(new \Codeception\Step\Action('grabAttributeFrom', func_get_args()));
+ }
+
+
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ *
+ * @see \Codeception\Lib\InnerBrowser::grabMultiple()
+ */
+ public function grabMultiple($cssOrXpath, $attribute = null) {
+ return $this->getScenario()->runStep(new \Codeception\Step\Action('grabMultiple', func_get_args()));
+ }
+
+
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * @param $field
+ *
+ * @return array|mixed|null|string
+ * @see \Codeception\Lib\InnerBrowser::grabValueFrom()
+ */
+ public function grabValueFrom($field) {
+ return $this->getScenario()->runStep(new \Codeception\Step\Action('grabValueFrom', func_get_args()));
+ }
+
+
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Sets a cookie with the given name and value.
+ * You can set additional cookie params like `domain`, `path`, `expire`, `secure` in array passed as last argument.
+ *
+ * ``` php
+ * setCookie('PHPSESSID', 'el4ukv0kqbvoirg7nkp4dncpk3');
+ * ?>
+ * ```
+ *
+ * @param $name
+ * @param $val
+ * @param array $params
+ *
+ * @return mixed
+ * @see \Codeception\Lib\InnerBrowser::setCookie()
+ */
+ public function setCookie($name, $val, $params = null) {
+ return $this->getScenario()->runStep(new \Codeception\Step\Action('setCookie', func_get_args()));
+ }
+
+
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Grabs a cookie value.
+ * You can set additional cookie params like `domain`, `path` in array passed as last argument.
+ *
+ * @param $cookie
+ *
+ * @param array $params
+ * @return mixed
+ * @see \Codeception\Lib\InnerBrowser::grabCookie()
+ */
+ public function grabCookie($cookie, $params = null) {
+ return $this->getScenario()->runStep(new \Codeception\Step\Action('grabCookie', func_get_args()));
+ }
+
+
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Checks that a cookie with the given name is set.
+ * You can set additional cookie params like `domain`, `path` as array passed in last argument.
+ *
+ * ``` php
+ * seeCookie('PHPSESSID');
+ * ?>
+ * ```
+ *
+ * @param $cookie
+ * @param array $params
+ * @return mixed
+ * Conditional Assertion: Test won't be stopped on fail
+ * @see \Codeception\Lib\InnerBrowser::seeCookie()
+ */
+ public function canSeeCookie($cookie, $params = null) {
+ return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeCookie', func_get_args()));
+ }
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Checks that a cookie with the given name is set.
+ * You can set additional cookie params like `domain`, `path` as array passed in last argument.
+ *
+ * ``` php
+ * seeCookie('PHPSESSID');
+ * ?>
+ * ```
+ *
+ * @param $cookie
+ * @param array $params
+ * @return mixed
+ * @see \Codeception\Lib\InnerBrowser::seeCookie()
+ */
+ public function seeCookie($cookie, $params = null) {
+ return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeCookie', func_get_args()));
+ }
+
+
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Checks that there isn't a cookie with the given name.
+ * You can set additional cookie params like `domain`, `path` as array passed in last argument.
+ *
+ * @param $cookie
+ *
+ * @param array $params
+ * @return mixed
+ * Conditional Assertion: Test won't be stopped on fail
+ * @see \Codeception\Lib\InnerBrowser::dontSeeCookie()
+ */
+ public function cantSeeCookie($cookie, $params = null) {
+ return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeCookie', func_get_args()));
+ }
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Checks that there isn't a cookie with the given name.
+ * You can set additional cookie params like `domain`, `path` as array passed in last argument.
+ *
+ * @param $cookie
+ *
+ * @param array $params
+ * @return mixed
+ * @see \Codeception\Lib\InnerBrowser::dontSeeCookie()
+ */
+ public function dontSeeCookie($cookie, $params = null) {
+ return $this->getScenario()->runStep(new \Codeception\Step\Assertion('dontSeeCookie', func_get_args()));
+ }
+
+
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Unsets cookie with the given name.
+ * You can set additional cookie params like `domain`, `path` in array passed as last argument.
+ *
+ * @param $cookie
+ *
+ * @param array $params
+ * @return mixed
+ * @see \Codeception\Lib\InnerBrowser::resetCookie()
+ */
+ public function resetCookie($name, $params = null) {
+ return $this->getScenario()->runStep(new \Codeception\Step\Action('resetCookie', func_get_args()));
+ }
+
+
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Checks that the given element exists on the page and is visible.
+ * You can also specify expected attributes of this element.
+ *
+ * ``` php
+ * seeElement('.error');
+ * $I->seeElement('//form/input[1]');
+ * $I->seeElement('input', ['name' => 'login']);
+ * $I->seeElement('input', ['value' => '123456']);
+ *
+ * // strict locator in first arg, attributes in second
+ * $I->seeElement(['css' => 'form input'], ['name' => 'login']);
+ * ?>
+ * ```
+ *
+ * @param $selector
+ * @param array $attributes
+ * @return
+ * Conditional Assertion: Test won't be stopped on fail
+ * @see \Codeception\Lib\InnerBrowser::seeElement()
+ */
+ public function canSeeElement($selector, $attributes = null) {
+ return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeElement', func_get_args()));
+ }
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Checks that the given element exists on the page and is visible.
+ * You can also specify expected attributes of this element.
+ *
+ * ``` php
+ * seeElement('.error');
+ * $I->seeElement('//form/input[1]');
+ * $I->seeElement('input', ['name' => 'login']);
+ * $I->seeElement('input', ['value' => '123456']);
+ *
+ * // strict locator in first arg, attributes in second
+ * $I->seeElement(['css' => 'form input'], ['name' => 'login']);
+ * ?>
+ * ```
+ *
+ * @param $selector
+ * @param array $attributes
+ * @return
+ * @see \Codeception\Lib\InnerBrowser::seeElement()
+ */
+ public function seeElement($selector, $attributes = null) {
+ return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeElement', func_get_args()));
+ }
+
+
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Checks that the given element is invisible or not present on the page.
+ * You can also specify expected attributes of this element.
+ *
+ * ``` php
+ * dontSeeElement('.error');
+ * $I->dontSeeElement('//form/input[1]');
+ * $I->dontSeeElement('input', ['name' => 'login']);
+ * $I->dontSeeElement('input', ['value' => '123456']);
+ * ?>
+ * ```
+ *
+ * @param $selector
+ * @param array $attributes
+ * Conditional Assertion: Test won't be stopped on fail
+ * @see \Codeception\Lib\InnerBrowser::dontSeeElement()
+ */
+ public function cantSeeElement($selector, $attributes = null) {
+ return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeElement', func_get_args()));
+ }
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Checks that the given element is invisible or not present on the page.
+ * You can also specify expected attributes of this element.
+ *
+ * ``` php
+ * dontSeeElement('.error');
+ * $I->dontSeeElement('//form/input[1]');
+ * $I->dontSeeElement('input', ['name' => 'login']);
+ * $I->dontSeeElement('input', ['value' => '123456']);
+ * ?>
+ * ```
+ *
+ * @param $selector
+ * @param array $attributes
+ * @see \Codeception\Lib\InnerBrowser::dontSeeElement()
+ */
+ public function dontSeeElement($selector, $attributes = null) {
+ return $this->getScenario()->runStep(new \Codeception\Step\Assertion('dontSeeElement', func_get_args()));
+ }
+
+
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Checks that there are a certain number of elements matched by the given locator on the page.
+ *
+ * ``` php
+ * seeNumberOfElements('tr', 10);
+ * $I->seeNumberOfElements('tr', [0,10]); //between 0 and 10 elements
+ * ?>
+ * ```
+ * @param $selector
+ * @param mixed $expected :
+ * - string: strict number
+ * - array: range of numbers [0,10]
+ * Conditional Assertion: Test won't be stopped on fail
+ * @see \Codeception\Lib\InnerBrowser::seeNumberOfElements()
+ */
+ public function canSeeNumberOfElements($selector, $expected) {
+ return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeNumberOfElements', func_get_args()));
+ }
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Checks that there are a certain number of elements matched by the given locator on the page.
+ *
+ * ``` php
+ * seeNumberOfElements('tr', 10);
+ * $I->seeNumberOfElements('tr', [0,10]); //between 0 and 10 elements
+ * ?>
+ * ```
+ * @param $selector
+ * @param mixed $expected :
+ * - string: strict number
+ * - array: range of numbers [0,10]
+ * @see \Codeception\Lib\InnerBrowser::seeNumberOfElements()
+ */
+ public function seeNumberOfElements($selector, $expected) {
+ return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeNumberOfElements', func_get_args()));
+ }
+
+
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Checks that the given option is selected.
+ *
+ * ``` php
+ * seeOptionIsSelected('#form input[name=payment]', 'Visa');
+ * ?>
+ * ```
+ *
+ * @param $selector
+ * @param $optionText
+ *
+ * @return mixed
+ * Conditional Assertion: Test won't be stopped on fail
+ * @see \Codeception\Lib\InnerBrowser::seeOptionIsSelected()
+ */
+ public function canSeeOptionIsSelected($selector, $optionText) {
+ return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeOptionIsSelected', func_get_args()));
+ }
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Checks that the given option is selected.
+ *
+ * ``` php
+ * seeOptionIsSelected('#form input[name=payment]', 'Visa');
+ * ?>
+ * ```
+ *
+ * @param $selector
+ * @param $optionText
+ *
+ * @return mixed
+ * @see \Codeception\Lib\InnerBrowser::seeOptionIsSelected()
+ */
+ public function seeOptionIsSelected($selector, $optionText) {
+ return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeOptionIsSelected', func_get_args()));
+ }
+
+
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Checks that the given option is not selected.
+ *
+ * ``` php
+ * dontSeeOptionIsSelected('#form input[name=payment]', 'Visa');
+ * ?>
+ * ```
+ *
+ * @param $selector
+ * @param $optionText
+ *
+ * @return mixed
+ * Conditional Assertion: Test won't be stopped on fail
+ * @see \Codeception\Lib\InnerBrowser::dontSeeOptionIsSelected()
+ */
+ public function cantSeeOptionIsSelected($selector, $optionText) {
+ return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeOptionIsSelected', func_get_args()));
+ }
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Checks that the given option is not selected.
+ *
+ * ``` php
+ * dontSeeOptionIsSelected('#form input[name=payment]', 'Visa');
+ * ?>
+ * ```
+ *
+ * @param $selector
+ * @param $optionText
+ *
+ * @return mixed
+ * @see \Codeception\Lib\InnerBrowser::dontSeeOptionIsSelected()
+ */
+ public function dontSeeOptionIsSelected($selector, $optionText) {
+ return $this->getScenario()->runStep(new \Codeception\Step\Assertion('dontSeeOptionIsSelected', func_get_args()));
+ }
+
+
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Asserts that current page has 404 response status code.
+ * Conditional Assertion: Test won't be stopped on fail
+ * @see \Codeception\Lib\InnerBrowser::seePageNotFound()
+ */
+ public function canSeePageNotFound() {
+ return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seePageNotFound', func_get_args()));
+ }
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Asserts that current page has 404 response status code.
+ * @see \Codeception\Lib\InnerBrowser::seePageNotFound()
+ */
+ public function seePageNotFound() {
+ return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seePageNotFound', func_get_args()));
+ }
+
+
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Checks that response code is equal to value provided.
+ *
+ * @param $code
+ *
+ * @return mixed
+ * Conditional Assertion: Test won't be stopped on fail
+ * @see \Codeception\Lib\InnerBrowser::seeResponseCodeIs()
+ */
+ public function canSeeResponseCodeIs($code) {
+ return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeResponseCodeIs', func_get_args()));
+ }
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Checks that response code is equal to value provided.
+ *
+ * @param $code
+ *
+ * @return mixed
+ * @see \Codeception\Lib\InnerBrowser::seeResponseCodeIs()
+ */
+ public function seeResponseCodeIs($code) {
+ return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeResponseCodeIs', func_get_args()));
+ }
+
+
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Checks that the page title contains the given string.
+ *
+ * ``` php
+ * seeInTitle('Blog - Post #1');
+ * ?>
+ * ```
+ *
+ * @param $title
+ *
+ * @return mixed
+ * Conditional Assertion: Test won't be stopped on fail
+ * @see \Codeception\Lib\InnerBrowser::seeInTitle()
+ */
+ public function canSeeInTitle($title) {
+ return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeInTitle', func_get_args()));
+ }
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Checks that the page title contains the given string.
+ *
+ * ``` php
+ * seeInTitle('Blog - Post #1');
+ * ?>
+ * ```
+ *
+ * @param $title
+ *
+ * @return mixed
+ * @see \Codeception\Lib\InnerBrowser::seeInTitle()
+ */
+ public function seeInTitle($title) {
+ return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeInTitle', func_get_args()));
+ }
+
+
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Checks that the page title does not contain the given string.
+ *
+ * @param $title
+ *
+ * @return mixed
+ * Conditional Assertion: Test won't be stopped on fail
+ * @see \Codeception\Lib\InnerBrowser::dontSeeInTitle()
+ */
+ public function cantSeeInTitle($title) {
+ return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeInTitle', func_get_args()));
+ }
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Checks that the page title does not contain the given string.
+ *
+ * @param $title
+ *
+ * @return mixed
+ * @see \Codeception\Lib\InnerBrowser::dontSeeInTitle()
+ */
+ public function dontSeeInTitle($title) {
+ return $this->getScenario()->runStep(new \Codeception\Step\Assertion('dontSeeInTitle', func_get_args()));
+ }
+}
diff --git a/tests/_support/_generated/FunctionalTesterActions.php b/tests/_support/_generated/FunctionalTesterActions.php
new file mode 100644
index 0000000000..293b5d56ef
--- /dev/null
+++ b/tests/_support/_generated/FunctionalTesterActions.php
@@ -0,0 +1,23 @@
+getScenario()->runStep(new \Codeception\Step\Action('getApplication', func_get_args()));
+ }
+
+
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Opens web page using route name and parameters.
+ *
+ * ``` php
+ * amOnRoute('posts.create');
+ * ?>
+ * ```
+ *
+ * @param $routeName
+ * @param array $params
+ * @see \Codeception\Module\Laravel5::amOnRoute()
+ */
+ public function amOnRoute($routeName, $params = null) {
+ return $this->getScenario()->runStep(new \Codeception\Step\Condition('amOnRoute', func_get_args()));
+ }
+
+
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Opens web page by action name
+ *
+ * ``` php
+ * amOnAction('PostsController@index');
+ * ?>
+ * ```
+ *
+ * @param $action
+ * @param array $params
+ * @see \Codeception\Module\Laravel5::amOnAction()
+ */
+ public function amOnAction($action, $params = null) {
+ return $this->getScenario()->runStep(new \Codeception\Step\Condition('amOnAction', func_get_args()));
+ }
+
+
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Checks that current url matches route
+ *
+ * ``` php
+ * seeCurrentRouteIs('posts.index');
+ * ?>
+ * ```
+ * @param $route
+ * @param array $params
+ * Conditional Assertion: Test won't be stopped on fail
+ * @see \Codeception\Module\Laravel5::seeCurrentRouteIs()
+ */
+ public function canSeeCurrentRouteIs($route, $params = null) {
+ return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeCurrentRouteIs', func_get_args()));
+ }
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Checks that current url matches route
+ *
+ * ``` php
+ * seeCurrentRouteIs('posts.index');
+ * ?>
+ * ```
+ * @param $route
+ * @param array $params
+ * @see \Codeception\Module\Laravel5::seeCurrentRouteIs()
+ */
+ public function seeCurrentRouteIs($route, $params = null) {
+ return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeCurrentRouteIs', func_get_args()));
+ }
+
+
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Checks that current url matches action
+ *
+ * ``` php
+ * seeCurrentActionIs('PostsController@index');
+ * ?>
+ * ```
+ *
+ * @param $action
+ * @param array $params
+ * Conditional Assertion: Test won't be stopped on fail
+ * @see \Codeception\Module\Laravel5::seeCurrentActionIs()
+ */
+ public function canSeeCurrentActionIs($action, $params = null) {
+ return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeCurrentActionIs', func_get_args()));
+ }
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Checks that current url matches action
+ *
+ * ``` php
+ * seeCurrentActionIs('PostsController@index');
+ * ?>
+ * ```
+ *
+ * @param $action
+ * @param array $params
+ * @see \Codeception\Module\Laravel5::seeCurrentActionIs()
+ */
+ public function seeCurrentActionIs($action, $params = null) {
+ return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeCurrentActionIs', func_get_args()));
+ }
+
+
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Assert that a session variable exists.
+ *
+ * ``` php
+ * seeInSession('key');
+ * $I->seeInSession('key', 'value');
+ * ?>
+ * ```
+ *
+ * @param string|array $key
+ * @param mixed $value
+ * @return void
+ * Conditional Assertion: Test won't be stopped on fail
+ * @see \Codeception\Module\Laravel5::seeInSession()
+ */
+ public function canSeeInSession($key, $value = null) {
+ return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeInSession', func_get_args()));
+ }
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Assert that a session variable exists.
+ *
+ * ``` php
+ * seeInSession('key');
+ * $I->seeInSession('key', 'value');
+ * ?>
+ * ```
+ *
+ * @param string|array $key
+ * @param mixed $value
+ * @return void
+ * @see \Codeception\Module\Laravel5::seeInSession()
+ */
+ public function seeInSession($key, $value = null) {
+ return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeInSession', func_get_args()));
+ }
+
+
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Assert that the session has a given list of values.
+ *
+ * ``` php
+ * seeSessionHasValues(['key1', 'key2']);
+ * $I->seeSessionHasValues(['key1' => 'value1', 'key2' => 'value2']);
+ * ?>
+ * ```
+ *
+ * @param array $bindings
+ * @return void
+ * Conditional Assertion: Test won't be stopped on fail
+ * @see \Codeception\Module\Laravel5::seeSessionHasValues()
+ */
+ public function canSeeSessionHasValues($bindings) {
+ return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeSessionHasValues', func_get_args()));
+ }
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Assert that the session has a given list of values.
+ *
+ * ``` php
+ * seeSessionHasValues(['key1', 'key2']);
+ * $I->seeSessionHasValues(['key1' => 'value1', 'key2' => 'value2']);
+ * ?>
+ * ```
+ *
+ * @param array $bindings
+ * @return void
+ * @see \Codeception\Module\Laravel5::seeSessionHasValues()
+ */
+ public function seeSessionHasValues($bindings) {
+ return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeSessionHasValues', func_get_args()));
+ }
+
+
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Assert that form errors are bound to the View.
+ *
+ * ``` php
+ * seeFormHasErrors();
+ * ?>
+ * ```
+ *
+ * @return bool
+ * Conditional Assertion: Test won't be stopped on fail
+ * @see \Codeception\Module\Laravel5::seeFormHasErrors()
+ */
+ public function canSeeFormHasErrors() {
+ return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeFormHasErrors', func_get_args()));
+ }
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Assert that form errors are bound to the View.
+ *
+ * ``` php
+ * seeFormHasErrors();
+ * ?>
+ * ```
+ *
+ * @return bool
+ * @see \Codeception\Module\Laravel5::seeFormHasErrors()
+ */
+ public function seeFormHasErrors() {
+ return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeFormHasErrors', func_get_args()));
+ }
+
+
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Assert that specific form error messages are set in the view.
+ *
+ * Useful for validation messages e.g.
+ * return `Redirect::to('register')->withErrors($validator);`
+ *
+ * Example of Usage
+ *
+ * ``` php
+ * seeFormErrorMessages(array('username'=>'Invalid Username'));
+ * ?>
+ * ```
+ * @param array $bindings
+ * Conditional Assertion: Test won't be stopped on fail
+ * @see \Codeception\Module\Laravel5::seeFormErrorMessages()
+ */
+ public function canSeeFormErrorMessages($bindings) {
+ return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeFormErrorMessages', func_get_args()));
+ }
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Assert that specific form error messages are set in the view.
+ *
+ * Useful for validation messages e.g.
+ * return `Redirect::to('register')->withErrors($validator);`
+ *
+ * Example of Usage
+ *
+ * ``` php
+ * seeFormErrorMessages(array('username'=>'Invalid Username'));
+ * ?>
+ * ```
+ * @param array $bindings
+ * @see \Codeception\Module\Laravel5::seeFormErrorMessages()
+ */
+ public function seeFormErrorMessages($bindings) {
+ return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeFormErrorMessages', func_get_args()));
+ }
+
+
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Assert that specific form error message is set in the view.
+ *
+ * Useful for validation messages and generally messages array
+ * e.g.
+ * return `Redirect::to('register')->withErrors($validator);`
+ *
+ * Example of Usage
+ *
+ * ``` php
+ * seeFormErrorMessage('username', 'Invalid Username');
+ * ?>
+ * ```
+ * @param string $key
+ * @param string $errorMessage
+ * Conditional Assertion: Test won't be stopped on fail
+ * @see \Codeception\Module\Laravel5::seeFormErrorMessage()
+ */
+ public function canSeeFormErrorMessage($key, $errorMessage) {
+ return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeFormErrorMessage', func_get_args()));
+ }
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Assert that specific form error message is set in the view.
+ *
+ * Useful for validation messages and generally messages array
+ * e.g.
+ * return `Redirect::to('register')->withErrors($validator);`
+ *
+ * Example of Usage
+ *
+ * ``` php
+ * seeFormErrorMessage('username', 'Invalid Username');
+ * ?>
+ * ```
+ * @param string $key
+ * @param string $errorMessage
+ * @see \Codeception\Module\Laravel5::seeFormErrorMessage()
+ */
+ public function seeFormErrorMessage($key, $errorMessage) {
+ return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeFormErrorMessage', func_get_args()));
+ }
+
+
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Set the currently logged in user for the application.
+ * Takes either an object that implements the User interface or
+ * an array of credentials.
+ *
+ * @param \Illuminate\Contracts\Auth\User|array $user
+ * @param string $driver
+ * @return void
+ * @see \Codeception\Module\Laravel5::amLoggedAs()
+ */
+ public function amLoggedAs($user, $driver = null) {
+ return $this->getScenario()->runStep(new \Codeception\Step\Condition('amLoggedAs', func_get_args()));
+ }
+
+
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Logs user out
+ * @see \Codeception\Module\Laravel5::logout()
+ */
+ public function logout() {
+ return $this->getScenario()->runStep(new \Codeception\Step\Action('logout', func_get_args()));
+ }
+
+
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Checks that user is authenticated
+ * Conditional Assertion: Test won't be stopped on fail
+ * @see \Codeception\Module\Laravel5::seeAuthentication()
+ */
+ public function canSeeAuthentication() {
+ return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeAuthentication', func_get_args()));
+ }
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Checks that user is authenticated
+ * @see \Codeception\Module\Laravel5::seeAuthentication()
+ */
+ public function seeAuthentication() {
+ return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeAuthentication', func_get_args()));
+ }
+
+
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Check that user is not authenticated
+ * Conditional Assertion: Test won't be stopped on fail
+ * @see \Codeception\Module\Laravel5::dontSeeAuthentication()
+ */
+ public function cantSeeAuthentication() {
+ return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeAuthentication', func_get_args()));
+ }
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Check that user is not authenticated
+ * @see \Codeception\Module\Laravel5::dontSeeAuthentication()
+ */
+ public function dontSeeAuthentication() {
+ return $this->getScenario()->runStep(new \Codeception\Step\Assertion('dontSeeAuthentication', func_get_args()));
+ }
+
+
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Return an instance of a class from the IoC Container.
+ * (http://laravel.com/docs/ioc)
+ *
+ * Example
+ * ``` php
+ * grabService('foo');
+ *
+ * // Will return an instance of FooBar, also works for singletons.
+ * ?>
+ * ```
+ *
+ * @param string $class
+ * @return mixed
+ * @see \Codeception\Module\Laravel5::grabService()
+ */
+ public function grabService($class) {
+ return $this->getScenario()->runStep(new \Codeception\Step\Action('grabService', func_get_args()));
+ }
+
+
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Inserts record into the database.
+ *
+ * ``` php
+ * haveRecord('users', array('name' => 'Davert'));
+ * ?>
+ * ```
+ *
+ * @param $tableName
+ * @param array $attributes
+ * @return mixed
+ * @part orm
+ * @see \Codeception\Module\Laravel5::haveRecord()
+ */
+ public function haveRecord($tableName, $attributes = null) {
+ return $this->getScenario()->runStep(new \Codeception\Step\Action('haveRecord', func_get_args()));
+ }
+
+
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Checks that record exists in database.
+ *
+ * ``` php
+ * seeRecord('users', array('name' => 'davert'));
+ * ?>
+ * ```
+ *
+ * @param $tableName
+ * @param array $attributes
+ * @part orm
+ * Conditional Assertion: Test won't be stopped on fail
+ * @see \Codeception\Module\Laravel5::seeRecord()
+ */
+ public function canSeeRecord($tableName, $attributes = null) {
+ return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeRecord', func_get_args()));
+ }
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Checks that record exists in database.
+ *
+ * ``` php
+ * seeRecord('users', array('name' => 'davert'));
+ * ?>
+ * ```
+ *
+ * @param $tableName
+ * @param array $attributes
+ * @part orm
+ * @see \Codeception\Module\Laravel5::seeRecord()
+ */
+ public function seeRecord($tableName, $attributes = null) {
+ return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeRecord', func_get_args()));
+ }
+
+
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Checks that record does not exist in database.
+ *
+ * ``` php
+ * dontSeeRecord('users', array('name' => 'davert'));
+ * ?>
+ * ```
+ *
+ * @param $tableName
+ * @param array $attributes
+ * Conditional Assertion: Test won't be stopped on fail
+ * @see \Codeception\Module\Laravel5::dontSeeRecord()
+ */
+ public function cantSeeRecord($tableName, $attributes = null) {
+ return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeRecord', func_get_args()));
+ }
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Checks that record does not exist in database.
+ *
+ * ``` php
+ * dontSeeRecord('users', array('name' => 'davert'));
+ * ?>
+ * ```
+ *
+ * @param $tableName
+ * @param array $attributes
+ * @see \Codeception\Module\Laravel5::dontSeeRecord()
+ */
+ public function dontSeeRecord($tableName, $attributes = null) {
+ return $this->getScenario()->runStep(new \Codeception\Step\Assertion('dontSeeRecord', func_get_args()));
+ }
+
+
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Retrieves record from database
+ *
+ * ``` php
+ * grabRecord('users', array('name' => 'davert'));
+ * ?>
+ * ```
+ *
+ * @param $tableName
+ * @param array $attributes
+ * @return mixed
+ * @part orm
+ * @see \Codeception\Module\Laravel5::grabRecord()
+ */
+ public function grabRecord($tableName, $attributes = null) {
+ return $this->getScenario()->runStep(new \Codeception\Step\Action('grabRecord', func_get_args()));
+ }
+
+
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Authenticates user for HTTP_AUTH
+ *
+ * @param $username
+ * @param $password
+ * @see \Codeception\Lib\InnerBrowser::amHttpAuthenticated()
+ */
+ public function amHttpAuthenticated($username, $password) {
+ return $this->getScenario()->runStep(new \Codeception\Step\Condition('amHttpAuthenticated', func_get_args()));
+ }
+
+
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Opens the page for the given relative URI.
+ *
+ * ``` php
+ * amOnPage('/');
+ * // opens /register page
+ * $I->amOnPage('/register');
+ * ?>
+ * ```
+ *
+ * @param $page
+ * @see \Codeception\Lib\InnerBrowser::amOnPage()
+ */
+ public function amOnPage($page) {
+ return $this->getScenario()->runStep(new \Codeception\Step\Condition('amOnPage', func_get_args()));
+ }
+
+
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Perform a click on a link or a button, given by a locator.
+ * If a fuzzy locator is given, the page will be searched for a button, link, or image matching the locator string.
+ * For buttons, the "value" attribute, "name" attribute, and inner text are searched.
+ * For links, the link text is searched.
+ * For images, the "alt" attribute and inner text of any parent links are searched.
+ *
+ * The second parameter is a context (CSS or XPath locator) to narrow the search.
+ *
+ * Note that if the locator matches a button of type `submit`, the form will be submitted.
+ *
+ * ``` php
+ * click('Logout');
+ * // button of form
+ * $I->click('Submit');
+ * // CSS button
+ * $I->click('#form input[type=submit]');
+ * // XPath
+ * $I->click('//form/*[@type=submit]');
+ * // link in context
+ * $I->click('Logout', '#nav');
+ * // using strict locator
+ * $I->click(['link' => 'Login']);
+ * ?>
+ * ```
+ *
+ * @param $link
+ * @param $context
+ * @see \Codeception\Lib\InnerBrowser::click()
+ */
+ public function click($link, $context = null) {
+ return $this->getScenario()->runStep(new \Codeception\Step\Action('click', func_get_args()));
+ }
+
+
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Checks that the current page contains the given string.
+ * Specify a locator as the second parameter to match a specific region.
+ *
+ * ``` php
+ * see('Logout'); // I can suppose user is logged in
+ * $I->see('Sign Up','h1'); // I can suppose it's a signup page
+ * $I->see('Sign Up','//body/h1'); // with XPath
+ * ?>
+ * ```
+ *
+ * @param $text
+ * @param null $selector
+ * Conditional Assertion: Test won't be stopped on fail
+ * @see \Codeception\Lib\InnerBrowser::see()
+ */
+ public function canSee($text, $selector = null) {
+ return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('see', func_get_args()));
+ }
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Checks that the current page contains the given string.
+ * Specify a locator as the second parameter to match a specific region.
+ *
+ * ``` php
+ * see('Logout'); // I can suppose user is logged in
+ * $I->see('Sign Up','h1'); // I can suppose it's a signup page
+ * $I->see('Sign Up','//body/h1'); // with XPath
+ * ?>
+ * ```
+ *
+ * @param $text
+ * @param null $selector
+ * @see \Codeception\Lib\InnerBrowser::see()
+ */
+ public function see($text, $selector = null) {
+ return $this->getScenario()->runStep(new \Codeception\Step\Assertion('see', func_get_args()));
+ }
+
+
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Checks that the current page doesn't contain the text specified.
+ * Give a locator as the second parameter to match a specific region.
+ *
+ * ```php
+ * dontSee('Login'); // I can suppose user is already logged in
+ * $I->dontSee('Sign Up','h1'); // I can suppose it's not a signup page
+ * $I->dontSee('Sign Up','//body/h1'); // with XPath
+ * ?>
+ * ```
+ *
+ * @param $text
+ * @param null $selector
+ * Conditional Assertion: Test won't be stopped on fail
+ * @see \Codeception\Lib\InnerBrowser::dontSee()
+ */
+ public function cantSee($text, $selector = null) {
+ return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('dontSee', func_get_args()));
+ }
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Checks that the current page doesn't contain the text specified.
+ * Give a locator as the second parameter to match a specific region.
+ *
+ * ```php
+ * dontSee('Login'); // I can suppose user is already logged in
+ * $I->dontSee('Sign Up','h1'); // I can suppose it's not a signup page
+ * $I->dontSee('Sign Up','//body/h1'); // with XPath
+ * ?>
+ * ```
+ *
+ * @param $text
+ * @param null $selector
+ * @see \Codeception\Lib\InnerBrowser::dontSee()
+ */
+ public function dontSee($text, $selector = null) {
+ return $this->getScenario()->runStep(new \Codeception\Step\Assertion('dontSee', func_get_args()));
+ }
+
+
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Checks that there's a link with the specified text.
+ * Give a full URL as the second parameter to match links with that exact URL.
+ *
+ * ``` php
+ * seeLink('Logout'); // matches Logout
+ * $I->seeLink('Logout','/logout'); // matches Logout
+ * ?>
+ * ```
+ *
+ * @param $text
+ * @param null $url
+ * Conditional Assertion: Test won't be stopped on fail
+ * @see \Codeception\Lib\InnerBrowser::seeLink()
+ */
+ public function canSeeLink($text, $url = null) {
+ return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeLink', func_get_args()));
+ }
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Checks that there's a link with the specified text.
+ * Give a full URL as the second parameter to match links with that exact URL.
+ *
+ * ``` php
+ * seeLink('Logout'); // matches Logout
+ * $I->seeLink('Logout','/logout'); // matches Logout
+ * ?>
+ * ```
+ *
+ * @param $text
+ * @param null $url
+ * @see \Codeception\Lib\InnerBrowser::seeLink()
+ */
+ public function seeLink($text, $url = null) {
+ return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeLink', func_get_args()));
+ }
+
+
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Checks that the page doesn't contain a link with the given string.
+ * If the second parameter is given, only links with a matching "href" attribute will be checked.
+ *
+ * ``` php
+ * dontSeeLink('Logout'); // I suppose user is not logged in
+ * $I->dontSeeLink('Checkout now', '/store/cart.php');
+ * ?>
+ * ```
+ *
+ * @param $text
+ * @param null $url
+ * Conditional Assertion: Test won't be stopped on fail
+ * @see \Codeception\Lib\InnerBrowser::dontSeeLink()
+ */
+ public function cantSeeLink($text, $url = null) {
+ return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeLink', func_get_args()));
+ }
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Checks that the page doesn't contain a link with the given string.
+ * If the second parameter is given, only links with a matching "href" attribute will be checked.
+ *
+ * ``` php
+ * dontSeeLink('Logout'); // I suppose user is not logged in
+ * $I->dontSeeLink('Checkout now', '/store/cart.php');
+ * ?>
+ * ```
+ *
+ * @param $text
+ * @param null $url
+ * @see \Codeception\Lib\InnerBrowser::dontSeeLink()
+ */
+ public function dontSeeLink($text, $url = null) {
+ return $this->getScenario()->runStep(new \Codeception\Step\Assertion('dontSeeLink', func_get_args()));
+ }
+
+
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Checks that current URI contains the given string.
+ *
+ * ``` php
+ * seeInCurrentUrl('home');
+ * // to match: /users/1
+ * $I->seeInCurrentUrl('/users/');
+ * ?>
+ * ```
+ *
+ * @param $uri
+ * Conditional Assertion: Test won't be stopped on fail
+ * @see \Codeception\Lib\InnerBrowser::seeInCurrentUrl()
+ */
+ public function canSeeInCurrentUrl($uri) {
+ return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeInCurrentUrl', func_get_args()));
+ }
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Checks that current URI contains the given string.
+ *
+ * ``` php
+ * seeInCurrentUrl('home');
+ * // to match: /users/1
+ * $I->seeInCurrentUrl('/users/');
+ * ?>
+ * ```
+ *
+ * @param $uri
+ * @see \Codeception\Lib\InnerBrowser::seeInCurrentUrl()
+ */
+ public function seeInCurrentUrl($uri) {
+ return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeInCurrentUrl', func_get_args()));
+ }
+
+
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Checks that the current URI doesn't contain the given string.
+ *
+ * ``` php
+ * dontSeeInCurrentUrl('/users/');
+ * ?>
+ * ```
+ *
+ * @param $uri
+ * Conditional Assertion: Test won't be stopped on fail
+ * @see \Codeception\Lib\InnerBrowser::dontSeeInCurrentUrl()
+ */
+ public function cantSeeInCurrentUrl($uri) {
+ return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeInCurrentUrl', func_get_args()));
+ }
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Checks that the current URI doesn't contain the given string.
+ *
+ * ``` php
+ * dontSeeInCurrentUrl('/users/');
+ * ?>
+ * ```
+ *
+ * @param $uri
+ * @see \Codeception\Lib\InnerBrowser::dontSeeInCurrentUrl()
+ */
+ public function dontSeeInCurrentUrl($uri) {
+ return $this->getScenario()->runStep(new \Codeception\Step\Assertion('dontSeeInCurrentUrl', func_get_args()));
+ }
+
+
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Checks that the current URL is equal to the given string.
+ * Unlike `seeInCurrentUrl`, this only matches the full URL.
+ *
+ * ``` php
+ * seeCurrentUrlEquals('/');
+ * ?>
+ * ```
+ *
+ * @param $uri
+ * Conditional Assertion: Test won't be stopped on fail
+ * @see \Codeception\Lib\InnerBrowser::seeCurrentUrlEquals()
+ */
+ public function canSeeCurrentUrlEquals($uri) {
+ return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeCurrentUrlEquals', func_get_args()));
+ }
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Checks that the current URL is equal to the given string.
+ * Unlike `seeInCurrentUrl`, this only matches the full URL.
+ *
+ * ``` php
+ * seeCurrentUrlEquals('/');
+ * ?>
+ * ```
+ *
+ * @param $uri
+ * @see \Codeception\Lib\InnerBrowser::seeCurrentUrlEquals()
+ */
+ public function seeCurrentUrlEquals($uri) {
+ return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeCurrentUrlEquals', func_get_args()));
+ }
+
+
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Checks that the current URL doesn't equal the given string.
+ * Unlike `dontSeeInCurrentUrl`, this only matches the full URL.
+ *
+ * ``` php
+ * dontSeeCurrentUrlEquals('/');
+ * ?>
+ * ```
+ *
+ * @param $uri
+ * Conditional Assertion: Test won't be stopped on fail
+ * @see \Codeception\Lib\InnerBrowser::dontSeeCurrentUrlEquals()
+ */
+ public function cantSeeCurrentUrlEquals($uri) {
+ return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeCurrentUrlEquals', func_get_args()));
+ }
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Checks that the current URL doesn't equal the given string.
+ * Unlike `dontSeeInCurrentUrl`, this only matches the full URL.
+ *
+ * ``` php
+ * dontSeeCurrentUrlEquals('/');
+ * ?>
+ * ```
+ *
+ * @param $uri
+ * @see \Codeception\Lib\InnerBrowser::dontSeeCurrentUrlEquals()
+ */
+ public function dontSeeCurrentUrlEquals($uri) {
+ return $this->getScenario()->runStep(new \Codeception\Step\Assertion('dontSeeCurrentUrlEquals', func_get_args()));
+ }
+
+
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Checks that the current URL matches the given regular expression.
+ *
+ * ``` php
+ * seeCurrentUrlMatches('~$/users/(\d+)~');
+ * ?>
+ * ```
+ *
+ * @param $uri
+ * Conditional Assertion: Test won't be stopped on fail
+ * @see \Codeception\Lib\InnerBrowser::seeCurrentUrlMatches()
+ */
+ public function canSeeCurrentUrlMatches($uri) {
+ return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeCurrentUrlMatches', func_get_args()));
+ }
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Checks that the current URL matches the given regular expression.
+ *
+ * ``` php
+ * seeCurrentUrlMatches('~$/users/(\d+)~');
+ * ?>
+ * ```
+ *
+ * @param $uri
+ * @see \Codeception\Lib\InnerBrowser::seeCurrentUrlMatches()
+ */
+ public function seeCurrentUrlMatches($uri) {
+ return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeCurrentUrlMatches', func_get_args()));
+ }
+
+
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Checks that current url doesn't match the given regular expression.
+ *
+ * ``` php
+ * dontSeeCurrentUrlMatches('~$/users/(\d+)~');
+ * ?>
+ * ```
+ *
+ * @param $uri
+ * Conditional Assertion: Test won't be stopped on fail
+ * @see \Codeception\Lib\InnerBrowser::dontSeeCurrentUrlMatches()
+ */
+ public function cantSeeCurrentUrlMatches($uri) {
+ return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeCurrentUrlMatches', func_get_args()));
+ }
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Checks that current url doesn't match the given regular expression.
+ *
+ * ``` php
+ * dontSeeCurrentUrlMatches('~$/users/(\d+)~');
+ * ?>
+ * ```
+ *
+ * @param $uri
+ * @see \Codeception\Lib\InnerBrowser::dontSeeCurrentUrlMatches()
+ */
+ public function dontSeeCurrentUrlMatches($uri) {
+ return $this->getScenario()->runStep(new \Codeception\Step\Assertion('dontSeeCurrentUrlMatches', func_get_args()));
+ }
+
+
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Executes the given regular expression against the current URI and returns the first match.
+ * If no parameters are provided, the full URI is returned.
+ *
+ * ``` php
+ * grabFromCurrentUrl('~$/user/(\d+)/~');
+ * $uri = $I->grabFromCurrentUrl();
+ * ?>
+ * ```
+ *
+ * @param null $uri
+ *
+ * @internal param $url
+ * @return mixed
+ * @see \Codeception\Lib\InnerBrowser::grabFromCurrentUrl()
+ */
+ public function grabFromCurrentUrl($uri = null) {
+ return $this->getScenario()->runStep(new \Codeception\Step\Action('grabFromCurrentUrl', func_get_args()));
+ }
+
+
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Checks that the specified checkbox is checked.
+ *
+ * ``` php
+ * seeCheckboxIsChecked('#agree'); // I suppose user agreed to terms
+ * $I->seeCheckboxIsChecked('#signup_form input[type=checkbox]'); // I suppose user agreed to terms, If there is only one checkbox in form.
+ * $I->seeCheckboxIsChecked('//form/input[@type=checkbox and @name=agree]');
+ * ?>
+ * ```
+ *
+ * @param $checkbox
+ * Conditional Assertion: Test won't be stopped on fail
+ * @see \Codeception\Lib\InnerBrowser::seeCheckboxIsChecked()
+ */
+ public function canSeeCheckboxIsChecked($checkbox) {
+ return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeCheckboxIsChecked', func_get_args()));
+ }
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Checks that the specified checkbox is checked.
+ *
+ * ``` php
+ * seeCheckboxIsChecked('#agree'); // I suppose user agreed to terms
+ * $I->seeCheckboxIsChecked('#signup_form input[type=checkbox]'); // I suppose user agreed to terms, If there is only one checkbox in form.
+ * $I->seeCheckboxIsChecked('//form/input[@type=checkbox and @name=agree]');
+ * ?>
+ * ```
+ *
+ * @param $checkbox
+ * @see \Codeception\Lib\InnerBrowser::seeCheckboxIsChecked()
+ */
+ public function seeCheckboxIsChecked($checkbox) {
+ return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeCheckboxIsChecked', func_get_args()));
+ }
+
+
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Check that the specified checkbox is unchecked.
+ *
+ * ``` php
+ * dontSeeCheckboxIsChecked('#agree'); // I suppose user didn't agree to terms
+ * $I->seeCheckboxIsChecked('#signup_form input[type=checkbox]'); // I suppose user didn't check the first checkbox in form.
+ * ?>
+ * ```
+ *
+ * @param $checkbox
+ * Conditional Assertion: Test won't be stopped on fail
+ * @see \Codeception\Lib\InnerBrowser::dontSeeCheckboxIsChecked()
+ */
+ public function cantSeeCheckboxIsChecked($checkbox) {
+ return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeCheckboxIsChecked', func_get_args()));
+ }
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Check that the specified checkbox is unchecked.
+ *
+ * ``` php
+ * dontSeeCheckboxIsChecked('#agree'); // I suppose user didn't agree to terms
+ * $I->seeCheckboxIsChecked('#signup_form input[type=checkbox]'); // I suppose user didn't check the first checkbox in form.
+ * ?>
+ * ```
+ *
+ * @param $checkbox
+ * @see \Codeception\Lib\InnerBrowser::dontSeeCheckboxIsChecked()
+ */
+ public function dontSeeCheckboxIsChecked($checkbox) {
+ return $this->getScenario()->runStep(new \Codeception\Step\Assertion('dontSeeCheckboxIsChecked', func_get_args()));
+ }
+
+
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Checks that the given input field or textarea contains the given value.
+ * For fuzzy locators, fields are matched by label text, the "name" attribute, CSS, and XPath.
+ *
+ * ``` php
+ * seeInField('Body','Type your comment here');
+ * $I->seeInField('form textarea[name=body]','Type your comment here');
+ * $I->seeInField('form input[type=hidden]','hidden_value');
+ * $I->seeInField('#searchform input','Search');
+ * $I->seeInField('//form/*[@name=search]','Search');
+ * $I->seeInField(['name' => 'search'], 'Search');
+ * ?>
+ * ```
+ *
+ * @param $field
+ * @param $value
+ * Conditional Assertion: Test won't be stopped on fail
+ * @see \Codeception\Lib\InnerBrowser::seeInField()
+ */
+ public function canSeeInField($field, $value) {
+ return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeInField', func_get_args()));
+ }
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Checks that the given input field or textarea contains the given value.
+ * For fuzzy locators, fields are matched by label text, the "name" attribute, CSS, and XPath.
+ *
+ * ``` php
+ * seeInField('Body','Type your comment here');
+ * $I->seeInField('form textarea[name=body]','Type your comment here');
+ * $I->seeInField('form input[type=hidden]','hidden_value');
+ * $I->seeInField('#searchform input','Search');
+ * $I->seeInField('//form/*[@name=search]','Search');
+ * $I->seeInField(['name' => 'search'], 'Search');
+ * ?>
+ * ```
+ *
+ * @param $field
+ * @param $value
+ * @see \Codeception\Lib\InnerBrowser::seeInField()
+ */
+ public function seeInField($field, $value) {
+ return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeInField', func_get_args()));
+ }
+
+
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Checks that an input field or textarea doesn't contain the given value.
+ * For fuzzy locators, the field is matched by label text, CSS and XPath.
+ *
+ * ``` php
+ * dontSeeInField('Body','Type your comment here');
+ * $I->dontSeeInField('form textarea[name=body]','Type your comment here');
+ * $I->dontSeeInField('form input[type=hidden]','hidden_value');
+ * $I->dontSeeInField('#searchform input','Search');
+ * $I->dontSeeInField('//form/*[@name=search]','Search');
+ * $I->dontSeeInField(['name' => 'search'], 'Search');
+ * ?>
+ * ```
+ *
+ * @param $field
+ * @param $value
+ * Conditional Assertion: Test won't be stopped on fail
+ * @see \Codeception\Lib\InnerBrowser::dontSeeInField()
+ */
+ public function cantSeeInField($field, $value) {
+ return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeInField', func_get_args()));
+ }
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Checks that an input field or textarea doesn't contain the given value.
+ * For fuzzy locators, the field is matched by label text, CSS and XPath.
+ *
+ * ``` php
+ * dontSeeInField('Body','Type your comment here');
+ * $I->dontSeeInField('form textarea[name=body]','Type your comment here');
+ * $I->dontSeeInField('form input[type=hidden]','hidden_value');
+ * $I->dontSeeInField('#searchform input','Search');
+ * $I->dontSeeInField('//form/*[@name=search]','Search');
+ * $I->dontSeeInField(['name' => 'search'], 'Search');
+ * ?>
+ * ```
+ *
+ * @param $field
+ * @param $value
+ * @see \Codeception\Lib\InnerBrowser::dontSeeInField()
+ */
+ public function dontSeeInField($field, $value) {
+ return $this->getScenario()->runStep(new \Codeception\Step\Assertion('dontSeeInField', func_get_args()));
+ }
+
+
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Checks if the array of form parameters (name => value) are set on the form matched with the
+ * passed selector.
+ *
+ * ``` php
+ * seeInFormFields('form[name=myform]', [
+ * 'input1' => 'value',
+ * 'input2' => 'other value',
+ * ]);
+ * ?>
+ * ```
+ *
+ * For multi-select elements, or to check values of multiple elements with the same name, an
+ * array may be passed:
+ *
+ * ``` php
+ * seeInFormFields('.form-class', [
+ * 'multiselect' => [
+ * 'value1',
+ * 'value2',
+ * ],
+ * 'checkbox[]' => [
+ * 'a checked value',
+ * 'another checked value',
+ * ],
+ * ]);
+ * ?>
+ * ```
+ *
+ * Additionally, checkbox values can be checked with a boolean.
+ *
+ * ``` php
+ * seeInFormFields('#form-id', [
+ * 'checkbox1' => true, // passes if checked
+ * 'checkbox2' => false, // passes if unchecked
+ * ]);
+ * ?>
+ * ```
+ *
+ * Pair this with submitForm for quick testing magic.
+ *
+ * ``` php
+ * 'value',
+ * 'field2' => 'another value',
+ * 'checkbox1' => true,
+ * // ...
+ * ];
+ * $I->submitForm('//form[@id=my-form]', $form, 'submitButton');
+ * // $I->amOnPage('/path/to/form-page') may be needed
+ * $I->seeInFormFields('//form[@id=my-form]', $form);
+ * ?>
+ * ```
+ *
+ * @param $formSelector
+ * @param $params
+ * Conditional Assertion: Test won't be stopped on fail
+ * @see \Codeception\Lib\InnerBrowser::seeInFormFields()
+ */
+ public function canSeeInFormFields($formSelector, $params) {
+ return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeInFormFields', func_get_args()));
+ }
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Checks if the array of form parameters (name => value) are set on the form matched with the
+ * passed selector.
+ *
+ * ``` php
+ * seeInFormFields('form[name=myform]', [
+ * 'input1' => 'value',
+ * 'input2' => 'other value',
+ * ]);
+ * ?>
+ * ```
+ *
+ * For multi-select elements, or to check values of multiple elements with the same name, an
+ * array may be passed:
+ *
+ * ``` php
+ * seeInFormFields('.form-class', [
+ * 'multiselect' => [
+ * 'value1',
+ * 'value2',
+ * ],
+ * 'checkbox[]' => [
+ * 'a checked value',
+ * 'another checked value',
+ * ],
+ * ]);
+ * ?>
+ * ```
+ *
+ * Additionally, checkbox values can be checked with a boolean.
+ *
+ * ``` php
+ * seeInFormFields('#form-id', [
+ * 'checkbox1' => true, // passes if checked
+ * 'checkbox2' => false, // passes if unchecked
+ * ]);
+ * ?>
+ * ```
+ *
+ * Pair this with submitForm for quick testing magic.
+ *
+ * ``` php
+ * 'value',
+ * 'field2' => 'another value',
+ * 'checkbox1' => true,
+ * // ...
+ * ];
+ * $I->submitForm('//form[@id=my-form]', $form, 'submitButton');
+ * // $I->amOnPage('/path/to/form-page') may be needed
+ * $I->seeInFormFields('//form[@id=my-form]', $form);
+ * ?>
+ * ```
+ *
+ * @param $formSelector
+ * @param $params
+ * @see \Codeception\Lib\InnerBrowser::seeInFormFields()
+ */
+ public function seeInFormFields($formSelector, $params) {
+ return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeInFormFields', func_get_args()));
+ }
+
+
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Checks if the array of form parameters (name => value) are not set on the form matched with
+ * the passed selector.
+ *
+ * ``` php
+ * dontSeeInFormFields('form[name=myform]', [
+ * 'input1' => 'non-existent value',
+ * 'input2' => 'other non-existent value',
+ * ]);
+ * ?>
+ * ```
+ *
+ * To check that an element hasn't been assigned any one of many values, an array can be passed
+ * as the value:
+ *
+ * ``` php
+ * dontSeeInFormFields('.form-class', [
+ * 'fieldName' => [
+ * 'This value shouldn\'t be set',
+ * 'And this value shouldn\'t be set',
+ * ],
+ * ]);
+ * ?>
+ * ```
+ *
+ * Additionally, checkbox values can be checked with a boolean.
+ *
+ * ``` php
+ * dontSeeInFormFields('#form-id', [
+ * 'checkbox1' => true, // fails if checked
+ * 'checkbox2' => false, // fails if unchecked
+ * ]);
+ * ?>
+ * ```
+ *
+ * @param $formSelector
+ * @param $params
+ * Conditional Assertion: Test won't be stopped on fail
+ * @see \Codeception\Lib\InnerBrowser::dontSeeInFormFields()
+ */
+ public function cantSeeInFormFields($formSelector, $params) {
+ return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeInFormFields', func_get_args()));
+ }
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Checks if the array of form parameters (name => value) are not set on the form matched with
+ * the passed selector.
+ *
+ * ``` php
+ * dontSeeInFormFields('form[name=myform]', [
+ * 'input1' => 'non-existent value',
+ * 'input2' => 'other non-existent value',
+ * ]);
+ * ?>
+ * ```
+ *
+ * To check that an element hasn't been assigned any one of many values, an array can be passed
+ * as the value:
+ *
+ * ``` php
+ * dontSeeInFormFields('.form-class', [
+ * 'fieldName' => [
+ * 'This value shouldn\'t be set',
+ * 'And this value shouldn\'t be set',
+ * ],
+ * ]);
+ * ?>
+ * ```
+ *
+ * Additionally, checkbox values can be checked with a boolean.
+ *
+ * ``` php
+ * dontSeeInFormFields('#form-id', [
+ * 'checkbox1' => true, // fails if checked
+ * 'checkbox2' => false, // fails if unchecked
+ * ]);
+ * ?>
+ * ```
+ *
+ * @param $formSelector
+ * @param $params
+ * @see \Codeception\Lib\InnerBrowser::dontSeeInFormFields()
+ */
+ public function dontSeeInFormFields($formSelector, $params) {
+ return $this->getScenario()->runStep(new \Codeception\Step\Assertion('dontSeeInFormFields', func_get_args()));
+ }
+
+
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Submits the given form on the page, optionally with the given form
+ * values. Give the form fields values as an array.
+ *
+ * Skipped fields will be filled by their values from the page.
+ * You don't need to click the 'Submit' button afterwards.
+ * This command itself triggers the request to form's action.
+ *
+ * You can optionally specify what button's value to include
+ * in the request with the last parameter as an alternative to
+ * explicitly setting its value in the second parameter, as
+ * button values are not otherwise included in the request.
+ *
+ * Examples:
+ *
+ * ``` php
+ * submitForm('#login', [
+ * 'login' => 'davert',
+ * 'password' => '123456'
+ * ]);
+ * // or
+ * $I->submitForm('#login', [
+ * 'login' => 'davert',
+ * 'password' => '123456'
+ * ], 'submitButtonName');
+ *
+ * ```
+ *
+ * For example, given this sample "Sign Up" form:
+ *
+ * ``` html
+ *
+ * ```
+ *
+ * You could write the following to submit it:
+ *
+ * ``` php
+ * submitForm(
+ * '#userForm',
+ * [
+ * 'user' => [
+ * 'login' => 'Davert',
+ * 'password' => '123456',
+ * 'agree' => true
+ * ]
+ * ],
+ * 'submitButton'
+ * );
+ * ```
+ * Note that "2" will be the submitted value for the "plan" field, as it is
+ * the selected option.
+ *
+ * You can also emulate a JavaScript submission by not specifying any
+ * buttons in the third parameter to submitForm.
+ *
+ * ```php
+ * submitForm(
+ * '#userForm',
+ * [
+ * 'user' => [
+ * 'login' => 'Davert',
+ * 'password' => '123456',
+ * 'agree' => true
+ * ]
+ * ]
+ * );
+ * ```
+ *
+ * Pair this with seeInFormFields for quick testing magic.
+ *
+ * ``` php
+ * 'value',
+ * 'field2' => 'another value',
+ * 'checkbox1' => true,
+ * // ...
+ * ];
+ * $I->submitForm('//form[@id=my-form]', $form, 'submitButton');
+ * // $I->amOnPage('/path/to/form-page') may be needed
+ * $I->seeInFormFields('//form[@id=my-form]', $form);
+ * ?>
+ * ```
+ *
+ * Parameter values can be set to arrays for multiple input fields
+ * of the same name, or multi-select combo boxes. For checkboxes,
+ * either the string value can be used, or boolean values which will
+ * be replaced by the checkbox's value in the DOM.
+ *
+ * ``` php
+ * submitForm('#my-form', [
+ * 'field1' => 'value',
+ * 'checkbox' => [
+ * 'value of first checkbox',
+ * 'value of second checkbox,
+ * ],
+ * 'otherCheckboxes' => [
+ * true,
+ * false,
+ * false
+ * ],
+ * 'multiselect' => [
+ * 'first option value',
+ * 'second option value'
+ * ]
+ * ]);
+ * ?>
+ * ```
+ *
+ * Mixing string and boolean values for a checkbox's value is not supported
+ * and may produce unexpected results.
+ *
+ * Field names ending in "[]" must be passed without the trailing square
+ * bracket characters, and must contain an array for its value. This allows
+ * submitting multiple values with the same name, consider:
+ *
+ * ```php
+ * $I->submitForm('#my-form', [
+ * 'field[]' => 'value',
+ * 'field[]' => 'another value', // 'field[]' is already a defined key
+ * ]);
+ * ```
+ *
+ * The solution is to pass an array value:
+ *
+ * ```php
+ * // this way both values are submitted
+ * $I->submitForm('#my-form', [
+ * 'field' => [
+ * 'value',
+ * 'another value',
+ * ]
+ * ]);
+ * ```
+ *
+ * @param $selector
+ * @param $params
+ * @param $button
+ * @see \Codeception\Lib\InnerBrowser::submitForm()
+ */
+ public function submitForm($selector, $params, $button = null) {
+ return $this->getScenario()->runStep(new \Codeception\Step\Action('submitForm', func_get_args()));
+ }
+
+
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Fills a text field or textarea with the given string.
+ *
+ * ``` php
+ * fillField("//input[@type='text']", "Hello World!");
+ * $I->fillField(['name' => 'email'], 'jon@mail.com');
+ * ?>
+ * ```
+ *
+ * @param $field
+ * @param $value
+ * @see \Codeception\Lib\InnerBrowser::fillField()
+ */
+ public function fillField($field, $value) {
+ return $this->getScenario()->runStep(new \Codeception\Step\Action('fillField', func_get_args()));
+ }
+
+
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Selects an option in a select tag or in radio button group.
+ *
+ * ``` php
+ * selectOption('form select[name=account]', 'Premium');
+ * $I->selectOption('form input[name=payment]', 'Monthly');
+ * $I->selectOption('//form/select[@name=account]', 'Monthly');
+ * ?>
+ * ```
+ *
+ * Provide an array for the second argument to select multiple options:
+ *
+ * ``` php
+ * selectOption('Which OS do you use?', array('Windows','Linux'));
+ * ?>
+ * ```
+ *
+ * @param $select
+ * @param $option
+ * @see \Codeception\Lib\InnerBrowser::selectOption()
+ */
+ public function selectOption($select, $option) {
+ return $this->getScenario()->runStep(new \Codeception\Step\Action('selectOption', func_get_args()));
+ }
+
+
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Ticks a checkbox. For radio buttons, use the `selectOption` method instead.
+ *
+ * ``` php
+ * checkOption('#agree');
+ * ?>
+ * ```
+ *
+ * @param $option
+ * @see \Codeception\Lib\InnerBrowser::checkOption()
+ */
+ public function checkOption($option) {
+ return $this->getScenario()->runStep(new \Codeception\Step\Action('checkOption', func_get_args()));
+ }
+
+
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Unticks a checkbox.
+ *
+ * ``` php
+ * uncheckOption('#notify');
+ * ?>
+ * ```
+ *
+ * @param $option
+ * @see \Codeception\Lib\InnerBrowser::uncheckOption()
+ */
+ public function uncheckOption($option) {
+ return $this->getScenario()->runStep(new \Codeception\Step\Action('uncheckOption', func_get_args()));
+ }
+
+
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Attaches a file relative to the Codeception data directory to the given file upload field.
+ *
+ * ``` php
+ * attachFile('input[@type="file"]', 'prices.xls');
+ * ?>
+ * ```
+ *
+ * @param $field
+ * @param $filename
+ * @see \Codeception\Lib\InnerBrowser::attachFile()
+ */
+ public function attachFile($field, $filename) {
+ return $this->getScenario()->runStep(new \Codeception\Step\Action('attachFile', func_get_args()));
+ }
+
+
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * If your page triggers an ajax request, you can perform it manually.
+ * This action sends a GET ajax request with specified params.
+ *
+ * See ->sendAjaxPostRequest for examples.
+ *
+ * @param $uri
+ * @param $params
+ * @see \Codeception\Lib\InnerBrowser::sendAjaxGetRequest()
+ */
+ public function sendAjaxGetRequest($uri, $params = null) {
+ return $this->getScenario()->runStep(new \Codeception\Step\Action('sendAjaxGetRequest', func_get_args()));
+ }
+
+
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * If your page triggers an ajax request, you can perform it manually.
+ * This action sends a POST ajax request with specified params.
+ * Additional params can be passed as array.
+ *
+ * Example:
+ *
+ * Imagine that by clicking checkbox you trigger ajax request which updates user settings.
+ * We emulate that click by running this ajax request manually.
+ *
+ * ``` php
+ * sendAjaxPostRequest('/updateSettings', array('notifications' => true)); // POST
+ * $I->sendAjaxGetRequest('/updateSettings', array('notifications' => true)); // GET
+ *
+ * ```
+ *
+ * @param $uri
+ * @param $params
+ * @see \Codeception\Lib\InnerBrowser::sendAjaxPostRequest()
+ */
+ public function sendAjaxPostRequest($uri, $params = null) {
+ return $this->getScenario()->runStep(new \Codeception\Step\Action('sendAjaxPostRequest', func_get_args()));
+ }
+
+
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * If your page triggers an ajax request, you can perform it manually.
+ * This action sends an ajax request with specified method and params.
+ *
+ * Example:
+ *
+ * You need to perform an ajax request specifying the HTTP method.
+ *
+ * ``` php
+ * sendAjaxRequest('PUT', '/posts/7', array('title' => 'new title'));
+ *
+ * ```
+ *
+ * @param $method
+ * @param $uri
+ * @param $params
+ * @see \Codeception\Lib\InnerBrowser::sendAjaxRequest()
+ */
+ public function sendAjaxRequest($method, $uri, $params = null) {
+ return $this->getScenario()->runStep(new \Codeception\Step\Action('sendAjaxRequest', func_get_args()));
+ }
+
+
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Finds and returns the text contents of the given element.
+ * If a fuzzy locator is used, the element is found using CSS, XPath, and by matching the full page source by regular expression.
+ *
+ * ``` php
+ * grabTextFrom('h1');
+ * $heading = $I->grabTextFrom('descendant-or-self::h1');
+ * $value = $I->grabTextFrom('~
+ * ```
+ *
+ * @param $cssOrXPathOrRegex
+ *
+ * @return mixed
+ * @see \Codeception\Lib\InnerBrowser::grabTextFrom()
+ */
+ public function grabTextFrom($cssOrXPathOrRegex) {
+ return $this->getScenario()->runStep(new \Codeception\Step\Action('grabTextFrom', func_get_args()));
+ }
+
+
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Grabs the value of the given attribute value from the given element.
+ * Fails if element is not found.
+ *
+ * ``` php
+ * grabAttributeFrom('#tooltip', 'title');
+ * ?>
+ * ```
+ *
+ *
+ * @param $cssOrXpath
+ * @param $attribute
+ * @internal param $element
+ * @return mixed
+ * @see \Codeception\Lib\InnerBrowser::grabAttributeFrom()
+ */
+ public function grabAttributeFrom($cssOrXpath, $attribute) {
+ return $this->getScenario()->runStep(new \Codeception\Step\Action('grabAttributeFrom', func_get_args()));
+ }
+
+
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ *
+ * @see \Codeception\Lib\InnerBrowser::grabMultiple()
+ */
+ public function grabMultiple($cssOrXpath, $attribute = null) {
+ return $this->getScenario()->runStep(new \Codeception\Step\Action('grabMultiple', func_get_args()));
+ }
+
+
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * @param $field
+ *
+ * @return array|mixed|null|string
+ * @see \Codeception\Lib\InnerBrowser::grabValueFrom()
+ */
+ public function grabValueFrom($field) {
+ return $this->getScenario()->runStep(new \Codeception\Step\Action('grabValueFrom', func_get_args()));
+ }
+
+
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Sets a cookie with the given name and value.
+ * You can set additional cookie params like `domain`, `path`, `expire`, `secure` in array passed as last argument.
+ *
+ * ``` php
+ * setCookie('PHPSESSID', 'el4ukv0kqbvoirg7nkp4dncpk3');
+ * ?>
+ * ```
+ *
+ * @param $name
+ * @param $val
+ * @param array $params
+ *
+ * @return mixed
+ * @see \Codeception\Lib\InnerBrowser::setCookie()
+ */
+ public function setCookie($name, $val, $params = null) {
+ return $this->getScenario()->runStep(new \Codeception\Step\Action('setCookie', func_get_args()));
+ }
+
+
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Grabs a cookie value.
+ * You can set additional cookie params like `domain`, `path` in array passed as last argument.
+ *
+ * @param $cookie
+ *
+ * @param array $params
+ * @return mixed
+ * @see \Codeception\Lib\InnerBrowser::grabCookie()
+ */
+ public function grabCookie($cookie, $params = null) {
+ return $this->getScenario()->runStep(new \Codeception\Step\Action('grabCookie', func_get_args()));
+ }
+
+
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Checks that a cookie with the given name is set.
+ * You can set additional cookie params like `domain`, `path` as array passed in last argument.
+ *
+ * ``` php
+ * seeCookie('PHPSESSID');
+ * ?>
+ * ```
+ *
+ * @param $cookie
+ * @param array $params
+ * @return mixed
+ * Conditional Assertion: Test won't be stopped on fail
+ * @see \Codeception\Lib\InnerBrowser::seeCookie()
+ */
+ public function canSeeCookie($cookie, $params = null) {
+ return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeCookie', func_get_args()));
+ }
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Checks that a cookie with the given name is set.
+ * You can set additional cookie params like `domain`, `path` as array passed in last argument.
+ *
+ * ``` php
+ * seeCookie('PHPSESSID');
+ * ?>
+ * ```
+ *
+ * @param $cookie
+ * @param array $params
+ * @return mixed
+ * @see \Codeception\Lib\InnerBrowser::seeCookie()
+ */
+ public function seeCookie($cookie, $params = null) {
+ return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeCookie', func_get_args()));
+ }
+
+
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Checks that there isn't a cookie with the given name.
+ * You can set additional cookie params like `domain`, `path` as array passed in last argument.
+ *
+ * @param $cookie
+ *
+ * @param array $params
+ * @return mixed
+ * Conditional Assertion: Test won't be stopped on fail
+ * @see \Codeception\Lib\InnerBrowser::dontSeeCookie()
+ */
+ public function cantSeeCookie($cookie, $params = null) {
+ return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeCookie', func_get_args()));
+ }
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Checks that there isn't a cookie with the given name.
+ * You can set additional cookie params like `domain`, `path` as array passed in last argument.
+ *
+ * @param $cookie
+ *
+ * @param array $params
+ * @return mixed
+ * @see \Codeception\Lib\InnerBrowser::dontSeeCookie()
+ */
+ public function dontSeeCookie($cookie, $params = null) {
+ return $this->getScenario()->runStep(new \Codeception\Step\Assertion('dontSeeCookie', func_get_args()));
+ }
+
+
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Unsets cookie with the given name.
+ * You can set additional cookie params like `domain`, `path` in array passed as last argument.
+ *
+ * @param $cookie
+ *
+ * @param array $params
+ * @return mixed
+ * @see \Codeception\Lib\InnerBrowser::resetCookie()
+ */
+ public function resetCookie($name, $params = null) {
+ return $this->getScenario()->runStep(new \Codeception\Step\Action('resetCookie', func_get_args()));
+ }
+
+
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Checks that the given element exists on the page and is visible.
+ * You can also specify expected attributes of this element.
+ *
+ * ``` php
+ * seeElement('.error');
+ * $I->seeElement('//form/input[1]');
+ * $I->seeElement('input', ['name' => 'login']);
+ * $I->seeElement('input', ['value' => '123456']);
+ *
+ * // strict locator in first arg, attributes in second
+ * $I->seeElement(['css' => 'form input'], ['name' => 'login']);
+ * ?>
+ * ```
+ *
+ * @param $selector
+ * @param array $attributes
+ * @return
+ * Conditional Assertion: Test won't be stopped on fail
+ * @see \Codeception\Lib\InnerBrowser::seeElement()
+ */
+ public function canSeeElement($selector, $attributes = null) {
+ return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeElement', func_get_args()));
+ }
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Checks that the given element exists on the page and is visible.
+ * You can also specify expected attributes of this element.
+ *
+ * ``` php
+ * seeElement('.error');
+ * $I->seeElement('//form/input[1]');
+ * $I->seeElement('input', ['name' => 'login']);
+ * $I->seeElement('input', ['value' => '123456']);
+ *
+ * // strict locator in first arg, attributes in second
+ * $I->seeElement(['css' => 'form input'], ['name' => 'login']);
+ * ?>
+ * ```
+ *
+ * @param $selector
+ * @param array $attributes
+ * @return
+ * @see \Codeception\Lib\InnerBrowser::seeElement()
+ */
+ public function seeElement($selector, $attributes = null) {
+ return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeElement', func_get_args()));
+ }
+
+
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Checks that the given element is invisible or not present on the page.
+ * You can also specify expected attributes of this element.
+ *
+ * ``` php
+ * dontSeeElement('.error');
+ * $I->dontSeeElement('//form/input[1]');
+ * $I->dontSeeElement('input', ['name' => 'login']);
+ * $I->dontSeeElement('input', ['value' => '123456']);
+ * ?>
+ * ```
+ *
+ * @param $selector
+ * @param array $attributes
+ * Conditional Assertion: Test won't be stopped on fail
+ * @see \Codeception\Lib\InnerBrowser::dontSeeElement()
+ */
+ public function cantSeeElement($selector, $attributes = null) {
+ return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeElement', func_get_args()));
+ }
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Checks that the given element is invisible or not present on the page.
+ * You can also specify expected attributes of this element.
+ *
+ * ``` php
+ * dontSeeElement('.error');
+ * $I->dontSeeElement('//form/input[1]');
+ * $I->dontSeeElement('input', ['name' => 'login']);
+ * $I->dontSeeElement('input', ['value' => '123456']);
+ * ?>
+ * ```
+ *
+ * @param $selector
+ * @param array $attributes
+ * @see \Codeception\Lib\InnerBrowser::dontSeeElement()
+ */
+ public function dontSeeElement($selector, $attributes = null) {
+ return $this->getScenario()->runStep(new \Codeception\Step\Assertion('dontSeeElement', func_get_args()));
+ }
+
+
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Checks that there are a certain number of elements matched by the given locator on the page.
+ *
+ * ``` php
+ * seeNumberOfElements('tr', 10);
+ * $I->seeNumberOfElements('tr', [0,10]); //between 0 and 10 elements
+ * ?>
+ * ```
+ * @param $selector
+ * @param mixed $expected :
+ * - string: strict number
+ * - array: range of numbers [0,10]
+ * Conditional Assertion: Test won't be stopped on fail
+ * @see \Codeception\Lib\InnerBrowser::seeNumberOfElements()
+ */
+ public function canSeeNumberOfElements($selector, $expected) {
+ return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeNumberOfElements', func_get_args()));
+ }
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Checks that there are a certain number of elements matched by the given locator on the page.
+ *
+ * ``` php
+ * seeNumberOfElements('tr', 10);
+ * $I->seeNumberOfElements('tr', [0,10]); //between 0 and 10 elements
+ * ?>
+ * ```
+ * @param $selector
+ * @param mixed $expected :
+ * - string: strict number
+ * - array: range of numbers [0,10]
+ * @see \Codeception\Lib\InnerBrowser::seeNumberOfElements()
+ */
+ public function seeNumberOfElements($selector, $expected) {
+ return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeNumberOfElements', func_get_args()));
+ }
+
+
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Checks that the given option is selected.
+ *
+ * ``` php
+ * seeOptionIsSelected('#form input[name=payment]', 'Visa');
+ * ?>
+ * ```
+ *
+ * @param $selector
+ * @param $optionText
+ *
+ * @return mixed
+ * Conditional Assertion: Test won't be stopped on fail
+ * @see \Codeception\Lib\InnerBrowser::seeOptionIsSelected()
+ */
+ public function canSeeOptionIsSelected($selector, $optionText) {
+ return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeOptionIsSelected', func_get_args()));
+ }
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Checks that the given option is selected.
+ *
+ * ``` php
+ * seeOptionIsSelected('#form input[name=payment]', 'Visa');
+ * ?>
+ * ```
+ *
+ * @param $selector
+ * @param $optionText
+ *
+ * @return mixed
+ * @see \Codeception\Lib\InnerBrowser::seeOptionIsSelected()
+ */
+ public function seeOptionIsSelected($selector, $optionText) {
+ return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeOptionIsSelected', func_get_args()));
+ }
+
+
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Checks that the given option is not selected.
+ *
+ * ``` php
+ * dontSeeOptionIsSelected('#form input[name=payment]', 'Visa');
+ * ?>
+ * ```
+ *
+ * @param $selector
+ * @param $optionText
+ *
+ * @return mixed
+ * Conditional Assertion: Test won't be stopped on fail
+ * @see \Codeception\Lib\InnerBrowser::dontSeeOptionIsSelected()
+ */
+ public function cantSeeOptionIsSelected($selector, $optionText) {
+ return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeOptionIsSelected', func_get_args()));
+ }
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Checks that the given option is not selected.
+ *
+ * ``` php
+ * dontSeeOptionIsSelected('#form input[name=payment]', 'Visa');
+ * ?>
+ * ```
+ *
+ * @param $selector
+ * @param $optionText
+ *
+ * @return mixed
+ * @see \Codeception\Lib\InnerBrowser::dontSeeOptionIsSelected()
+ */
+ public function dontSeeOptionIsSelected($selector, $optionText) {
+ return $this->getScenario()->runStep(new \Codeception\Step\Assertion('dontSeeOptionIsSelected', func_get_args()));
+ }
+
+
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Asserts that current page has 404 response status code.
+ * Conditional Assertion: Test won't be stopped on fail
+ * @see \Codeception\Lib\InnerBrowser::seePageNotFound()
+ */
+ public function canSeePageNotFound() {
+ return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seePageNotFound', func_get_args()));
+ }
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Asserts that current page has 404 response status code.
+ * @see \Codeception\Lib\InnerBrowser::seePageNotFound()
+ */
+ public function seePageNotFound() {
+ return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seePageNotFound', func_get_args()));
+ }
+
+
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Checks that response code is equal to value provided.
+ *
+ * @param $code
+ *
+ * @return mixed
+ * Conditional Assertion: Test won't be stopped on fail
+ * @see \Codeception\Lib\InnerBrowser::seeResponseCodeIs()
+ */
+ public function canSeeResponseCodeIs($code) {
+ return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeResponseCodeIs', func_get_args()));
+ }
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Checks that response code is equal to value provided.
+ *
+ * @param $code
+ *
+ * @return mixed
+ * @see \Codeception\Lib\InnerBrowser::seeResponseCodeIs()
+ */
+ public function seeResponseCodeIs($code) {
+ return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeResponseCodeIs', func_get_args()));
+ }
+
+
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Checks that the page title contains the given string.
+ *
+ * ``` php
+ * seeInTitle('Blog - Post #1');
+ * ?>
+ * ```
+ *
+ * @param $title
+ *
+ * @return mixed
+ * Conditional Assertion: Test won't be stopped on fail
+ * @see \Codeception\Lib\InnerBrowser::seeInTitle()
+ */
+ public function canSeeInTitle($title) {
+ return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeInTitle', func_get_args()));
+ }
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Checks that the page title contains the given string.
+ *
+ * ``` php
+ * seeInTitle('Blog - Post #1');
+ * ?>
+ * ```
+ *
+ * @param $title
+ *
+ * @return mixed
+ * @see \Codeception\Lib\InnerBrowser::seeInTitle()
+ */
+ public function seeInTitle($title) {
+ return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeInTitle', func_get_args()));
+ }
+
+
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Checks that the page title does not contain the given string.
+ *
+ * @param $title
+ *
+ * @return mixed
+ * Conditional Assertion: Test won't be stopped on fail
+ * @see \Codeception\Lib\InnerBrowser::dontSeeInTitle()
+ */
+ public function cantSeeInTitle($title) {
+ return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeInTitle', func_get_args()));
+ }
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Checks that the page title does not contain the given string.
+ *
+ * @param $title
+ *
+ * @return mixed
+ * @see \Codeception\Lib\InnerBrowser::dontSeeInTitle()
+ */
+ public function dontSeeInTitle($title) {
+ return $this->getScenario()->runStep(new \Codeception\Step\Assertion('dontSeeInTitle', func_get_args()));
+ }
+
+
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Checks that two variables are equal.
+ *
+ * @param $expected
+ * @param $actual
+ * @param string $message
+ *
+ * @return mixed
+ * @see \Codeception\Module\Asserts::assertEquals()
+ */
+ public function assertEquals($expected, $actual, $message = null) {
+ return $this->getScenario()->runStep(new \Codeception\Step\Action('assertEquals', func_get_args()));
+ }
+
+
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Checks that two variables are not equal
+ *
+ * @param $expected
+ * @param $actual
+ * @param string $message
+ * @see \Codeception\Module\Asserts::assertNotEquals()
+ */
+ public function assertNotEquals($expected, $actual, $message = null) {
+ return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotEquals', func_get_args()));
+ }
+
+
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Checks that two variables are same
+ *
+ * @param $expected
+ * @param $actual
+ * @param string $message
+ *
+ * @return mixed
+ * @see \Codeception\Module\Asserts::assertSame()
+ */
+ public function assertSame($expected, $actual, $message = null) {
+ return $this->getScenario()->runStep(new \Codeception\Step\Action('assertSame', func_get_args()));
+ }
+
+
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Checks that two variables are not same
+ *
+ * @param $expected
+ * @param $actual
+ * @param string $message
+ * @see \Codeception\Module\Asserts::assertNotSame()
+ */
+ public function assertNotSame($expected, $actual, $message = null) {
+ return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotSame', func_get_args()));
+ }
+
+
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Checks that actual is greater than expected
+ *
+ * @param $expected
+ * @param $actual
+ * @param string $message
+ * @see \Codeception\Module\Asserts::assertGreaterThan()
+ */
+ public function assertGreaterThan($expected, $actual, $message = null) {
+ return $this->getScenario()->runStep(new \Codeception\Step\Action('assertGreaterThan', func_get_args()));
+ }
+
+
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * @deprecated
+ * @see \Codeception\Module\Asserts::assertGreaterThen()
+ */
+ public function assertGreaterThen($expected, $actual, $message = null) {
+ return $this->getScenario()->runStep(new \Codeception\Step\Action('assertGreaterThen', func_get_args()));
+ }
+
+
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Checks that actual is greater or equal than expected
+ *
+ * @param $expected
+ * @param $actual
+ * @param string $message
+ * @see \Codeception\Module\Asserts::assertGreaterThanOrEqual()
+ */
+ public function assertGreaterThanOrEqual($expected, $actual, $message = null) {
+ return $this->getScenario()->runStep(new \Codeception\Step\Action('assertGreaterThanOrEqual', func_get_args()));
+ }
+
+
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * @deprecated
+ * @see \Codeception\Module\Asserts::assertGreaterThenOrEqual()
+ */
+ public function assertGreaterThenOrEqual($expected, $actual, $message = null) {
+ return $this->getScenario()->runStep(new \Codeception\Step\Action('assertGreaterThenOrEqual', func_get_args()));
+ }
+
+
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Checks that actual is less than expected
+ *
+ * @param $expected
+ * @param $actual
+ * @param string $message
+ * @see \Codeception\Module\Asserts::assertLessThan()
+ */
+ public function assertLessThan($expected, $actual, $message = null) {
+ return $this->getScenario()->runStep(new \Codeception\Step\Action('assertLessThan', func_get_args()));
+ }
+
+
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Checks that actual is less or equal than expected
+ *
+ * @param $expected
+ * @param $actual
+ * @param string $message
+ * @see \Codeception\Module\Asserts::assertLessThanOrEqual()
+ */
+ public function assertLessThanOrEqual($expected, $actual, $message = null) {
+ return $this->getScenario()->runStep(new \Codeception\Step\Action('assertLessThanOrEqual', func_get_args()));
+ }
+
+
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Checks that haystack contains needle
+ *
+ * @param $needle
+ * @param $haystack
+ * @param string $message
+ * @see \Codeception\Module\Asserts::assertContains()
+ */
+ public function assertContains($needle, $haystack, $message = null) {
+ return $this->getScenario()->runStep(new \Codeception\Step\Action('assertContains', func_get_args()));
+ }
+
+
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Checks that haystack doesn't contain needle.
+ *
+ * @param $needle
+ * @param $haystack
+ * @param string $message
+ * @see \Codeception\Module\Asserts::assertNotContains()
+ */
+ public function assertNotContains($needle, $haystack, $message = null) {
+ return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotContains', func_get_args()));
+ }
+
+
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Checks that string match with pattern
+ *
+ * @param string $pattern
+ * @param string $string
+ * @param string $message
+ * @see \Codeception\Module\Asserts::assertRegExp()
+ */
+ public function assertRegExp($pattern, $string, $message = null) {
+ return $this->getScenario()->runStep(new \Codeception\Step\Action('assertRegExp', func_get_args()));
+ }
+
+
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Checks that string not match with pattern
+ *
+ * @param string $pattern
+ * @param string $string
+ * @param string $message
+ * @see \Codeception\Module\Asserts::assertNotRegExp()
+ */
+ public function assertNotRegExp($pattern, $string, $message = null) {
+ return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotRegExp', func_get_args()));
+ }
+
+
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Checks that variable is empty.
+ *
+ * @param $actual
+ * @param string $message
+ * @see \Codeception\Module\Asserts::assertEmpty()
+ */
+ public function assertEmpty($actual, $message = null) {
+ return $this->getScenario()->runStep(new \Codeception\Step\Action('assertEmpty', func_get_args()));
+ }
+
+
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Checks that variable is not empty.
+ *
+ * @param $actual
+ * @param string $message
+ * @see \Codeception\Module\Asserts::assertNotEmpty()
+ */
+ public function assertNotEmpty($actual, $message = null) {
+ return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotEmpty', func_get_args()));
+ }
+
+
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Checks that variable is NULL
+ *
+ * @param $actual
+ * @param string $message
+ * @see \Codeception\Module\Asserts::assertNull()
+ */
+ public function assertNull($actual, $message = null) {
+ return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNull', func_get_args()));
+ }
+
+
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Checks that variable is not NULL
+ *
+ * @param $actual
+ * @param string $message
+ * @see \Codeception\Module\Asserts::assertNotNull()
+ */
+ public function assertNotNull($actual, $message = null) {
+ return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotNull', func_get_args()));
+ }
+
+
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Checks that condition is positive.
+ *
+ * @param $condition
+ * @param string $message
+ * @see \Codeception\Module\Asserts::assertTrue()
+ */
+ public function assertTrue($condition, $message = null) {
+ return $this->getScenario()->runStep(new \Codeception\Step\Action('assertTrue', func_get_args()));
+ }
+
+
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Checks that condition is negative.
+ *
+ * @param $condition
+ * @param string $message
+ * @see \Codeception\Module\Asserts::assertFalse()
+ */
+ public function assertFalse($condition, $message = null) {
+ return $this->getScenario()->runStep(new \Codeception\Step\Action('assertFalse', func_get_args()));
+ }
+
+
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Checks if file exists
+ *
+ * @param string $filename
+ * @param string $message
+ * @see \Codeception\Module\Asserts::assertFileExists()
+ */
+ public function assertFileExists($filename, $message = null) {
+ return $this->getScenario()->runStep(new \Codeception\Step\Action('assertFileExists', func_get_args()));
+ }
+
+
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Checks if file doesn't exists
+ *
+ * @param string $filename
+ * @param string $message
+ * @see \Codeception\Module\Asserts::assertFileNotExists()
+ */
+ public function assertFileNotExists($filename, $message = null) {
+ return $this->getScenario()->runStep(new \Codeception\Step\Action('assertFileNotExists', func_get_args()));
+ }
+
+
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Fails the test with message.
+ *
+ * @param $message
+ * @see \Codeception\Module\Asserts::fail()
+ */
+ public function fail($message) {
+ return $this->getScenario()->runStep(new \Codeception\Step\Action('fail', func_get_args()));
+ }
+}
diff --git a/tests/acceptance.suite.yml b/tests/acceptance.suite.yml
new file mode 100644
index 0000000000..2269e0c298
--- /dev/null
+++ b/tests/acceptance.suite.yml
@@ -0,0 +1,12 @@
+# Codeception Test Suite Configuration
+#
+# Suite for acceptance tests.
+# Perform tests in browser using the WebDriver or PhpBrowser.
+# If you need both WebDriver and PHPBrowser tests - create a separate suite.
+
+class_name: AcceptanceTester
+modules:
+ enabled:
+ - PhpBrowser:
+ url: http://localhost/myapp
+ - \Helper\Acceptance
\ No newline at end of file
diff --git a/tests/acceptance/_bootstrap.php b/tests/acceptance/_bootstrap.php
new file mode 100644
index 0000000000..8a88555806
--- /dev/null
+++ b/tests/acceptance/_bootstrap.php
@@ -0,0 +1,2 @@
+createAccount();
- }
-
- /**
- * 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 createAccount()
- {
- $user = FactoryMuffin::create('FireflyIII\User');
- $this->be($user);
- if (is_null($this->account)) {
- $this->account = FactoryMuffin::create('FireflyIII\Models\Account');
- $this->account->user_id = $user->id;
- $this->account->save();
- }
- }
-
- /**
- * @covers FireflyIII\Http\Controllers\AccountController::create
- */
- public function testCreate()
- {
- $pref = FactoryMuffin::create('FireflyIII\Models\Preference');
- $pref->data = '1M';
- $this->be($pref->user);
-
-
- Preferences::shouldReceive('get')->withArgs(['viewRange', '1M'])->andReturn($pref);
-
-
- $language = FactoryMuffin::create('FireflyIII\Models\Preference');
- $language->data = 'en';
- Preferences::shouldReceive('get')->withArgs(['language', 'en'])->andReturn($language);
-
- // CURRENCY:
- $currency = FactoryMuffin::create('FireflyIII\Models\TransactionCurrency');
- Amount::shouldReceive('getDefaultCurrency')->andReturn($currency);
- Amount::shouldReceive('getAllCurrencies')->andReturn([$currency]);
- Amount::shouldReceive('getCurrencyCode')->andReturn('X');
- Amount::shouldReceive('getCurrencySymbol')->andReturn('X');
- $lastActivity = FactoryMuffin::create('FireflyIII\Models\Preference');
- $lastActivity->data = microtime();
- Preferences::shouldReceive('lastActivity')->andReturn($lastActivity);
-
- $this->call('GET', '/accounts/create/asset');
- $this->assertResponseOk();
-
-
- $this->assertViewHas('subTitle', 'Create a new asset account');
- $this->assertViewHas('subTitleIcon', 'fa-money');
- $this->assertViewHas('what', 'asset');
-
- }
-
- /**
- * @covers FireflyIII\Http\Controllers\AccountController::delete
- */
- public function testDelete()
- {
-
- $this->be($this->account->user);
- $this->call('GET', '/accounts/delete/' . $this->account->id);
- $this->assertResponseOk();
- $this->assertViewHas('subTitle', 'Delete ' . strtolower(e($this->account->accountType->type)) . ' "' . e($this->account->name) . '"');
-
- }
-
- /**
- * @covers FireflyIII\Http\Controllers\AccountController::destroy
- */
- public function testDestroy()
- {
- // fake an account.
- $account = FactoryMuffin::create('FireflyIII\Models\Account');
-
- $this->be($account->user);
-
- // mock:
- $repository = $this->mock('FireflyIII\Repositories\Account\AccountRepositoryInterface');
- $repository->shouldReceive('destroy')->andReturn(true);
-
- // post it!
- $this->call('POST', '/accounts/destroy/' . $account->id, ['_token' => 'replaceme']);
- $this->assertSessionHas('success');
- $this->assertResponseStatus(302);
- }
-
- /**
- * @covers FireflyIII\Http\Controllers\AccountController::edit
- */
- public function testEdit()
- {
- // fake an account.
-
- $this->be($this->account->user);
- $this->assertCount(1, DB::table('accounts')->where('id', $this->account->id)->whereNull('deleted_at')->get());
-
- // create a transaction journal that will act as opening balance:
- $openingBalance = FactoryMuffin::create('FireflyIII\Models\TransactionJournal');
- $repository = $this->mock('FireflyIII\Repositories\Account\AccountRepositoryInterface');
- $repository->shouldReceive('openingBalanceTransaction')->andReturn($openingBalance);
-
- // create a transaction that will be returned for the opening balance transaction:
- $opening = FactoryMuffin::create('FireflyIII\Models\Transaction');
- $repository->shouldReceive('getFirstTransaction')->andReturn($opening);
-
- // CURRENCY:
- $currency = FactoryMuffin::create('FireflyIII\Models\TransactionCurrency');
- Amount::shouldReceive('getDefaultCurrency')->andReturn($currency);
- Amount::shouldReceive('getAllCurrencies')->andReturn([$currency]);
- Amount::shouldReceive('getCurrencyCode')->andReturn('X');
- Amount::shouldReceive('getCurrencySymbol')->andReturn('X');
-
- // get edit page:
- $this->call('GET', '/accounts/edit/' . $this->account->id);
-
- // assert stuff:
- $this->assertResponseOk();
- $this->assertSessionHas('preFilled');
- $this->assertViewHas('subTitle', 'Edit ' . strtolower(e($this->account->accountType->type)) . ' "' . e($this->account->name) . '"');
-
-
- }
-
- /**
- * @covers FireflyIII\Http\Controllers\AccountController::index
- */
- public function testIndex()
- {
- // an account:
- $this->be($this->account->user);
-
- $collection = new Collection;
- $collection->push($this->account);
-
- $repository = $this->mock('FireflyIII\Repositories\Account\AccountRepositoryInterface');
- $repository->shouldReceive('getAccounts')->andReturn($collection);
- $repository->shouldReceive('countAccounts')->andReturn(1);
- $repository->shouldReceive('getLastActivity')->andReturn(null);
-
- Amount::shouldReceive('format')->andReturn('');
- Amount::shouldReceive('getCurrencyCode')->andReturn('A');
- Amount::shouldReceive('getCurrencySymbol')->andReturn('X');
-
-
- // put stuff in session:
- $this->session(['start' => new Carbon, 'end' => new Carbon]);
-
- // get edit page:
- $this->call('GET', '/accounts/asset');
- $this->assertResponseOk();
- $this->assertViewHas('what', 'asset');
-
- }
-
- /**
- * @covers FireflyIII\Http\Controllers\AccountController::show
- */
- public function testShow()
- {
- // an account:
- $this->be($this->account->user);
-
- // mock!
- Amount::shouldReceive('getCurrencyCode')->andReturn('A');
- Amount::shouldReceive('getCurrencySymbol')->andReturn('X');
- $repository = $this->mock('FireflyIII\Repositories\Account\AccountRepositoryInterface');
- $repository->shouldReceive('getJournals')->andReturn(new LengthAwarePaginator([], 0, 10));
-
- // get edit page:
- $this->call('GET', '/accounts/show/' . $this->account->id);
- $this->assertResponseOk();
- }
-
- /**
- * @covers FireflyIII\Http\Controllers\AccountController::store
- */
- public function testStore()
- {
- // an account:
- $this->be($this->account->user);
-
- $data = [
- 'name' => 'New test account ' . rand(1, 1000),
- 'what' => 'asset',
- 'virtualBalance' => 0,
- 'accountRole' => 'defaultAsset',
- 'openingBalance' => 20,
- 'openingBalanceDate' => date('Y-m-d'),
- 'openingBalanceCurrency' => 1,
- '_token' => 'replaceme'
- ];
-
- // fake validation routine:
- $request = $this->mock('FireflyIII\Http\Requests\AccountFormRequest');
- $request->shouldReceive('input')->andReturn('');
-
- // fake store routine:
- $repository = $this->mock('FireflyIII\Repositories\Account\AccountRepositoryInterface');
- $repository->shouldReceive('store')->andReturn($this->account);
-
- $this->call('POST', '/accounts/store', $data);
- $this->assertResponseStatus(302);
- $this->assertSessionHas('success');
-
- }
-
- /**
- * @covers FireflyIII\Http\Controllers\AccountController::store
- */
- public function testStoreAndRedirect()
- {
- // an account:
- $this->be($this->account->user);
-
- $data = [
- 'name' => 'New test account ' . rand(1, 1000),
- 'what' => 'asset',
- 'virtualBalance' => 0,
- 'accountRole' => 'defaultAsset',
- 'openingBalance' => 20,
- 'openingBalanceDate' => date('Y-m-d'),
- 'openingBalanceCurrency' => 1,
- '_token' => 'replaceme',
- 'create_another' => 1,
- ];
-
- // fake validation routine:
- $request = $this->mock('FireflyIII\Http\Requests\AccountFormRequest');
- $request->shouldReceive('input')->andReturn('');
-
- // fake store routine:
- $repository = $this->mock('FireflyIII\Repositories\Account\AccountRepositoryInterface');
- $repository->shouldReceive('store')->andReturn($this->account);
-
- $this->call('POST', '/accounts/store', $data);
- $this->assertResponseStatus(302);
- $this->assertSessionHas('success');
-
- }
-
- /**
- * @covers FireflyIII\Http\Controllers\AccountController::update
- */
- public function testUpdate()
- {
-
- // an account:
- $this->be($this->account->user);
-
- $data = [
- 'name' => 'Edited test account ' . rand(1, 1000),
- 'active' => 1,
- 'accountRole' => 'defaultAsset',
- 'virtualBalance' => 0,
- 'openingBalance' => 25,
- 'openingBalanceDate' => date('Y-m-d'),
- 'openingBalanceCurrency' => 1,
- '_token' => 'replaceme'
- ];
-
- // fake validation routine:
- $request = $this->mock('FireflyIII\Http\Requests\AccountFormRequest');
- $request->shouldReceive('input')->andReturn('');
-
- // fake update routine:
- $repository = $this->mock('FireflyIII\Repositories\Account\AccountRepositoryInterface');
- $repository->shouldReceive('update')->andReturn($this->account);
-
- $this->call('POST', '/accounts/update/' . $this->account->id, $data);
- $this->assertResponseStatus(302);
- $this->assertSessionHas('success');
- }
-
- /**
- * @covers FireflyIII\Http\Controllers\AccountController::update
- */
- public function testUpdateAndRedirect()
- {
-
- // an account:
- $this->be($this->account->user);
-
- $data = [
- 'name' => 'Edited test account ' . rand(1, 1000),
- 'active' => 1,
- 'accountRole' => 'defaultAsset',
- 'virtualBalance' => 0,
- 'openingBalance' => 25,
- 'openingBalanceDate' => date('Y-m-d'),
- 'openingBalanceCurrency' => 1,
- '_token' => 'replaceme',
- 'return_to_edit' => 1,
- ];
-
- // fake validation routine:
- $request = $this->mock('FireflyIII\Http\Requests\AccountFormRequest');
- $request->shouldReceive('input')->andReturn('');
-
- // fake update routine:
- $repository = $this->mock('FireflyIII\Repositories\Account\AccountRepositoryInterface');
- $repository->shouldReceive('update')->andReturn($this->account);
-
- $this->call('POST', '/accounts/update/' . $this->account->id, $data);
- $this->assertResponseStatus(302);
- $this->assertSessionHas('success');
- }
-
-}
diff --git a/tests/controllers/AuthControllerTest.php b/tests/controllers/AuthControllerTest.php
deleted file mode 100644
index 2517e19b8c..0000000000
--- a/tests/controllers/AuthControllerTest.php
+++ /dev/null
@@ -1,78 +0,0 @@
- 'test@example.com',
- 'password' => 'onetwothree',
- 'password_confirmation' => 'onetwothree',
- '_token' => 'replaceMe'
- ];
- $this->call('POST', '/auth/register', $data);
- $this->assertResponseStatus(302);
- $this->assertSessionHas('success');
- }
-
- /**
- * @covers FireflyIII\Http\Controllers\Auth\AuthController::postRegister
- * @covers FireflyIII\Http\Controllers\Auth\AuthController::validator
- * @covers FireflyIII\Http\Controllers\Auth\AuthController::create
- */
- public function testPostRegisterFails()
- {
-
- $data = [
- 'email' => 'test@example.com',
- 'password' => 'onetwothree',
- 'password_confirmation' => 'onetwofour',
- '_token' => 'replaceMe'
- ];
- $this->call('POST', '/auth/register', $data);
- $this->assertResponseStatus(302);
-
-
- }
-
-}
diff --git a/tests/controllers/BillControllerTest.php b/tests/controllers/BillControllerTest.php
deleted file mode 100644
index 3fc9e690b2..0000000000
--- a/tests/controllers/BillControllerTest.php
+++ /dev/null
@@ -1,273 +0,0 @@
-be($bill->user);
-
- // CURRENCY:
- $currency = FactoryMuffin::create('FireflyIII\Models\TransactionCurrency');
- Amount::shouldReceive('getDefaultCurrency')->andReturn($currency);
- Amount::shouldReceive('getAllCurrencies')->andReturn([$currency]);
- Amount::shouldReceive('getCurrencyCode')->andReturn('X');
- Amount::shouldReceive('getCurrencySymbol')->andReturn('X');
-
- $this->call('GET', '/bills/create');
- $this->assertViewHas('subTitle', 'Create new bill');
- $this->assertResponseOk();
-
- }
-
- /**
- * @covers FireflyIII\Http\Controllers\BillController::delete
- */
- public function testDelete()
- {
- $bill = FactoryMuffin::create('FireflyIII\Models\Bill');
- $this->be($bill->user);
- $this->call('GET', '/bills/delete/' . $bill->id);
- $this->assertViewHas('subTitle', 'Delete bill "' . e($bill->name) . '"');
- $this->assertResponseOk();
- }
-
- /**
- * @covers FireflyIII\Http\Controllers\BillController::destroy
- */
- public function testDestroy()
- {
- $bill = FactoryMuffin::create('FireflyIII\Models\Bill');
- $this->be($bill->user);
-
- $repository = $this->mock('FireflyIII\Repositories\Bill\BillRepositoryInterface');
- $repository->shouldReceive('destroy')->andReturn(true);
-
-
- $this->call('POST', '/bills/destroy/' . $bill->id, ['_token' => 'replaceMe']);
- $this->assertSessionHas('success', 'The bill was deleted.');
- $this->assertResponseStatus(302);
- }
-
- /**
- * @covers FireflyIII\Http\Controllers\BillController::edit
- */
- public function testEdit()
- {
- $bill = FactoryMuffin::create('FireflyIII\Models\Bill');
- $this->be($bill->user);
-
- // CURRENCY:
- $currency = FactoryMuffin::create('FireflyIII\Models\TransactionCurrency');
- Amount::shouldReceive('getDefaultCurrency')->andReturn($currency);
- Amount::shouldReceive('getAllCurrencies')->andReturn([$currency]);
- Amount::shouldReceive('getCurrencyCode')->andReturn('X');
- Amount::shouldReceive('getCurrencySymbol')->andReturn('X');
-
- $this->call('GET', '/bills/edit/' . $bill->id);
- $this->assertViewHas('subTitle', 'Edit bill "' . e($bill->name) . '"');
- $this->assertResponseOk();
- }
-
- /**
- * @covers FireflyIII\Http\Controllers\BillController::index
- */
- public function testIndex()
- {
- $bill = FactoryMuffin::create('FireflyIII\Models\Bill');
- $this->be($bill->user);
-
- $collection = new Collection;
- $collection->push($bill);
-
- Amount::shouldReceive('format')->andReturn('XX');
- Amount::shouldReceive('getCurrencyCode')->andReturn('X');
- Amount::shouldReceive('getCurrencySymbol')->andReturn('X');
-
- $repository = $this->mock('FireflyIII\Repositories\Bill\BillRepositoryInterface');
- $repository->shouldReceive('getBills')->once()->andReturn($collection);
- $repository->shouldReceive('nextExpectedMatch')->with($bill)->andReturn(new Carbon);
- $repository->shouldReceive('lastFoundMatch')->with($bill)->andReturn(new Carbon);
-
- $this->call('GET', '/bills');
- $this->assertResponseOk();
-
- }
-
- /**
- * @covers FireflyIII\Http\Controllers\BillController::rescan
- */
- public function testRescan()
- {
- $bill = FactoryMuffin::create('FireflyIII\Models\Bill');
- $journal = FactoryMuffin::create('FireflyIII\Models\TransactionJournal');
- $collection = new Collection;
- $this->be($bill->user);
- $collection->push($journal);
-
- $repository = $this->mock('FireflyIII\Repositories\Bill\BillRepositoryInterface');
- $repository->shouldReceive('getPossiblyRelatedJournals')->once()->andReturn($collection);
- $repository->shouldReceive('scan');
-
- $this->call('GET', '/bills/rescan/' . $bill->id);
- $this->assertResponseStatus(302);
- $this->assertSessionHas('success', 'Rescanned everything.');
-
-
- }
-
- /**
- * @covers FireflyIII\Http\Controllers\BillController::rescan
- */
- public function testRescanInactive()
- {
- $bill = FactoryMuffin::create('FireflyIII\Models\Bill');
- $bill->active = 0;
- $bill->save();
- $this->be($bill->user);
-
- $this->call('GET', '/bills/rescan/' . $bill->id);
- $this->assertResponseStatus(302);
- $this->assertSessionHas('warning', 'Inactive bills cannot be scanned.');
-
- }
-
- /**
- * @covers FireflyIII\Http\Controllers\BillController::show
- */
- public function testShow()
- {
- $bill = FactoryMuffin::create('FireflyIII\Models\Bill');
- $journal = FactoryMuffin::create('FireflyIII\Models\TransactionJournal');
- $collection = new Collection;
-
- $bill->save();
- $this->be($bill->user);
- $collection->push($journal);
-
-
- $repository = $this->mock('FireflyIII\Repositories\Bill\BillRepositoryInterface');
- $repository->shouldReceive('getJournals')->once()->andReturn($collection);
- $repository->shouldReceive('nextExpectedMatch')->once()->andReturn(new Carbon);
-
- Amount::shouldReceive('format')->andReturn('XX');
- Amount::shouldReceive('formatJournal')->andReturn('XX');
- Amount::shouldReceive('getCurrencyCode')->andReturn('XX');
- Amount::shouldReceive('getCurrencySymbol')->andReturn('X');
-
-
- $this->call('GET', '/bills/show/' . $bill->id);
- }
-
- /**
- * @covers FireflyIII\Http\Controllers\BillController::store
- */
- public function testStore()
- {
- $bill = FactoryMuffin::create('FireflyIII\Models\Bill');
- $repository = $this->mock('FireflyIII\Repositories\Bill\BillRepositoryInterface');
- $request = $this->mock('FireflyIII\Http\Requests\BillFormRequest');
-
- $this->be($bill->user);
- $request->shouldReceive('getBillData')->once()->andReturn([]);
- $repository->shouldReceive('store')->with([])->andReturn($bill);
-
- $this->call('POST', '/bills/store', ['_token' => 'replaceMe']);
- $this->assertResponseStatus(302);
- $this->assertSessionHas('success', 'Bill "' . e($bill->name) . '" stored.');
- }
-
- /**
- * @covers FireflyIII\Http\Controllers\BillController::store
- */
- public function testStoreAndRedirect()
- {
- $bill = FactoryMuffin::create('FireflyIII\Models\Bill');
- $repository = $this->mock('FireflyIII\Repositories\Bill\BillRepositoryInterface');
- $request = $this->mock('FireflyIII\Http\Requests\BillFormRequest');
-
- $this->be($bill->user);
- $request->shouldReceive('getBillData')->once()->andReturn([]);
- $repository->shouldReceive('store')->with([])->andReturn($bill);
-
- $this->call('POST', '/bills/store', ['_token' => 'replaceMe', 'create_another' => 1]);
- $this->assertResponseStatus(302);
- $this->assertSessionHas('success', 'Bill "' . e($bill->name) . '" stored.');
- }
-
- /**
- * @covers FireflyIII\Http\Controllers\BillController::update
- */
- public function testUpdate()
- {
- $bill = FactoryMuffin::create('FireflyIII\Models\Bill');
- $repository = $this->mock('FireflyIII\Repositories\Bill\BillRepositoryInterface');
- $request = $this->mock('FireflyIII\Http\Requests\BillFormRequest');
-
- $this->be($bill->user);
- $request->shouldReceive('getBillData')->once()->andReturn([]);
- $repository->shouldReceive('update')->andReturn($bill);
-
- $this->call('POST', '/bills/update/' . $bill->id, ['_token' => 'replaceMe']);
- $this->assertResponseStatus(302);
- $this->assertSessionHas('success', 'Bill "' . e($bill->name) . '" updated.');
- }
-
- /**
- * @covers FireflyIII\Http\Controllers\BillController::update
- */
- public function testUpdateAndRedirect()
- {
- $bill = FactoryMuffin::create('FireflyIII\Models\Bill');
- $repository = $this->mock('FireflyIII\Repositories\Bill\BillRepositoryInterface');
- $request = $this->mock('FireflyIII\Http\Requests\BillFormRequest');
-
- $this->be($bill->user);
- $request->shouldReceive('getBillData')->once()->andReturn([]);
- $repository->shouldReceive('update')->andReturn($bill);
-
- $this->call('POST', '/bills/update/' . $bill->id, ['_token' => 'replaceMe', 'return_to_edit' => 1]);
- $this->assertResponseStatus(302);
-
- }
-}
diff --git a/tests/controllers/BudgetControllerTest.php b/tests/controllers/BudgetControllerTest.php
deleted file mode 100644
index b74bfe6a60..0000000000
--- a/tests/controllers/BudgetControllerTest.php
+++ /dev/null
@@ -1,435 +0,0 @@
-mock('FireflyIII\Repositories\Budget\BudgetRepositoryInterface');
- $limitRepetition = FactoryMuffin::create('FireflyIII\Models\LimitRepetition');
- $budget = $limitRepetition->budgetlimit->budget;
- $this->be($budget->user);
- $today = new Carbon;
-
- $this->session(['start' => $today]);
- $repository->shouldReceive('updateLimitAmount')->once()->andReturn($limitRepetition);
- $this->call('POST', '/budgets/amount/' . $budget->id, ['amount' => 100, '_token' => 'replaceme']);
- $this->assertResponseOk();
-
- }
-
- /**
- * @covers FireflyIII\Http\Controllers\BudgetController::amount
- */
- public function testAmountZero()
- {
- $repository = $this->mock('FireflyIII\Repositories\Budget\BudgetRepositoryInterface');
- $limitRepetition = FactoryMuffin::create('FireflyIII\Models\LimitRepetition');
- $budget = $limitRepetition->budgetlimit->budget;
- $this->be($budget->user);
- $today = new Carbon;
-
- $this->session(['start' => $today]);
- $repository->shouldReceive('updateLimitAmount')->once()->andReturn($limitRepetition);
- $this->call('POST', '/budgets/amount/' . $budget->id, ['amount' => 0, '_token' => 'replaceme']);
- $this->assertResponseOk();
-
- }
-
- /**
- * @covers FireflyIII\Http\Controllers\BudgetController::create
- */
- public function testCreate()
- {
- $budget = FactoryMuffin::create('FireflyIII\Models\Budget');
- $this->be($budget->user);
- $this->call('GET', '/budgets/create');
- $this->assertResponseOk();
- $this->assertViewHas('subTitle', 'Create a new budget');
- }
-
- /**
- * @covers FireflyIII\Http\Controllers\BudgetController::delete
- */
- public function testDelete()
- {
- $budget = FactoryMuffin::create('FireflyIII\Models\Budget');
- $this->be($budget->user);
- $this->call('GET', '/budgets/delete/' . $budget->id);
-
- $this->assertResponseOk();
- $this->assertViewHas('subTitle', 'Delete budget "' . e($budget->name) . '"');
- $this->assertViewHas('budget');
- $this->assertSessionHas('budgets.delete.url');
- }
-
- /**
- * @covers FireflyIII\Http\Controllers\BudgetController::destroy
- */
- public function testDestroy()
- {
- $budget = FactoryMuffin::create('FireflyIII\Models\Budget');
- $this->be($budget->user);
-
- $repository = $this->mock('FireflyIII\Repositories\Budget\BudgetRepositoryInterface');
- $repository->shouldReceive('destroy')->andReturn(true);
-
- $this->call('POST', '/budgets/destroy/' . $budget->id, ['_token' => 'replaceme']);
-
- $this->assertSessionHas('success', 'The budget "' . e($budget->name) . '" was deleted.');
-
- }
-
- /**
- * @covers FireflyIII\Http\Controllers\BudgetController::edit
- */
- public function testEdit()
- {
- $budget = FactoryMuffin::create('FireflyIII\Models\Budget');
- $this->be($budget->user);
-
- $this->call('GET', '/budgets/edit/' . $budget->id);
-
- $this->assertResponseOk();
- $this->assertViewHas('subTitle', 'Edit budget "' . e($budget->name) . '"');
- $this->assertViewHas('budget');
- $this->assertSessionHas('budgets.edit.url');
- }
-
- /**
- * @covers FireflyIII\Http\Controllers\BudgetController::index
- */
- public function testIndex()
- {
- $currency = FactoryMuffin::create('FireflyIII\Models\TransactionCurrency');
- $budget = FactoryMuffin::create('FireflyIII\Models\Budget');
- $this->be($budget->user);
- $collection = new Collection;
- $collection->push($budget);
- $repository = $this->mock('FireflyIII\Repositories\Budget\BudgetRepositoryInterface');
- $repetition = FactoryMuffin::create('FireflyIII\Models\LimitRepetition');
-
- $repository->shouldReceive('getActiveBudgets')->once()->andReturn($collection);
- $repository->shouldReceive('getInactiveBudgets')->once()->andReturn($collection);
- $repository->shouldReceive('cleanupBudgets')->once();
- $repository->shouldReceive('spentInPeriodCorrected')->once();
- $repository->shouldReceive('getCurrentRepetition')->once()->andReturn($repetition);
- Amount::shouldReceive('getCurrencySymbol')->andReturn('x');
- Amount::shouldReceive('format')->andReturn('x');
- Amount::shouldReceive('getCurrencyCode')->andReturn('X');
- Amount::shouldReceive('getCurrencySymbol')->andReturn('X');
- Amount::shouldReceive('getDefaultCurrency')->andReturn($currency);
- $this->call('GET', '/budgets');
-
- $this->assertResponseOk();
- $this->assertViewHas('budgets');
- $this->assertViewHas('inactive');
- $this->assertViewHas('inactive');
-
- }
-
- /**
- * @covers FireflyIII\Http\Controllers\BudgetController::noBudget
- */
- public function testNoBudget()
- {
- $budget = FactoryMuffin::create('FireflyIII\Models\Budget');
- $this->be($budget->user);
- $repository = $this->mock('FireflyIII\Repositories\Budget\BudgetRepositoryInterface');
- $repository->shouldReceive('getWithoutBudget')->andReturn(new Collection);
-
- $this->call('GET', '/budgets/list/noBudget');
- $this->assertResponseOk();
- $this->assertViewHas('list');
- $this->assertViewHas('subTitle');
- }
-
- /**
- * @covers FireflyIII\Http\Controllers\BudgetController::postUpdateIncome
- */
- public function testPostUpdateIncome()
- {
-
-
- $budget = FactoryMuffin::create('FireflyIII\Models\Budget');
- $this->be($budget->user);
- $date = Carbon::now()->startOfMonth()->format('FY');
- Preferences::shouldReceive('set')->once()->withArgs(['budgetIncomeTotal' . $date, 1001]);
- Preferences::shouldReceive('mark')->once()->andReturn(true);
- $lastActivity = FactoryMuffin::create('FireflyIII\Models\Preference');
- $lastActivity->data = microtime();
- Preferences::shouldReceive('lastActivity')->andReturn($lastActivity);
-
- // language preference:
- $language = FactoryMuffin::create('FireflyIII\Models\Preference');
- $language->data = 'en';
- $language->save();
- Preferences::shouldReceive('get')->withAnyArgs()->andReturn($language);
-
- $this->call('POST', '/budgets/income', ['_token' => 'replaceme', 'amount' => 1001]);
- $this->assertResponseStatus(302);
- $this->assertRedirectedToRoute('budgets.index');
- }
-
- /**
- * @covers FireflyIII\Http\Controllers\BudgetController::show
- */
- public function testShow()
- {
- $budget = FactoryMuffin::create('FireflyIII\Models\Budget');
- $repository = $this->mock('FireflyIII\Repositories\Budget\BudgetRepositoryInterface');
- $this->be($budget->user);
-
- $paginator = new LengthAwarePaginator(new Collection, 0, 20, 1);
-
- Amount::shouldReceive('getCurrencyCode')->andReturn('x');
- Amount::shouldReceive('getCurrencySymbol')->andReturn('X');
- Amount::shouldReceive('format')->andReturn('x');
- $repository->shouldReceive('getJournals')->andReturn($paginator);
- $repository->shouldReceive('getBudgetLimits')->andReturn(new Collection);
-
-
- $this->call('GET', '/budgets/show/' . $budget->id);
- $this->assertResponseOk();
-
- }
-
- /**
- * @covers FireflyIII\Http\Controllers\BudgetController::show
- */
- public function testShowInvalidRepetition()
- {
-
- $repetition = FactoryMuffin::create('FireflyIII\Models\LimitRepetition');
- $budget = $repetition->budgetLimit->budget;
- $otherBudget = FactoryMuffin::create('FireflyIII\Models\Budget');
- $otherBudget->user_id = $budget->user_id;
- $otherBudget->save();
-
- $repository = $this->mock('FireflyIII\Repositories\Budget\BudgetRepositoryInterface');
- $this->be($otherBudget->user);
-
- Amount::shouldReceive('getCurrencyCode')->andReturn('x');
- Amount::shouldReceive('getCurrencySymbol')->andReturn('X');
- Amount::shouldReceive('format')->andReturn('x');
- $repository->shouldReceive('getJournals')->andReturn(new Collection);
- $repository->shouldReceive('getBudgetLimits')->andReturn(new Collection);
-
-
- $this->call('GET', '/budgets/show/' . $otherBudget->id . '/' . $repetition->id);
- $this->assertResponseOk();
- $this->assertViewHas('message', 'Invalid selection.');
-
- }
-
- /**
- * @covers FireflyIII\Http\Controllers\BudgetController::show
- */
- public function testShowRepetition()
- {
- $repetition = FactoryMuffin::create('FireflyIII\Models\LimitRepetition');
- $budget = $repetition->budgetLimit->budget;
- $repository = $this->mock('FireflyIII\Repositories\Budget\BudgetRepositoryInterface');
- $this->be($budget->user);
-
- $paginator = new LengthAwarePaginator(new Collection, 0, 20, 1);
-
- Amount::shouldReceive('getCurrencyCode')->andReturn('x');
- Amount::shouldReceive('getCurrencySymbol')->andReturn('X');
- Amount::shouldReceive('format')->andReturn('x');
- $repository->shouldReceive('getJournals')->andReturn($paginator);
- $repository->shouldReceive('getBudgetLimits')->andReturn(new Collection);
-
-
- $this->call('GET', '/budgets/show/' . $budget->id . '/' . $repetition->id);
- $this->assertResponseOk();
-
- }
-
- /**
- * @covers FireflyIII\Http\Controllers\BudgetController::store
- */
- public function testStore()
- {
- // a budget:
- $budget = FactoryMuffin::create('FireflyIII\Models\Budget');
- $this->be($budget->user);
-
- $data = [
- 'name' => 'New test budget ' . rand(1, 1000),
- '_token' => 'replaceme'
- ];
-
- // fake validation routine:
- $request = $this->mock('FireflyIII\Http\Requests\BudgetFormRequest');
- $request->shouldReceive('input')->andReturn('');
-
- // fake store routine:
- $repository = $this->mock('FireflyIII\Repositories\Budget\BudgetRepositoryInterface');
- $repository->shouldReceive('store')->andReturn($budget);
-
- $this->call('POST', '/budgets/store', $data);
- $this->assertResponseStatus(302);
- $this->assertSessionHas('success');
-
- }
-
- /**
- * @covers FireflyIII\Http\Controllers\BudgetController::store
- */
- public function testStoreAndRedirect()
- {
- // a budget:
- $budget = FactoryMuffin::create('FireflyIII\Models\Budget');
- $this->be($budget->user);
-
- $data = [
- 'name' => 'New test budget ' . rand(1, 1000),
- '_token' => 'replaceme',
- 'create_another' => 1,
- ];
-
- // fake validation routine:
- $request = $this->mock('FireflyIII\Http\Requests\BudgetFormRequest');
- $request->shouldReceive('input')->andReturn('');
-
- // fake store routine:
- $repository = $this->mock('FireflyIII\Repositories\Budget\BudgetRepositoryInterface');
- $repository->shouldReceive('store')->andReturn($budget);
-
- $this->call('POST', '/budgets/store', $data);
- $this->assertResponseStatus(302);
- $this->assertSessionHas('success');
-
- }
-
- /**
- * @covers FireflyIII\Http\Controllers\BudgetController::update
- */
- public function testUpdate()
- {
-
- // a budget:
- $budget = FactoryMuffin::create('FireflyIII\Models\Budget');
- $this->be($budget->user);
-
- $data = [
- 'name' => 'Edited test account ' . rand(1, 1000),
- 'active' => 1,
- '_token' => 'replaceme'
- ];
-
- // fake validation routine:
- $request = $this->mock('FireflyIII\Http\Requests\BudgetFormRequest');
- $request->shouldReceive('input')->andReturn('');
-
- // fake update routine:
- $repository = $this->mock('FireflyIII\Repositories\Budget\BudgetRepositoryInterface');
- $repository->shouldReceive('update')->andReturn($budget);
-
- $this->call('POST', '/budgets/update/' . $budget->id, $data);
- $this->assertResponseStatus(302);
- $this->assertSessionHas('success');
- }
-
- /**
- * @covers FireflyIII\Http\Controllers\BudgetController::update
- */
- public function testUpdateAndRedirect()
- {
-
- // a budget:
- $budget = FactoryMuffin::create('FireflyIII\Models\Budget');
- $this->be($budget->user);
-
- $data = [
- 'name' => 'Edited test account ' . rand(1, 1000),
- 'active' => 1,
- '_token' => 'replaceme',
- 'return_to_edit' => 1,
- ];
-
- // fake validation routine:
- $request = $this->mock('FireflyIII\Http\Requests\BudgetFormRequest');
- $request->shouldReceive('input')->andReturn('');
-
- // fake update routine:
- $repository = $this->mock('FireflyIII\Repositories\Budget\BudgetRepositoryInterface');
- $repository->shouldReceive('update')->andReturn($budget);
-
- $this->call('POST', '/budgets/update/' . $budget->id, $data);
- $this->assertResponseStatus(302);
- $this->assertSessionHas('success');
- }
-
- /**
- * @covers FireflyIII\Http\Controllers\BudgetController::updateIncome
- */
- public function testUpdateIncome()
- {
-
- // a budget:
- $budget = FactoryMuffin::create('FireflyIII\Models\Budget');
- $this->be($budget->user);
- $date = Carbon::now()->format('FY');
- $pref = FactoryMuffin::create('FireflyIII\Models\Preference');
- Preferences::shouldReceive('get')->withArgs(['budgetIncomeTotal' . $date, 1000])->andReturn($pref);
- Amount::shouldReceive('format')->andReturn('xx');
- Amount::shouldReceive('getCurrencyCode')->andReturn('X');
- Amount::shouldReceive('getCurrencySymbol')->andReturn('X');
- Amount::shouldReceive('getCurrencySymbol')->andReturn('X');
- $lastActivity = FactoryMuffin::create('FireflyIII\Models\Preference');
- $lastActivity->data = microtime();
- Preferences::shouldReceive('lastActivity')->andReturn($lastActivity);
-
- // language preference:
- $language = FactoryMuffin::create('FireflyIII\Models\Preference');
- $language->data = 'en';
- $language->save();
- Preferences::shouldReceive('get')->withAnyArgs()->andReturn($language);
-
-
- $this->call('GET', '/budgets/income');
- $this->assertResponseOk();
- $this->assertViewHas('amount');
- }
-}
diff --git a/tests/controllers/CategoryControllerTest.php b/tests/controllers/CategoryControllerTest.php
deleted file mode 100644
index 6fa7f76b00..0000000000
--- a/tests/controllers/CategoryControllerTest.php
+++ /dev/null
@@ -1,263 +0,0 @@
-be($category->user);
-
- $this->call('GET', '/categories/create');
- $this->assertResponseOk();
- $this->assertViewHas('subTitle', 'Create a new category');
- }
-
- /**
- * @covers FireflyIII\Http\Controllers\CategoryController::delete
- */
- public function testDelete()
- {
-
- $category = FactoryMuffin::create('FireflyIII\Models\Category');
- $this->be($category->user);
-
- $this->call('GET', '/categories/delete/' . $category->id);
- $this->assertResponseOk();
- $this->assertViewHas('subTitle', 'Delete category "' . e($category->name) . '"');
- }
-
- /**
- * @covers FireflyIII\Http\Controllers\CategoryController::destroy
- */
- public function testDestroy()
- {
- $category = FactoryMuffin::create('FireflyIII\Models\Category');
- $this->be($category->user);
-
- $repository = $this->mock('FireflyIII\Repositories\Category\CategoryRepositoryInterface');
- $repository->shouldReceive('destroy');
-
- $this->call('POST', '/categories/destroy/' . $category->id, ['_token' => 'replaceMe']);
- $this->assertResponseStatus(302);
- $this->assertSessionHas('success', 'The category "' . e($category->name) . '" was deleted.');
- }
-
- /**
- * @covers FireflyIII\Http\Controllers\CategoryController::edit
- */
- public function testEdit()
- {
- $category = FactoryMuffin::create('FireflyIII\Models\Category');
- $this->be($category->user);
-
- $this->call('GET', '/categories/edit/' . $category->id);
- $this->assertResponseOk();
- $this->assertViewHas('subTitle', 'Edit category "' . e($category->name) . '"');
- }
-
- /**
- * @covers FireflyIII\Http\Controllers\CategoryController::index
- */
- public function testIndex()
- {
- $collection = new Collection;
- $category = FactoryMuffin::create('FireflyIII\Models\Category');
- $this->be($category->user);
- $collection->push($category);
-
- Amount::shouldReceive('getCurrencyCode')->andReturn('xx');
- Amount::shouldReceive('getCurrencySymbol')->andReturn('X');
-
- $repository = $this->mock('FireflyIII\Repositories\Category\CategoryRepositoryInterface');
- $repository->shouldReceive('getCategories')->andReturn($collection);
- $repository->shouldReceive('getLatestActivity')->andReturn(new Carbon);
-
- $this->call('GET', '/categories');
- $this->assertResponseOk();
- $this->assertViewHas('categories');
- }
-
- /**
- * @covers FireflyIII\Http\Controllers\CategoryController::noCategory
- */
- public function testNoCategory()
- {
- $collection = new Collection;
- $journal = FactoryMuffin::create('FireflyIII\Models\TransactionJournal');
- $this->be($journal->user);
- $collection->push($journal);
-
- Amount::shouldReceive('format')->andReturn('xx');
- Amount::shouldReceive('getCurrencyCode')->andReturn('xx');
- Amount::shouldReceive('getCurrencySymbol')->andReturn('X');
-
-
- $repository = $this->mock('FireflyIII\Repositories\Category\CategoryRepositoryInterface');
- $repository->shouldReceive('getWithoutCategory')->andReturn($repository);
-
- $this->call('GET', '/categories/list/noCategory');
- $this->assertResponseOk();
- $this->assertViewHas('subTitle');
-
-
- }
-
- /**
- * @covers FireflyIII\Http\Controllers\CategoryController::show
- */
- public function testShow()
- {
- $category = FactoryMuffin::create('FireflyIII\Models\Category');
- $collection = new Collection;
- $journal = FactoryMuffin::create('FireflyIII\Models\TransactionJournal');
- $this->be($category->user);
- $collection->push($journal);
-
- $repository = $this->mock('FireflyIII\Repositories\Category\CategoryRepositoryInterface');
-
- $repository->shouldReceive('getJournals')->andReturn($collection);
- $repository->shouldReceive('countJournals')->andReturn(1);
-
- Amount::shouldReceive('format')->andReturn('xx');
- Amount::shouldReceive('getCurrencyCode')->andReturn('xx');
- Amount::shouldReceive('getCurrencySymbol')->andReturn('X');
- Amount::shouldReceive('formatJournal')->andReturn('xx');
-
- $this->call('GET', '/categories/show/' . $category->id);
- $this->assertResponseOk();
- $this->assertViewHas('hideCategory', true);
-
- }
-
-
- /**
- * @covers FireflyIII\Http\Controllers\CategoryController::store
- */
- public function testStore()
- {
- // create
- $category = FactoryMuffin::create('FireflyIII\Models\Category');
- $this->be($category->user);
-
- // mock
- $repository = $this->mock('FireflyIII\Repositories\Category\CategoryRepositoryInterface');
- $request = $this->mock('FireflyIII\Http\Requests\CategoryFormRequest');
-
- // expect
- $repository->shouldReceive('store')->andReturn($category);
- $request->shouldReceive('input')->andReturn('');
-
- $this->call('POST', '/categories/store', ['_token' => 'replaceMe', 'name' => 'Bla bla #' . rand(1, 1000)]);
- $this->assertResponseStatus(302);
- $this->assertSessionHas('success', 'New category "' . $category->name . '" stored!');
- }
-
- /**
- * @covers FireflyIII\Http\Controllers\CategoryController::store
- */
- public function testStoreAndRedirect()
- {
- // create
- $category = FactoryMuffin::create('FireflyIII\Models\Category');
- $this->be($category->user);
-
- // mock:
- $repository = $this->mock('FireflyIII\Repositories\Category\CategoryRepositoryInterface');
- $request = $this->mock('FireflyIII\Http\Requests\CategoryFormRequest');
-
- // fake:
- $repository->shouldReceive('store')->andReturn($category);
- $request->shouldReceive('input')->andReturn('');
-
-
- $this->call('POST', '/categories/store', ['_token' => 'replaceMe', 'create_another' => 1, 'name' => 'Bla bla #' . rand(1, 1000)]);
- $this->assertResponseStatus(302);
- $this->assertSessionHas('success', 'New category "' . $category->name . '" stored!');
- }
-
- /**
- * @covers FireflyIII\Http\Controllers\CategoryController::update
- */
- public function testUpdate()
- {
- // create
- $category = FactoryMuffin::create('FireflyIII\Models\Category');
- $this->be($category->user);
-
- // mock
- $repository = $this->mock('FireflyIII\Repositories\Category\CategoryRepositoryInterface');
- $request = $this->mock('FireflyIII\Http\Requests\CategoryFormRequest');
-
- // expect
- $repository->shouldReceive('update')->andReturn($category);
- $request->shouldReceive('input')->andReturn('');
-
- $this->call('POST', '/categories/update/' . $category->id, ['_token' => 'replaceMe', 'name' => 'Bla bla #' . rand(1, 1000)]);
- $this->assertResponseStatus(302);
- $this->assertSessionHas('success', 'Category "' . $category->name . '" updated.');
- }
-
- /**
- * @covers FireflyIII\Http\Controllers\CategoryController::update
- */
- public function testUpdateAndRedirect()
- {
- // create
- $category = FactoryMuffin::create('FireflyIII\Models\Category');
- $this->be($category->user);
-
- // mock
- $repository = $this->mock('FireflyIII\Repositories\Category\CategoryRepositoryInterface');
- $request = $this->mock('FireflyIII\Http\Requests\CategoryFormRequest');
-
- // expect
- $request->shouldReceive('input')->andReturn('');
- $repository->shouldReceive('update')->andReturn($category);
-
-
- $this->call('POST', '/categories/update/' . $category->id, ['_token' => 'replaceMe', 'return_to_edit' => 1, 'name' => 'Bla bla #' . rand(1, 1000)]);
- $this->assertResponseStatus(302);
- $this->assertSessionHas('success', 'Category "' . $category->name . '" updated.');
- }
-}
diff --git a/tests/controllers/CurrencyControllerTest.php b/tests/controllers/CurrencyControllerTest.php
deleted file mode 100644
index 50153b50b3..0000000000
--- a/tests/controllers/CurrencyControllerTest.php
+++ /dev/null
@@ -1,279 +0,0 @@
-be($user);
-
- $this->call('GET', '/currency/create');
- $this->assertResponseOk();
- $this->assertViewHas('subTitle', 'Create a new currency');
- $this->assertViewHas('subTitleIcon', 'fa-plus');
-
- }
-
- /**
- * @covers FireflyIII\Http\Controllers\CurrencyController::defaultCurrency
- */
- public function testDefaultCurrency()
- {
- $user = FactoryMuffin::create('FireflyIII\User');
- $this->be($user);
- $currency = FactoryMuffin::create('FireflyIII\Models\TransactionCurrency');
-
- $this->call('GET', '/currency/default/' . $currency->id);
- $this->assertResponseStatus(302);
- $this->assertSessionHas('success', $currency->name . ' is now the default currency.');
- }
-
- /**
- * @covers FireflyIII\Http\Controllers\CurrencyController::delete
- */
- public function testDelete()
- {
- $user = FactoryMuffin::create('FireflyIII\User');
- $this->be($user);
- $currency = FactoryMuffin::create('FireflyIII\Models\TransactionCurrency');
-
- $repository = $this->mock('FireflyIII\Repositories\Currency\CurrencyRepositoryInterface');
- $repository->shouldReceive('countJournals')->andReturn(0);
-
- $this->call('GET', '/currency/delete/' . $currency->id);
- $this->assertResponseOk();
- $this->assertViewHas('currency');
-
- }
-
- /**
- * @covers FireflyIII\Http\Controllers\CurrencyController::delete
- */
- public function testDeleteUnable()
- {
- $user = FactoryMuffin::create('FireflyIII\User');
- $this->be($user);
- $currency = FactoryMuffin::create('FireflyIII\Models\TransactionCurrency');
-
- $repository = $this->mock('FireflyIII\Repositories\Currency\CurrencyRepositoryInterface');
- $repository->shouldReceive('countJournals')->andReturn(1);
-
- $this->call('GET', '/currency/delete/' . $currency->id);
- $this->assertResponseStatus(302);
- $this->assertSessionHas('error');
-
- }
-
- /**
- * @covers FireflyIII\Http\Controllers\CurrencyController::destroy
- */
- public function testDestroy()
- {
- $user = FactoryMuffin::create('FireflyIII\User');
- $role = FactoryMuffin::create('FireflyIII\Models\Role');
- $role->name = 'owner';
- $role->save();
- $user->attachRole($role);
-
- $this->be($user);
- $currency = FactoryMuffin::create('FireflyIII\Models\TransactionCurrency');
-
- $repository = $this->mock('FireflyIII\Repositories\Currency\CurrencyRepositoryInterface');
- $repository->shouldReceive('countJournals')->andReturn(0);
-
- $this->call('POST', '/currency/destroy/' . $currency->id, ['_token' => 'replaceMe']);
- $this->assertResponseStatus(302);
- $this->assertSessionHas('success', 'Currency "' . e($currency->name) . '" deleted');
-
- }
-
- /**
- * @covers FireflyIII\Http\Controllers\CurrencyController::destroy
- */
- public function testDestroyUnable()
- {
- $user = FactoryMuffin::create('FireflyIII\User');
- $role = FactoryMuffin::create('FireflyIII\Models\Role');
- $role->name = 'owner';
- $role->save();
- $user->attachRole($role);
- $this->be($user);
- $currency = FactoryMuffin::create('FireflyIII\Models\TransactionCurrency');
-
- $repository = $this->mock('FireflyIII\Repositories\Currency\CurrencyRepositoryInterface');
- $repository->shouldReceive('countJournals')->andReturn(1);
-
- $this->call('POST', '/currency/destroy/' . $currency->id, ['_token' => 'replaceMe']);
- $this->assertResponseStatus(302);
- $this->assertSessionHas('error');
-
- }
-
- /**
- * @covers FireflyIII\Http\Controllers\CurrencyController::edit
- */
- public function testEdit()
- {
- $user = FactoryMuffin::create('FireflyIII\User');
- $this->be($user);
- $currency = FactoryMuffin::create('FireflyIII\Models\TransactionCurrency');
-
- $repository = $this->mock('FireflyIII\Repositories\Currency\CurrencyRepositoryInterface');
- $repository->shouldReceive('countJournals')->andReturn(0);
-
- $this->call('GET', '/currency/edit/' . $currency->id);
- $this->assertResponseOk();
- $this->assertViewHas('currency');
- }
-
- /**
- * @covers FireflyIII\Http\Controllers\CurrencyController::index
- */
- public function testIndex()
- {
- $user = FactoryMuffin::create('FireflyIII\User');
- $currency = FactoryMuffin::create('FireflyIII\Models\TransactionCurrency');
- $this->be($user);
-
- $repository = $this->mock('FireflyIII\Repositories\Currency\CurrencyRepositoryInterface');
- $repository->shouldReceive('get')->andReturn(new Collection);
- $repository->shouldReceive('getCurrencyByPreference')->andReturn($currency);
-
- $this->call('GET', '/currency');
- $this->assertResponseOk();
- }
-
- /**
- * @covers FireflyIII\Http\Controllers\CurrencyController::store
- */
- public function testStore()
- {
- $user = FactoryMuffin::create('FireflyIII\User');
- $role = FactoryMuffin::create('FireflyIII\Models\Role');
- $role->name = 'owner';
- $role->save();
- $user->attachRole($role);
- $currency = FactoryMuffin::create('FireflyIII\Models\TransactionCurrency');
- $this->be($user);
-
- $repository = $this->mock('FireflyIII\Repositories\Currency\CurrencyRepositoryInterface');
- $request = $this->mock('FireflyIII\Http\Requests\CurrencyFormRequest');
- $request->shouldReceive('getCurrencyData')->andReturn([]);
- $repository->shouldReceive('store')->andReturn($currency);
-
- $this->call('POST', '/currency/store', ['_token' => 'replaceMe']);
- $this->assertResponseStatus(302);
- $this->assertSessionHas('success');
-
-
- }
-
- /**
- * @covers FireflyIII\Http\Controllers\CurrencyController::store
- */
- public function testStoreAndReturn()
- {
- $user = FactoryMuffin::create('FireflyIII\User');
- $role = FactoryMuffin::create('FireflyIII\Models\Role');
- $role->name = 'owner';
- $role->save();
- $user->attachRole($role);
- $currency = FactoryMuffin::create('FireflyIII\Models\TransactionCurrency');
- $this->be($user);
-
- $repository = $this->mock('FireflyIII\Repositories\Currency\CurrencyRepositoryInterface');
- $request = $this->mock('FireflyIII\Http\Requests\CurrencyFormRequest');
- $request->shouldReceive('getCurrencyData')->andReturn([]);
- $repository->shouldReceive('store')->andReturn($currency);
-
- $this->call('POST', '/currency/store', ['_token' => 'replaceMe', 'create_another' => 1]);
- $this->assertResponseStatus(302);
- $this->assertSessionHas('success');
-
-
- }
-
- /**
- * @covers FireflyIII\Http\Controllers\CurrencyController::update
- */
- public function testUpdate()
- {
- $user = FactoryMuffin::create('FireflyIII\User');
- $role = FactoryMuffin::create('FireflyIII\Models\Role');
- $role->name = 'owner';
- $role->save();
- $user->attachRole($role);
- $currency = FactoryMuffin::create('FireflyIII\Models\TransactionCurrency');
- $this->be($user);
-
- $repository = $this->mock('FireflyIII\Repositories\Currency\CurrencyRepositoryInterface');
- $request = $this->mock('FireflyIII\Http\Requests\CurrencyFormRequest');
- $request->shouldReceive('getCurrencyData')->andReturn([]);
- $repository->shouldReceive('update')->andReturn($currency);
-
- $this->call('POST', '/currency/update/' . $currency->id, ['_token' => 'replaceMe']);
- $this->assertResponseStatus(302);
- $this->assertSessionHas('success');
- }
-
- /**
- * @covers FireflyIII\Http\Controllers\CurrencyController::update
- */
- public function testUpdateAndReturn()
- {
- $user = FactoryMuffin::create('FireflyIII\User');
- $role = FactoryMuffin::create('FireflyIII\Models\Role');
- $role->name = 'owner';
- $role->save();
- $user->attachRole($role);
- $currency = FactoryMuffin::create('FireflyIII\Models\TransactionCurrency');
- $this->be($user);
-
- $repository = $this->mock('FireflyIII\Repositories\Currency\CurrencyRepositoryInterface');
- $request = $this->mock('FireflyIII\Http\Requests\CurrencyFormRequest');
- $request->shouldReceive('getCurrencyData')->andReturn([]);
- $repository->shouldReceive('update')->andReturn($currency);
-
- $this->call('POST', '/currency/update/' . $currency->id, ['_token' => 'replaceMe', 'return_to_edit' => 1]);
- $this->assertResponseStatus(302);
- $this->assertSessionHas('success');
- }
-}
diff --git a/tests/controllers/HelpControllerTest.php b/tests/controllers/HelpControllerTest.php
deleted file mode 100644
index b7f40c5f5a..0000000000
--- a/tests/controllers/HelpControllerTest.php
+++ /dev/null
@@ -1,104 +0,0 @@
-be($user);
- // mock some stuff.
- $interface = $this->mock('FireflyIII\Helpers\Help\HelpInterface');
- $interface->shouldReceive('hasRoute')->once()->with('accounts.index')->andReturn(true);
- $interface->shouldReceive('getFromCache')->once()->with('help.accounts.index.title')->andReturn('Title.');
- $interface->shouldReceive('getFromCache')->once()->with('help.accounts.index.text')->andReturn('Text');
- $interface->shouldReceive('inCache')->andReturn(true);
-
-
- $this->call('GET', '/help/accounts.index');
- $this->assertResponseOk();
- }
-
- /**
- * Everything present and accounted for, but not cached
- *
- * @covers FireflyIII\Http\Controllers\HelpController::show
- */
- public function testGetHelpTextNoCache()
- {
- // login
- $user = FactoryMuffin::create('FireflyIII\User');
- $content = ['title' => 'Bla', 'text' => 'Bla'];
-
- $this->be($user);
- // mock some stuff.
- $interface = $this->mock('FireflyIII\Helpers\Help\HelpInterface');
- $interface->shouldReceive('hasRoute')->once()->with('accounts.index')->andReturn(true);
- $interface->shouldReceive('getFromGithub')->once()->with('accounts.index')->andReturn($content);
- $interface->shouldReceive('putInCache')->once()->withArgs(['accounts.index', $content]);
- $interface->shouldReceive('inCache')->once()->andReturn(false);
-
-
- $this->call('GET', '/help/accounts.index');
- $this->assertResponseOk();
- }
-
- /**
- * No such route.
- *
- * @covers FireflyIII\Http\Controllers\HelpController::show
- */
- public function testGetHelpTextNoRoute()
- {
- // login
- $user = FactoryMuffin::create('FireflyIII\User');
-
- $this->be($user);
- // mock some stuff.
- $interface = $this->mock('FireflyIII\Helpers\Help\HelpInterface');
- $interface->shouldReceive('hasRoute')->once()->with('accounts.index')->andReturn(false);
-
-
- $this->call('GET', '/help/accounts.index');
- $this->assertResponseOk();
- }
-}
diff --git a/tests/controllers/HomeControllerTest.php b/tests/controllers/HomeControllerTest.php
deleted file mode 100644
index f4595b017e..0000000000
--- a/tests/controllers/HomeControllerTest.php
+++ /dev/null
@@ -1,159 +0,0 @@
-be($user);
-
-
- $this->call('POST', '/daterange', ['end' => $end, 'start' => $start, '_token' => 'replaceme']);
- $this->assertResponseOk();
-
- $this->assertSessionHas('start');
- $this->assertSessionHas('end');
-
- }
-
-
- /**
- * @covers FireflyIII\Http\Controllers\HomeController::dateRange
- */
- public function testDateRangeWarning()
- {
- $start = '2014-03-01';
- $end = '2015-03-31';
- $user = FactoryMuffin::create('FireflyIII\User');
- $this->be($user);
-
- $this->call('POST', '/daterange', ['end' => $end, 'start' => $start, '_token' => 'replaceme']);
- $this->assertResponseOk();
-
- $this->assertSessionHas('start');
- $this->assertSessionHas('end');
- $this->assertSessionHas('warning');
- }
-
- /**
- * @covers FireflyIII\Http\Controllers\HomeController::flush
- */
- public function testFlush()
- {
- $user = FactoryMuffin::create('FireflyIII\User');
- $this->be($user);
-
- // create at least one tag:
- $tag = FactoryMuffin::create('FireflyIII\Models\Tag');
- $journal = FactoryMuffin::create('FireflyIII\Models\TransactionJournal');
- $journal->tags()->save($tag);
-
- $this->call('GET', '/flush');
- $this->assertResponseStatus(302);
-
- }
-
- /**
- * @covers FireflyIII\Http\Controllers\HomeController::index
- */
- public function testIndex()
- {
- $user = FactoryMuffin::create('FireflyIII\User');
- $preference = FactoryMuffin::create('FireflyIII\Models\Preference');
- $journal = FactoryMuffin::create('FireflyIII\Models\TransactionJournal');
- $journals = new Collection([$journal]);
- $account = FactoryMuffin::create('FireflyIII\Models\Account');
- $accounts = new Collection([$account]);
- $repository = $this->mock('FireflyIII\Repositories\Account\AccountRepositoryInterface');
-
- $this->be($user);
-
- // mock ALL THE THINGS!
- $repository->shouldReceive('countAccounts')->once()->andReturn(3);
- Preferences::shouldReceive('get')->once()->withArgs(['frontPageAccounts', []])->andReturn($preference);
- $repository->shouldReceive('getFrontpageAccounts')->once()->with($preference)->andReturn($accounts);
- $repository->shouldReceive('getSavingsAccounts')->once()->andReturn($accounts);
- $repository->shouldReceive('getPiggyBankAccounts')->once()->andReturn($accounts);
- $repository->shouldReceive('sumOfEverything')->once()->andReturn(1);
- $repository->shouldReceive('getFrontpageTransactions')->once()->andReturn($journals);
-
- // language preference:
- $language = FactoryMuffin::create('FireflyIII\Models\Preference');
- $language->data = 'en';
- $language->save();
- Preferences::shouldReceive('get')->withAnyArgs()->andReturn($language);
-
- $lastActivity = FactoryMuffin::create('FireflyIII\Models\Preference');
- $lastActivity->data = microtime();
- Preferences::shouldReceive('lastActivity')->andReturn($lastActivity);
-
-
- Amount::shouldReceive('getCurrencyCode')->andReturn('EUR');
- Amount::shouldReceive('getCurrencySymbol')->andReturn('X');
- Amount::shouldReceive('format')->andReturn('xxx');
- Amount::shouldReceive('formatJournal')->with($journal)->andReturn('xxx');
-
- $this->call('GET', '/');
- $this->assertResponseOk();
-
- }
-
- /**
- * @covers FireflyIII\Http\Controllers\HomeController::index
- */
- public function testIndexEmpty()
- {
- $user = FactoryMuffin::create('FireflyIII\User');
- $repository = $this->mock('FireflyIII\Repositories\Account\AccountRepositoryInterface');
-
- $this->be($user);
-
- // mock ALL THE THINGS!
- $repository->shouldReceive('countAccounts')->once()->andReturn(0);
-
- // language preference:
- $language = FactoryMuffin::create('FireflyIII\Models\Preference');
- $language->data = 'en';
- $language->save();
- Preferences::shouldReceive('get')->withAnyArgs()->andReturn($language);
-
- $lastActivity = FactoryMuffin::create('FireflyIII\Models\Preference');
- $lastActivity->data = microtime();
- Preferences::shouldReceive('lastActivity')->andReturn($lastActivity);
-
- $this->call('GET', '/');
- $this->assertResponseStatus(302);
- $this->assertRedirectedToRoute('new-user.index');
- }
-
-}
diff --git a/tests/controllers/JsonControllerTest.php b/tests/controllers/JsonControllerTest.php
deleted file mode 100644
index 51ab83c92c..0000000000
--- a/tests/controllers/JsonControllerTest.php
+++ /dev/null
@@ -1,228 +0,0 @@
- new Carbon, 'end' => new Carbon]];
- $this->be($bill->user);
-
- $bills = $this->mock('FireflyIII\Repositories\Bill\BillRepositoryInterface');
- $accounts = $this->mock('FireflyIII\Repositories\Account\AccountRepositoryInterface');
-
- // mock!
- $bills->shouldReceive('getActiveBills')->andReturn($collection);
- $bills->shouldReceive('getRanges')->andReturn($ranges);
- $bills->shouldReceive('getJournalsInRange')->andReturn(new Collection);
- $bills->shouldReceive('billPaymentsInRange')->andReturn(12);
- $accounts->shouldReceive('getCreditCards')->andReturn($ccs);
- $accounts->shouldReceive('getTransfersInRange')->andReturn(new Collection);
- Amount::shouldReceive('format')->andReturn('xx');
- Amount::shouldReceive('getCurrencyCode')->andReturn('X');
- Amount::shouldReceive('getCurrencySymbol')->andReturn('X');
- Steam::shouldReceive('balance')->andReturn(0);
-
-
- $this->call('GET', '/json/box/bills-paid');
- $this->assertResponseOk();
-
- }
-
- /**
- * @covers FireflyIII\Http\Controllers\JsonController::boxBillsUnpaid
- */
- public function testBoxBillsUnpaid()
- {
- $bill = FactoryMuffin::create('FireflyIII\Models\Bill');
- $creditCard = FactoryMuffin::create('FireflyIII\Models\Account');
- $ccs = new Collection([$creditCard]);
- $collection = new Collection([$bill]);
- $ranges = [['start' => new Carbon, 'end' => new Carbon]];
- $this->be($bill->user);
-
- $bills = $this->mock('FireflyIII\Repositories\Bill\BillRepositoryInterface');
- $accounts = $this->mock('FireflyIII\Repositories\Account\AccountRepositoryInterface');
-
- // mock!
- $bills->shouldReceive('getActiveBills')->andReturn($collection);
- $bills->shouldReceive('getRanges')->andReturn($ranges);
- $bills->shouldReceive('getJournalsInRange')->andReturn(new Collection);
- $bills->shouldReceive('createFakeBill')->andReturn($bill);
- $accounts->shouldReceive('getCreditCards')->andReturn($ccs);
- Amount::shouldReceive('format')->andReturn('xx');
- Amount::shouldReceive('getCurrencyCode')->andReturn('X');
- Amount::shouldReceive('getCurrencySymbol')->andReturn('X');
- Steam::shouldReceive('balance')->andReturn(-1);
-
- $this->call('GET', '/json/box/bills-unpaid');
- $this->assertResponseOk();
- }
-
- /**
- * @covers FireflyIII\Http\Controllers\JsonController::boxIn
- */
- public function testBoxIn()
- {
- $user = FactoryMuffin::create('FireflyIII\User');
- $this->be($user);
-
- $repository = $this->mock('FireflyIII\Helpers\Report\ReportQueryInterface');
- $repository->shouldReceive('incomeInPeriodCorrected')->andReturn(new Collection);
- Amount::shouldReceive('format')->andReturn('xx');
- Amount::shouldReceive('getCurrencyCode')->andReturn('X');
- Amount::shouldReceive('getCurrencySymbol')->andReturn('X');
-
- $this->call('GET', '/json/box/in');
- $this->assertResponseOk();
- }
-
- /**
- * @covers FireflyIII\Http\Controllers\JsonController::boxOut
- */
- public function testBoxOut()
- {
- $user = FactoryMuffin::create('FireflyIII\User');
- $this->be($user);
-
- $repository = $this->mock('FireflyIII\Helpers\Report\ReportQueryInterface');
- $repository->shouldReceive('expenseInPeriodCorrected')->andReturn(new Collection);
- Amount::shouldReceive('format')->andReturn('xx');
- Amount::shouldReceive('getCurrencyCode')->andReturn('X');
- Amount::shouldReceive('getCurrencySymbol')->andReturn('X');
-
- $this->call('GET', '/json/box/out');
- $this->assertResponseOk();
- }
-
- /**
- * @covers FireflyIII\Http\Controllers\JsonController::categories
- */
- public function testCategories()
- {
- $category = FactoryMuffin::create('FireflyIII\Models\Category');
- $this->be($category->user);
- $categories = new Collection([$category]);
-
- $repository = $this->mock('FireflyIII\Repositories\Category\CategoryRepositoryInterface');
- $repository->shouldReceive('getCategories')->andReturn($categories);
-
- $this->call('GET', '/json/categories');
- $this->assertResponseOk();
- }
-
- /**
- * @covers FireflyIII\Http\Controllers\JsonController::expenseAccounts
- */
- public function testExpenseAccounts()
- {
- $account = FactoryMuffin::create('FireflyIII\Models\Account');
- $this->be($account->user);
- $accounts = new Collection([$account]);
-
- $repository = $this->mock('FireflyIII\Repositories\Account\AccountRepositoryInterface');
- $repository->shouldReceive('getAccounts')->with(['Expense account', 'Beneficiary account'])->andReturn($accounts);
-
- $this->call('GET', '/json/expense-accounts');
- $this->assertResponseOk();
- }
-
- /**
- * @covers FireflyIII\Http\Controllers\JsonController::revenueAccounts
- */
- public function testRevenueAccounts()
- {
- $account = FactoryMuffin::create('FireflyIII\Models\Account');
- $this->be($account->user);
- $accounts = new Collection([$account]);
-
- $repository = $this->mock('FireflyIII\Repositories\Account\AccountRepositoryInterface');
- $repository->shouldReceive('getAccounts')->with(['Revenue account'])->andReturn($accounts);
-
- $this->call('GET', '/json/revenue-accounts');
- $this->assertResponseOk();
- }
-
- /**
- * @covers FireflyIII\Http\Controllers\JsonController::tags
- */
- public function testTags()
- {
- $user = FactoryMuffin::create('FireflyIII\User');
- $this->be($user);
- $tag = FactoryMuffin::create('FireflyIII\Models\Tag');
- $tag->user()->associate($user);
-
- $tag->save();
- $this->be($tag->user);
- $tags = new Collection([$tag]);
-
- $repository = $this->mock('FireflyIII\Repositories\Tag\TagRepositoryInterface');
- $repository->shouldReceive('get')->andReturn($tags);
-
- $this->call('GET', '/json/tags');
- $this->assertResponseOk();
- }
-
- /**
- * @covers FireflyIII\Http\Controllers\JsonController::transactionJournals
- */
- public function testTransactionJournals()
- {
- $journal = FactoryMuffin::create('FireflyIII\Models\TransactionJournal');
- $type = FactoryMuffin::create('FireflyIII\Models\TransactionType');
- $collection = new Collection([$journal]);
- $user = FactoryMuffin::create('FireflyIII\User');
- $this->be($user);
-
- $repository = $this->mock('FireflyIII\Repositories\Journal\JournalRepositoryInterface');
- $repository->shouldReceive('getTransactionType')->with('withdrawal')->andReturn($type);
- $repository->shouldReceive('getJournalsOfType')->with($type)->andReturn($collection);
-
-
- $this->call('GET', '/json/transaction-journals/withdrawal');
- $this->assertResponseOk();
- }
-
-}
diff --git a/tests/controllers/NewUserControllerTest.php b/tests/controllers/NewUserControllerTest.php
deleted file mode 100644
index 3016148bd8..0000000000
--- a/tests/controllers/NewUserControllerTest.php
+++ /dev/null
@@ -1,110 +0,0 @@
-mock('FireflyIII\Repositories\Account\AccountRepositoryInterface');
-
- $this->be($user);
-
- // mock ALL THE THINGS!
- $repository->shouldReceive('countAccounts')->once()->andReturn(0);
-
- // language preference:
- $language = FactoryMuffin::create('FireflyIII\Models\Preference');
- $language->data = 'en';
- $language->save();
- Preferences::shouldReceive('get')->withAnyArgs()->andReturn($language);
-
- $lastActivity = FactoryMuffin::create('FireflyIII\Models\Preference');
- $lastActivity->data = microtime();
- Preferences::shouldReceive('lastActivity')->andReturn($lastActivity);
- Amount::shouldReceive('getCurrencyCode')->andReturn('X');
- Amount::shouldReceive('getCurrencySymbol')->andReturn('X');
-
- $this->call('GET', '/new-user');
- $this->assertResponseStatus(200);
- }
-
- public function testIndexNoAccounts()
- {
- $user = FactoryMuffin::create('FireflyIII\User');
- $repository = $this->mock('FireflyIII\Repositories\Account\AccountRepositoryInterface');
-
-
- $this->be($user);
-
- // mock ALL THE THINGS!
- $repository->shouldReceive('countAccounts')->once()->andReturn(3);
-
- // language preference:
- $language = FactoryMuffin::create('FireflyIII\Models\Preference');
- $language->data = 'en';
- $language->save();
- Preferences::shouldReceive('get')->withAnyArgs()->andReturn($language);
-
- $lastActivity = FactoryMuffin::create('FireflyIII\Models\Preference');
- $lastActivity->data = microtime();
- Preferences::shouldReceive('lastActivity')->andReturn($lastActivity);
-
- $this->call('GET', '/new-user');
- $this->assertResponseStatus(302);
- $this->assertRedirectedToRoute('index');
-
- }
-
- public function testPostIndex()
- {
- $user = FactoryMuffin::create('FireflyIII\User');
- $currency = FactoryMuffin::create('FireflyIII\Models\TransactionCurrency');
- $account = FactoryMuffin::create('FireflyIII\Models\Account');
- $repository = $this->mock('FireflyIII\Repositories\Account\AccountRepositoryInterface');
- $this->be($user);
-
- $data = [
- '_token' => 'replaceMe',
- 'bank_name' => 'Some Bank',
- 'bank_balance' => '100',
- 'balance_currency_id' => $currency->id,
- 'savings_balance' => '100',
- 'credit_card_limit' => '100',
-
- ];
-
- $repository->shouldReceive('store')->andReturn($account);
-
- $this->call('POST', '/new-user/submit', $data);
- $this->assertResponseStatus(302);
- $this->assertRedirectedToRoute('index');
-
- }
-
-}
diff --git a/tests/controllers/PiggyBankControllerTest.php b/tests/controllers/PiggyBankControllerTest.php
deleted file mode 100644
index 884943a5aa..0000000000
--- a/tests/controllers/PiggyBankControllerTest.php
+++ /dev/null
@@ -1,454 +0,0 @@
-be($piggyBank->account->user);
-
-
- // mock
- /** @var Mockery\MockInterface $repository */
- $repository = $this->mock('FireflyIII\Repositories\Account\AccountRepositoryInterface');
- $repository->shouldReceive('leftOnAccount')->withAnyArgs()->andReturn(12);
- Amount::shouldReceive('format')->andReturn('XXxx');
- Amount::shouldReceive('getCurrencyCode')->andReturn('X');
- Amount::shouldReceive('getCurrencySymbol')->andReturn('X');
- Amount::shouldReceive('getCurrencySymbol')->andReturn('X');
-
- $this->call('GET', '/piggy-banks/add/' . $piggyBank->id);
- $this->assertResponseOk();
- }
-
- /**
- * @covers FireflyIII\Http\Controllers\PiggyBankController::create
- */
- public function testCreate()
- {
- $account = FactoryMuffin::create('FireflyIII\Models\Account');
- $collection = new Collection([$account]);
- $user = FactoryMuffin::create('FireflyIII\User');
- $this->be($user);
-
- // mock
- $repository = $this->mock('FireflyIII\Repositories\Account\AccountRepositoryInterface');
- $repository->shouldReceive('getAccounts')->once()->with(['Default account', 'Asset account'])->andReturn($collection);
- ExpandedForm::shouldReceive('makeSelectList')->with($collection)->andReturn([]);
-
- // also cover the view now that we've touched ExpandedForm:
- ExpandedForm::shouldReceive('text')->andReturn('');
- ExpandedForm::shouldReceive('select')->andReturn('');
- ExpandedForm::shouldReceive('amount')->andReturn('');
- ExpandedForm::shouldReceive('date')->andReturn('');
- ExpandedForm::shouldReceive('checkbox')->andReturn('');
- ExpandedForm::shouldReceive('optionsList')->andReturn('');
-
- $this->call('GET', '/piggy-banks/create');
- $this->assertResponseOk();
- }
-
- /**
- * @covers FireflyIII\Http\Controllers\PiggyBankController::delete
- */
- public function testDelete()
- {
- $piggyBank = FactoryMuffin::create('FireflyIII\Models\PiggyBank');
- $this->be($piggyBank->account->user);
-
-
- $this->call('GET', '/piggy-banks/delete/' . $piggyBank->id);
- $this->assertResponseOk();
- $this->assertViewHas('subTitle', 'Delete piggy bank "' . e($piggyBank->name) . '"');
- }
-
- /**
- * @covers FireflyIII\Http\Controllers\PiggyBankController::destroy
- */
- public function testDestroy()
- {
- $piggyBank = FactoryMuffin::create('FireflyIII\Models\PiggyBank');
- $this->be($piggyBank->account->user);
-
- $repository = $this->mock('FireflyIII\Repositories\PiggyBank\PiggyBankRepositoryInterface');
- $repository->shouldReceive('destroy')->once()->withAnyArgs()->andReturn(true);
-
-
- $this->call('POST', '/piggy-banks/destroy/' . $piggyBank->id, ['_token' => 'replaceMe']);
- $this->assertResponseStatus(302);
- $this->assertSessionHas('success');
-
- }
-
- /**
- * @covers FireflyIII\Http\Controllers\PiggyBankController::edit
- */
- public function testEdit()
- {
- $piggyBank = FactoryMuffin::create('FireflyIII\Models\PiggyBank');
- $piggyBank->targetdate = Carbon::now()->addYear();
- $piggyBank->save();
- $this->be($piggyBank->account->user);
- $account = FactoryMuffin::create('FireflyIII\Models\Account');
- $collection = new Collection([$account]);
-
- // mock!
- $repository = $this->mock('FireflyIII\Repositories\Account\AccountRepositoryInterface');
- $repository->shouldReceive('getAccounts')->once()->with(['Default account', 'Asset account'])->andReturn($collection);
- ExpandedForm::shouldReceive('makeSelectList')->with($collection)->andReturn([]);
-
- // also cover the view now that we've touched ExpandedForm:
- ExpandedForm::shouldReceive('text')->andReturn('');
- ExpandedForm::shouldReceive('select')->andReturn('');
- ExpandedForm::shouldReceive('amount')->andReturn('');
- ExpandedForm::shouldReceive('date')->andReturn('');
- ExpandedForm::shouldReceive('checkbox')->andReturn('');
- ExpandedForm::shouldReceive('optionsList')->andReturn('');
-
-
- $this->call('GET', '/piggy-banks/edit/' . $piggyBank->id);
- $this->assertResponseOk();
- }
-
- /**
- * @covers FireflyIII\Http\Controllers\PiggyBankController::edit
- */
- public function testEditNullDate()
- {
- $piggyBank = FactoryMuffin::create('FireflyIII\Models\PiggyBank');
- $this->be($piggyBank->account->user);
- $piggyBank->targetdate = null;
- $piggyBank->save();
- $account = FactoryMuffin::create('FireflyIII\Models\Account');
- $collection = new Collection([$account]);
-
- // mock!
- $repository = $this->mock('FireflyIII\Repositories\Account\AccountRepositoryInterface');
- $repository->shouldReceive('getAccounts')->once()->with(['Default account', 'Asset account'])->andReturn($collection);
- ExpandedForm::shouldReceive('makeSelectList')->with($collection)->andReturn([]);
-
- // also cover the view now that we've touched ExpandedForm:
- ExpandedForm::shouldReceive('text')->andReturn('');
- ExpandedForm::shouldReceive('select')->andReturn('');
- ExpandedForm::shouldReceive('amount')->andReturn('');
- ExpandedForm::shouldReceive('date')->andReturn('');
- ExpandedForm::shouldReceive('checkbox')->andReturn('');
- ExpandedForm::shouldReceive('optionsList')->andReturn('');
-
-
- $this->call('GET', '/piggy-banks/edit/' . $piggyBank->id);
- $this->assertResponseOk();
- }
-
- /**
- * @covers FireflyIII\Http\Controllers\PiggyBankController::index
- */
- public function testIndex()
- {
- $piggyBank1 = FactoryMuffin::create('FireflyIII\Models\PiggyBank');
- $piggyBank2 = FactoryMuffin::create('FireflyIII\Models\PiggyBank');
- $piggyBank3 = FactoryMuffin::create('FireflyIII\Models\PiggyBank');
- $piggyBank2->account_id = $piggyBank1->account_id;
- $user = FactoryMuffin::create('FireflyIII\User');
-
- $piggyBank2->save();
-
- $collection = new Collection([$piggyBank1, $piggyBank2, $piggyBank3]);
- $this->be($user);
-
- // mock!
- $accounts = $this->mock('FireflyIII\Repositories\Account\AccountRepositoryInterface');
- $piggyBanks = $this->mock('FireflyIII\Repositories\PiggyBank\PiggyBankRepositoryInterface');
-
- // act!
- $piggyBanks->shouldReceive('getPiggyBanks')->once()->andReturn($collection);
- Steam::shouldReceive('balance')->andReturn(20);
- $accounts->shouldReceive('leftOnAccount')->andReturn(12);
- Amount::shouldReceive('format')->andReturn('123');
- Amount::shouldReceive('getCurrencyCode')->andReturn('X');
- Amount::shouldReceive('getCurrencySymbol')->andReturn('X');
-
-
- $this->call('GET', '/piggy-banks');
- $this->assertResponseOk();
-
- }
-
- /**
- * @covers FireflyIII\Http\Controllers\PiggyBankController::order
- */
- public function testOrder()
- {
- $piggyBank1 = FactoryMuffin::create('FireflyIII\Models\PiggyBank');
- $piggyBank2 = FactoryMuffin::create('FireflyIII\Models\PiggyBank');
- $user = FactoryMuffin::create('FireflyIII\User');
- $this->be($user);
-
- // mock!
- $piggyBanks = $this->mock('FireflyIII\Repositories\PiggyBank\PiggyBankRepositoryInterface');
- $piggyBanks->shouldReceive('reset')->once();
- $piggyBanks->shouldReceive('setOrder');
- $array = [
- $piggyBank1->id => 0,
- $piggyBank2->id => 1,
- ];
-
- $this->call('POST', '/piggy-banks/sort', ['_token' => 'replaceMe', 'order' => $array]);
- $this->assertResponseOk();
- }
-
- /**
- * @covers FireflyIII\Http\Controllers\PiggyBankController::postAdd
- */
- public function testPostAdd()
- {
- $piggyBank = FactoryMuffin::create('FireflyIII\Models\PiggyBank');
- $this->be($piggyBank->account->user);
-
- // mock!
- $accounts = $this->mock('FireflyIII\Repositories\Account\AccountRepositoryInterface');
- $piggyBanks = $this->mock('FireflyIII\Repositories\PiggyBank\PiggyBankRepositoryInterface');
- $accounts->shouldReceive('leftOnAccount')->andReturn(20);
- $piggyBanks->shouldReceive('createEvent')->once();
-
- Amount::shouldReceive('format')->andReturn('something');
- Amount::shouldReceive('getCurrencyCode')->andReturn('X');
- Amount::shouldReceive('getCurrencySymbol')->andReturn('X');
-
- $this->call('POST', '/piggy-banks/add/' . $piggyBank->id, ['_token' => 'replaceMe']);
- $this->assertResponseStatus(302);
- }
-
- /**
- * @covers FireflyIII\Http\Controllers\PiggyBankController::postAdd
- */
- public function testPostAddOverdraw()
- {
- $piggyBank = FactoryMuffin::create('FireflyIII\Models\PiggyBank');
- $this->be($piggyBank->account->user);
-
- // mock!
- $accounts = $this->mock('FireflyIII\Repositories\Account\AccountRepositoryInterface');
- $accounts->shouldReceive('leftOnAccount')->andReturn(20);
-
- Amount::shouldReceive('format')->andReturn('something');
- Amount::shouldReceive('getCurrencyCode')->andReturn('X');
- Amount::shouldReceive('getCurrencySymbol')->andReturn('X');
-
- $this->call('POST', '/piggy-banks/add/' . $piggyBank->id, ['_token' => 'replaceMe', 'amount' => '10000']);
- $this->assertResponseStatus(302);
- }
-
- /**
- * @covers FireflyIII\Http\Controllers\PiggyBankController::postRemove
- */
- public function testPostRemove()
- {
- $piggyBank = FactoryMuffin::create('FireflyIII\Models\PiggyBank');
- $this->be($piggyBank->account->user);
-
- // mock!
- $accounts = $this->mock('FireflyIII\Repositories\Account\AccountRepositoryInterface');
- $piggyBanks = $this->mock('FireflyIII\Repositories\PiggyBank\PiggyBankRepositoryInterface');
- $accounts->shouldReceive('leftOnAccount')->andReturn(20);
- $piggyBanks->shouldReceive('createEvent')->once();
-
- Amount::shouldReceive('format')->andReturn('something');
- Amount::shouldReceive('getCurrencySymbol')->andReturn('something');
-
- $this->call('POST', '/piggy-banks/remove/' . $piggyBank->id, ['_token' => 'replaceMe']);
- $this->assertResponseStatus(302);
- }
-
- public function testPostRemoveOverdraw()
- {
- $piggyBank = FactoryMuffin::create('FireflyIII\Models\PiggyBank');
- $this->be($piggyBank->account->user);
-
- // mock!
- $accounts = $this->mock('FireflyIII\Repositories\Account\AccountRepositoryInterface');
- $accounts->shouldReceive('leftOnAccount')->andReturn(20);
-
- Amount::shouldReceive('format')->andReturn('something');
- Amount::shouldReceive('getCurrencySymbol')->andReturn('something');
-
- $this->call('POST', '/piggy-banks/remove/' . $piggyBank->id, ['_token' => 'replaceMe', 'amount' => '10000']);
- $this->assertResponseStatus(302);
- }
-
- /**
- * @covers FireflyIII\Http\Controllers\PiggyBankController::remove
- */
- public function testRemove()
- {
- $piggyBank = FactoryMuffin::create('FireflyIII\Models\PiggyBank');
- $this->be($piggyBank->account->user);
-
- Amount::shouldReceive('format')->andReturn('something');
- Amount::shouldReceive('getCurrencyCode')->andReturn('X');
- Amount::shouldReceive('getCurrencySymbol')->andReturn('X');
-
- $this->call('GET', '/piggy-banks/remove/' . $piggyBank->id);
- $this->assertResponseOk();
- }
-
- /**
- * @covers FireflyIII\Http\Controllers\PiggyBankController::show
- */
- public function testShow()
- {
- $piggyBank = FactoryMuffin::create('FireflyIII\Models\PiggyBank');
- $this->be($piggyBank->account->user);
-
- $piggyBanks = $this->mock('FireflyIII\Repositories\PiggyBank\PiggyBankRepositoryInterface');
- $piggyBanks->shouldReceive('getEvents')->andReturn(new Collection);
- Amount::shouldReceive('format')->andReturn('something');
- Amount::shouldReceive('getCurrencySymbol')->andReturn('something');
- Amount::shouldReceive('getCurrencyCode')->andReturn('something');
-
-
- $this->call('GET', '/piggy-banks/show/' . $piggyBank->id);
- $this->assertResponseOk();
- }
-
- /**
- * @covers FireflyIII\Http\Controllers\PiggyBankController::store
- */
- public function testStore()
- {
- $piggyBank = FactoryMuffin::create('FireflyIII\Models\PiggyBank');
- $this->be($piggyBank->account->user);
-
- $piggyBankData = [
- 'name' => 'Some name' . rand(1, 100),
- 'account_id' => $piggyBank->account_id,
- 'targetamount' => 100,
- 'targetdate' => '',
- '_token' => 'replaceMe'
- ];
-
- // mock!
- $piggyBanks = $this->mock('FireflyIII\Repositories\PiggyBank\PiggyBankRepositoryInterface');
- $piggyBanks->shouldReceive('store')->once()->andReturn($piggyBank);
-
- $this->call('POST', '/piggy-banks/store', $piggyBankData);
- $this->assertResponseStatus(302);
- }
-
- /**
- * @covers FireflyIII\Http\Controllers\PiggyBankController::store
- */
- public function testStoreCreateAnother()
- {
- $piggyBank = FactoryMuffin::create('FireflyIII\Models\PiggyBank');
- $this->be($piggyBank->account->user);
-
- $piggyBankData = [
- 'name' => 'Some name' . rand(1, 100),
- 'account_id' => $piggyBank->account_id,
- 'targetamount' => 100,
- 'targetdate' => '',
- 'create_another' => 1,
- '_token' => 'replaceMe'
- ];
-
- // mock!
- $piggyBanks = $this->mock('FireflyIII\Repositories\PiggyBank\PiggyBankRepositoryInterface');
- $piggyBanks->shouldReceive('store')->once()->andReturn($piggyBank);
-
- $this->call('POST', '/piggy-banks/store', $piggyBankData);
- $this->assertResponseStatus(302);
- }
-
- /**
- * @covers FireflyIII\Http\Controllers\PiggyBankController::update
- */
- public function testUpdate()
- {
- $piggyBank = FactoryMuffin::create('FireflyIII\Models\PiggyBank');
- $this->be($piggyBank->account->user);
-
- $piggyBankData = [
- 'name' => 'Some name' . rand(1, 100),
- 'account_id' => $piggyBank->account_id,
- 'targetamount' => 200,
- 'targetdate' => '',
- '_token' => 'replaceMe'
- ];
-
- // mock!
- $piggyBanks = $this->mock('FireflyIII\Repositories\PiggyBank\PiggyBankRepositoryInterface');
- $piggyBanks->shouldReceive('update')->once()->andReturn($piggyBank);
-
- $this->call('POST', '/piggy-banks/update/' . $piggyBank->id, $piggyBankData);
- $this->assertResponseStatus(302);
- }
-
- /**
- * @covers FireflyIII\Http\Controllers\PiggyBankController::update
- */
- public function testUpdateReturnToEdit()
- {
- $piggyBank = FactoryMuffin::create('FireflyIII\Models\PiggyBank');
- $this->be($piggyBank->account->user);
-
- $piggyBankData = [
- 'name' => 'Some name' . rand(1, 100),
- 'account_id' => $piggyBank->account_id,
- 'targetamount' => 200,
- 'targetdate' => '',
- 'return_to_edit' => 1,
- '_token' => 'replaceMe'
- ];
-
- // mock!
- $piggyBanks = $this->mock('FireflyIII\Repositories\PiggyBank\PiggyBankRepositoryInterface');
- $piggyBanks->shouldReceive('update')->once()->andReturn($piggyBank);
-
- $this->call('POST', '/piggy-banks/update/' . $piggyBank->id, $piggyBankData);
- $this->assertResponseStatus(302);
- }
-}
diff --git a/tests/controllers/PreferencesControllerTest.php b/tests/controllers/PreferencesControllerTest.php
deleted file mode 100644
index 7631aa2ea8..0000000000
--- a/tests/controllers/PreferencesControllerTest.php
+++ /dev/null
@@ -1,121 +0,0 @@
-be($user);
-
-
- // mock:
- $repository = $this->mock('FireflyIII\Repositories\Account\AccountRepositoryInterface');
-
- // fake!
- $repository->shouldReceive('getAccounts')->with(['Default account', 'Asset account'])->andReturn(new Collection);
- Preferences::shouldReceive('get')->once()->withArgs(['viewRange', '1M'])->andReturn($pref);
- Preferences::shouldReceive('get')->once()->withArgs(['frontPageAccounts', []])->andReturn($pref);
- Preferences::shouldReceive('get')->once()->withArgs(['budgetMaximum', 1000])->andReturn($pref);
- Preferences::shouldReceive('get')->withArgs(['currencyPreference', 'EUR'])->andReturn($pref);
- Amount::shouldReceive('format')->andReturn('xx');
- Amount::shouldReceive('getCurrencyCode')->andReturn('X');
- Amount::shouldReceive('getCurrencySymbol')->andReturn('X');
- Amount::shouldReceive('getAllCurrencies')->andReturn(new Collection);
- Amount::shouldReceive('getDefaultCurrency')->andReturn($currency);
-
- $lastActivity = FactoryMuffin::create('FireflyIII\Models\Preference');
- $lastActivity->data = microtime();
- Preferences::shouldReceive('lastActivity')->andReturn($lastActivity);
-
- // language preference:
- $language = FactoryMuffin::create('FireflyIII\Models\Preference');
- $language->data = 'en';
- $language->save();
- Preferences::shouldReceive('get')->withAnyArgs()->andReturn($language);
-
- $this->call('GET', '/preferences');
- $this->assertResponseOk();
- }
-
- /**
- * @covers FireflyIII\Http\Controllers\PreferencesController::postIndex
- */
- public function testPostIndex()
- {
- $user = FactoryMuffin::create('FireflyIII\User');
- $this->be($user);
-
- $data = [
- 'frontPageAccounts' => [1, 2, 3],
- '_token' => 'replaceMe',
- 'viewRange' => '1M',
- 'language' => 'en',
- ];
-
- // language preference:
- $language = FactoryMuffin::create('FireflyIII\Models\Preference');
- $language->data = 'en';
- $language->save();
- Preferences::shouldReceive('get')->withAnyArgs()->andReturn($language);
-
- Preferences::shouldReceive('set')->once()->withArgs(['frontPageAccounts', [1, 2, 3]]);
- Preferences::shouldReceive('set')->once()->withArgs(['viewRange', '1M']);
- Preferences::shouldReceive('set')->once()->withArgs(['budgetMaximum', 0]);
- Preferences::shouldReceive('set')->once()->withArgs(['language', 'en']);
- Preferences::shouldReceive('mark')->once()->andReturn(true);
-
- // language preference:
- $language = FactoryMuffin::create('FireflyIII\Models\Preference');
- $language->data = 'en';
- $language->save();
- Preferences::shouldReceive('get')->withAnyArgs()->andReturn($language);
-
- $lastActivity = FactoryMuffin::create('FireflyIII\Models\Preference');
- $lastActivity->data = microtime();
- Preferences::shouldReceive('lastActivity')->andReturn($lastActivity);
-
-
- $this->call('POST', '/preferences', $data);
- $this->assertResponseStatus(302);
- }
-}
diff --git a/tests/controllers/ProfileControllerTest.php b/tests/controllers/ProfileControllerTest.php
deleted file mode 100644
index ff08eef3a2..0000000000
--- a/tests/controllers/ProfileControllerTest.php
+++ /dev/null
@@ -1,195 +0,0 @@
-be($user);
-
- $this->call('GET', '/profile/change-password');
- $this->assertResponseOk();
- }
-
- /**
- * @covers FireflyIII\Http\Controllers\ProfileController::deleteAccount
- */
- public function testDeleteAccount()
- {
- $user = FactoryMuffin::create('FireflyIII\User');
- $this->be($user);
-
- $this->call('GET', '/profile/delete-account');
- $this->assertResponseOk();
- }
-
- /**
- * @covers FireflyIII\Http\Controllers\ProfileController::index
- */
- public function testIndex()
- {
- $user = FactoryMuffin::create('FireflyIII\User');
- $this->be($user);
-
- $this->call('GET', '/profile');
- $this->assertResponseOk();
- }
-
- /**
- * @covers FireflyIII\Http\Controllers\ProfileController::postChangePassword
- * @covers FireflyIII\Http\Controllers\ProfileController::validatePassword
- */
- public function testPostChangePassword()
- {
- $user = FactoryMuffin::create('FireflyIII\User');
- $user->password = bcrypt('current');
- $user->save();
- $this->be($user);
-
- $post = [
- 'current_password' => 'current',
- 'new_password' => 'something',
- 'new_password_confirmation' => 'something',
- '_token' => 'replaceMe'
- ];
-
- $this->call('POST', '/profile/change-password', $post);
-
- $this->assertRedirectedToRoute('profile');
- $this->assertSessionHas('success', 'Password changed!');
- $this->assertResponseStatus(302);
-
- }
-
- /**
- * @covers FireflyIII\Http\Controllers\ProfileController::postChangePassword
- * @covers FireflyIII\Http\Controllers\ProfileController::validatePassword
- */
- public function testPostChangePasswordInvalidCurrent()
- {
- $user = FactoryMuffin::create('FireflyIII\User');
- $this->be($user);
-
- $post = [
- 'current_password' => 'currentWrong',
- 'new_password' => 'something',
- 'new_password_confirmation' => 'something',
- '_token' => 'replaceMe'
- ];
-
- $this->call('POST', '/profile/change-password', $post);
-
- $this->assertRedirectedToRoute('profile.change-password');
- $this->assertSessionHas('error', 'Invalid current password!');
- $this->assertResponseStatus(302);
-
- }
-
- /**
- * @covers FireflyIII\Http\Controllers\ProfileController::postChangePassword
- * @covers FireflyIII\Http\Controllers\ProfileController::validatePassword
- */
- public function testPostChangePasswordNoNewPassword()
- {
- $user = FactoryMuffin::create('FireflyIII\User');
- $user->password = bcrypt('current');
- $user->save();
- $this->be($user);
-
- $post = [
- 'current_password' => 'current',
- 'new_password' => 'current',
- 'new_password_confirmation' => 'current',
- '_token' => 'replaceMe'
- ];
-
- $this->call('POST', '/profile/change-password', $post);
-
- $this->assertSessionHas('error', 'The idea is to change your password.');
- $this->assertResponseStatus(302);
- $this->assertRedirectedToRoute('profile.change-password');
-
-
- }
-
- /**
- * @covers FireflyIII\Http\Controllers\ProfileController::postDeleteAccount
- */
- public function testPostDeleteAccount()
- {
- $user = FactoryMuffin::create('FireflyIII\User');
- $user->password = bcrypt('current');
- $user->save();
- $this->be($user);
-
- $post = [
- 'password' => 'current',
- '_token' => 'replaceMe'
- ];
-
- $this->call('POST', '/profile/delete-account', $post);
-
- $this->assertRedirectedToRoute('index');
- $this->assertResponseStatus(302);
-
- }
-
- /**
- * @covers FireflyIII\Http\Controllers\ProfileController::postDeleteAccount
- */
- public function testPostDeleteAccountInvalidPassword()
- {
- $user = FactoryMuffin::create('FireflyIII\User');
- $user->password = bcrypt('current');
- $user->save();
- $this->be($user);
-
- $post = [
- 'password' => 'currentXX',
- '_token' => 'replaceMe'
- ];
-
- $this->call('POST', '/profile/delete-account', $post);
-
- $this->assertRedirectedToRoute('profile.delete-account');
- $this->assertSessionHas('error', 'Invalid password!');
- $this->assertResponseStatus(302);
-
- }
-
-}
diff --git a/tests/controllers/ReportControllerTest.php b/tests/controllers/ReportControllerTest.php
deleted file mode 100644
index 51791cf341..0000000000
--- a/tests/controllers/ReportControllerTest.php
+++ /dev/null
@@ -1,172 +0,0 @@
-be($user);
-
- // mock stuff
- $helper = $this->mock('FireflyIII\Helpers\Report\ReportHelperInterface');
- $repository = $this->mock('FireflyIII\Repositories\Account\AccountRepositoryInterface');
- $account = FactoryMuffin::create('FireflyIII\Models\Account');
-
- // make shared:
- AccountMeta::create(
- [
- 'account_id' => $account->id,
- 'name' => 'accountRole',
- 'data' => 'sharedAsset'
- ]
- );
-
- $helper->shouldReceive('listOfMonths')->andReturn([]);
- $helper->shouldReceive('listOfYears')->andReturn([]);
- $repository->shouldReceive('getAccounts')->andReturn(new Collection([$account]));
-
-
- $this->call('GET', '/reports');
- $this->assertResponseOk();
-
- }
-
- /**
- * @covers FireflyIII\Http\Controllers\ReportController::month
- */
- public function testMonth()
- {
- $user = FactoryMuffin::create('FireflyIII\User');
- FactoryMuffin::create('FireflyIII\Models\Account');
- $budget1 = FactoryMuffin::create('FireflyIII\Models\Budget');
- $budget1->queryAmount = 12;
- $budget2 = FactoryMuffin::create('FireflyIII\Models\Budget');
- $budget2->queryAmount = 0;
- $this->be($user);
-
- // mock!
- $helper = $this->mock('FireflyIII\Helpers\Report\ReportHelperInterface');
-
- // fake!
- $helper->shouldReceive('getAccountReport')->andReturn(new Collection);
- $helper->shouldReceive('getIncomeReport')->andReturn(new Collection);
- $helper->shouldReceive('getExpenseReport')->andReturn(new Collection);
- $helper->shouldReceive('getBudgetReport')->andReturn(new Collection);
- $helper->shouldReceive('getCategoryReport')->andReturn(new Collection);
- $helper->shouldReceive('getBalanceReport')->andReturn(new Collection);
- $helper->shouldReceive('getBillReport')->andReturn(new Collection);
-
-
- $this->call('GET', '/reports/2015/1');
- $this->assertResponseOk();
- }
-
- /**
- * @covers FireflyIII\Http\Controllers\ReportController::month
- */
- public function testMonthShared()
- {
- $user = FactoryMuffin::create('FireflyIII\User');
- FactoryMuffin::create('FireflyIII\Models\Account');
- $budget1 = FactoryMuffin::create('FireflyIII\Models\Budget');
- $budget1->queryAmount = 12;
- $budget2 = FactoryMuffin::create('FireflyIII\Models\Budget');
- $budget2->queryAmount = 0;
- $this->be($user);
-
- // mock!
- $helper = $this->mock('FireflyIII\Helpers\Report\ReportHelperInterface');
-
- // fake!
- $helper->shouldReceive('getAccountReport')->andReturn(new Collection);
- $helper->shouldReceive('getIncomeReport')->andReturn(new Collection);
- $helper->shouldReceive('getExpenseReport')->andReturn(new Collection);
- $helper->shouldReceive('getBudgetReport')->andReturn(new Collection);
- $helper->shouldReceive('getCategoryReport')->andReturn(new Collection);
- $helper->shouldReceive('getBalanceReport')->andReturn(new Collection);
- $helper->shouldReceive('getBillReport')->andReturn(new Collection);
-
- $this->call('GET', '/reports/2015/1/shared');
- $this->assertResponseOk();
- }
-
- /**
- * @covers FireflyIII\Http\Controllers\ReportController::year
- */
- public function testYear()
- {
- $user = FactoryMuffin::create('FireflyIII\User');
- $journal = FactoryMuffin::create('FireflyIII\Models\TransactionJournal');
- $currency = FactoryMuffin::create('FireflyIII\Models\TransactionCurrency');
- $account = FactoryMuffin::create('FireflyIII\Models\Account');
-
- // make shared:
- AccountMeta::create(
- [
- 'account_id' => $account->id,
- 'name' => 'accountRole',
- 'data' => 'sharedAsset'
- ]
- );
- new Collection([$journal]);
-
- $this->be($user);
-
- $helper = $this->mock('FireflyIII\Helpers\Report\ReportHelperInterface');
-
-
- $helper->shouldReceive('getAccountReport')->once()->withAnyArgs()->andReturn([]);
- $helper->shouldReceive('getIncomeReport')->once()->withAnyArgs()->andReturn([]);
- $helper->shouldReceive('getExpenseReport')->once()->withAnyArgs()->andReturn([]);
-
- // mock stuff!
- Amount::shouldReceive('getDefaultCurrency')->andReturn($currency);
- Amount::shouldReceive('getAllCurrencies')->andReturn([$currency]);
- Amount::shouldReceive('getCurrencyCode')->andReturn('X');
- Amount::shouldReceive('getCurrencySymbol')->andReturn('X');
- Amount::shouldReceive('format')->andReturn('X');
-
- $this->call('GET', '/reports/2015/shared');
- $this->assertResponseOk();
- }
-
-
-}
diff --git a/tests/controllers/SearchControllerTest.php b/tests/controllers/SearchControllerTest.php
deleted file mode 100644
index 33ac7f9f36..0000000000
--- a/tests/controllers/SearchControllerTest.php
+++ /dev/null
@@ -1,58 +0,0 @@
-be($user);
- $words = ['Something'];
- // mock!
- $repository = $this->mock('FireflyIII\Support\Search\SearchInterface');
- $repository->shouldReceive('searchTransactions')->with($words)->once()->andReturn([]);
- $repository->shouldReceive('searchAccounts')->with($words)->once()->andReturn([]);
- $repository->shouldReceive('searchCategories')->with($words)->once()->andReturn([]);
- $repository->shouldReceive('searchBudgets')->with($words)->once()->andReturn([]);
- $repository->shouldReceive('searchTags')->with($words)->once()->andReturn([]);
-
- $this->call('GET', '/search?q=Something');
- $this->assertResponseOk();
- }
-}
diff --git a/tests/controllers/TagControllerTest.php b/tests/controllers/TagControllerTest.php
deleted file mode 100644
index 9b6a29df69..0000000000
--- a/tests/controllers/TagControllerTest.php
+++ /dev/null
@@ -1,296 +0,0 @@
-be($user);
-
- $this->call('GET', '/tags/create');
- $this->assertResponseOk();
- }
-
- /**
- * @covers FireflyIII\Http\Controllers\TagController::delete
- */
- public function testDelete()
- {
- $tag = FactoryMuffin::create('FireflyIII\Models\Tag');
- $this->be($tag->user);
-
- $this->call('GET', '/tags/delete/' . $tag->id);
- $this->assertResponseOk();
- }
-
- /**
- * @covers FireflyIII\Http\Controllers\TagController::destroy
- */
- public function testDestroy()
- {
- $tag = FactoryMuffin::create('FireflyIII\Models\Tag');
- $this->be($tag->user);
-
- $this->call('POST', '/tags/destroy/' . $tag->id, ['_token' => 'replaceMe']);
- $this->assertSessionHas('success');
- $this->assertResponseStatus(302);
-
- }
-
- /**
- * @covers FireflyIII\Http\Controllers\TagController::edit
- */
- public function testEdit()
- {
- $tag = FactoryMuffin::create('FireflyIII\Models\Tag');
- $this->be($tag->user);
-
- $this->call('GET', '/tags/edit/' . $tag->id);
- $this->assertResponseOk();
- }
-
- /**
- * @covers FireflyIII\Http\Controllers\TagController::edit
- */
- public function testEditBalancingAct()
- {
- $tag = FactoryMuffin::create('FireflyIII\Models\Tag');
- $journal = FactoryMuffin::create('FireflyIII\Models\TransactionJournal');
- $type = FactoryMuffin::create('FireflyIII\Models\TransactionType');
- $type->type = 'Transfer';
- $type->save();
- $journal->transactionType()->associate($type);
- $journal->save();
- $tag->transactionJournals()->save($journal);
- $tag->tagMode = 'balancingAct';
- $tag->save();
- $this->be($tag->user);
-
- $this->call('GET', '/tags/edit/' . $tag->id);
- $this->assertResponseOk();
- }
-
- /**
- * @covers FireflyIII\Http\Controllers\TagController::edit
- */
- public function testEditThreeExpenses()
- {
- $tag = FactoryMuffin::create('FireflyIII\Models\Tag');
- $type = FactoryMuffin::create('FireflyIII\Models\TransactionType');
- $type->type = 'Withdrawal';
- $type->save();
-
- for ($i = 0; $i < 3; $i++) {
- $journal = FactoryMuffin::create('FireflyIII\Models\TransactionJournal');
- $journal->transactionType()->associate($type);
- $journal->save();
- $tag->transactionJournals()->save($journal);
- }
-
-
- $tag->tagMode = 'nothing';
- $tag->save();
- $this->be($tag->user);
-
- $this->call('GET', '/tags/edit/' . $tag->id);
- $this->assertResponseOk();
- }
-
- /**
- * @covers FireflyIII\Http\Controllers\TagController::hideTagHelp
- */
- public function testHideTagHelp()
- {
- $tag = FactoryMuffin::create('FireflyIII\Models\Tag');
- $this->be($tag->user);
-
- $this->call('POST', '/tags/hideTagHelp/true', ['_token' => 'replaceMe']);
- $this->assertResponseOk();
- }
-
- /**
- * @covers FireflyIII\Http\Controllers\TagController::index
- */
- public function testIndex()
- {
- $tag = FactoryMuffin::create('FireflyIII\Models\Tag');
- $this->be($tag->user);
-
- $this->call('GET', '/tags');
- $this->assertResponseOk();
- }
-
- /**
- * @covers FireflyIII\Http\Controllers\TagController::edit
- */
- public function testMultipleDeposits()
- {
- $tag = FactoryMuffin::create('FireflyIII\Models\Tag');
- FactoryMuffin::create('FireflyIII\Models\TransactionType');
- $type = FactoryMuffin::create('FireflyIII\Models\TransactionType');
-
- for ($i = 0; $i < 3; $i++) {
- $journal = FactoryMuffin::create('FireflyIII\Models\TransactionJournal');
- $journal->transaction_type_id = $type->id;
- $journal->save();
- $tag->transactionJournals()->save($journal);
- }
-
-
- $tag->tagMode = 'nothing';
- $tag->save();
- $this->be($tag->user);
-
- $this->call('GET', '/tags/edit/' . $tag->id);
- $this->assertResponseOk();
- }
-
- /**
- * @covers FireflyIII\Http\Controllers\TagController::show
- */
- public function testShow()
- {
- $tag = FactoryMuffin::create('FireflyIII\Models\Tag');
- $this->be($tag->user);
-
- $this->call('GET', '/tags/show/' . $tag->id);
- $this->assertResponseOk();
- }
-
- /**
- * @covers FireflyIII\Http\Controllers\TagController::store
- */
- public function testStore()
- {
- $user = FactoryMuffin::create('FireflyIII\User');
- $this->be($user);
- $data = [
- '_token' => 'replaceMe',
- 'tag' => 'BlaBla' . rand(1, 1000),
- 'tagMode' => 'nothing'
- ];
-
- $this->call('POST', '/tags/store/', $data);
- $this->assertResponseStatus(302);
- }
-
- /**
- * @covers FireflyIII\Http\Controllers\TagController::store
- */
- public function testStoreWithLocation()
- {
- $user = FactoryMuffin::create('FireflyIII\User');
- $this->be($user);
- $data = [
- '_token' => 'replaceMe',
- 'tag' => 'BlaBla' . rand(1, 1000),
- 'tagMode' => 'nothing',
- 'latitude' => 12,
- 'longitude' => 13,
- 'zoomLevel' => 3,
- 'setTag' => 'true',
- 'create_another' => 1,
- ];
-
- $this->call('POST', '/tags/store/', $data);
- $this->assertResponseStatus(302);
- }
-
- public function testUpdate()
- {
- $tag = FactoryMuffin::create('FireflyIII\Models\Tag');
- $this->be($tag->user);
-
- $data = [
- '_token' => 'replaceMe',
- 'tag' => 'BlaBla' . rand(1, 1000),
- 'tagMode' => 'nothing',
- 'id' => $tag->id,
- ];
-
- $this->call('POST', '/tags/update/' . $tag->id, $data);
- $this->assertResponseStatus(302);
- $this->assertSessionHas('success');
- }
-
- public function testUpdateNoNameChange()
- {
- $tag = FactoryMuffin::create('FireflyIII\Models\Tag');
- $this->be($tag->user);
-
- $data = [
- '_token' => 'replaceMe',
- 'tag' => $tag->tag,
- 'tagMode' => 'nothing',
- 'id' => $tag->id,
- ];
-
- $this->call('POST', '/tags/update/' . $tag->id, $data);
- $this->assertResponseStatus(302);
- $this->assertSessionHas('success');
- }
-
- /**
- * @covers FireflyIII\Http\Controllers\TagController::update
- */
- public function testUpdateWithLocation()
- {
- $tag = FactoryMuffin::create('FireflyIII\Models\Tag');
- $this->be($tag->user);
-
- $data = [
- '_token' => 'replaceMe',
- 'tag' => 'BlaBla' . rand(1, 1000),
- 'tagMode' => 'nothing',
- 'id' => $tag->id,
- 'latitude' => 12,
- 'setTag' => 'true',
- 'longitude' => 13,
- 'zoomLevel' => 3,
- 'return_to_edit' => 1,
- ];
-
- $this->call('POST', '/tags/update/' . $tag->id, $data);
- $this->assertResponseStatus(302);
- }
-
-
-}
diff --git a/tests/controllers/TransactionControllerTest.php b/tests/controllers/TransactionControllerTest.php
deleted file mode 100644
index 814457fe6b..0000000000
--- a/tests/controllers/TransactionControllerTest.php
+++ /dev/null
@@ -1,598 +0,0 @@
-be($user);
-
- // mock!
- $repository = $this->mock('FireflyIII\Repositories\Account\AccountRepositoryInterface');
-
-
- // fake!
- $repository->shouldReceive('getAccounts')->andReturn(new Collection);
-
-
- $this->call('GET', '/transactions/create/withdrawal?account_id=12');
- $this->assertResponseOk();
- }
-
- /**
- * @covers FireflyIII\Http\Controllers\TransactionController::delete
- */
- public function testDelete()
- {
- $journal = FactoryMuffin::create('FireflyIII\Models\TransactionJournal');
- $this->be($journal->user);
-
- $this->call('GET', '/transaction/delete/' . $journal->id);
- $this->assertResponseOk();
- }
-
- /**
- * @covers FireflyIII\Http\Controllers\TransactionController::destroy
- */
- public function testDestroy()
- {
- $journal = FactoryMuffin::create('FireflyIII\Models\TransactionJournal');
- $this->be($journal->user);
-
- // mock!
- $repository = $this->mock('FireflyIII\Repositories\Journal\JournalRepositoryInterface');
-
- // fake!
- $repository->shouldReceive('delete')->andReturn(true);
-
- $this->call('POST', '/transaction/destroy/' . $journal->id, ['_token' => 'replaceMe']);
- $this->assertResponseStatus(302);
- $this->assertSessionHas('success');
-
- }
-
- /**
- * @covers FireflyIII\Http\Controllers\TransactionController::edit
- * @SuppressWarnings(PHPMD.ExcessiveMethodLength)
- */
- public function testEdit()
- {
- $user = FactoryMuffin::create('FireflyIII\User');
- $this->be($user);
- // make complete journal:
- $accountType = FactoryMuffin::create('FireflyIII\Models\AccountType');
- $journal = FactoryMuffin::create('FireflyIII\Models\TransactionJournal');
- $account = FactoryMuffin::create('FireflyIII\Models\Account');
- $transaction1 = FactoryMuffin::create('FireflyIII\Models\Transaction');
- $transaction2 = FactoryMuffin::create('FireflyIII\Models\Transaction');
-
- $accountType->type = 'Asset account';
- $account->account_type_id = $accountType->id;
-
- $account->save();
- $transaction1->account_id = $account->id;
- $transaction1->transaction_journal_id = $journal->id;
- $transaction1->save();
-
- $transaction2->account_id = $account->id;
- $transaction2->transaction_journal_id = $journal->id;
- $transaction2->save();
-
- // also add some tags:
- $tag = FactoryMuffin::create('FireflyIII\Models\Tag');
- $tag->transactionJournals()->save($journal);
-
- // and a category and a budget:
- $budget = FactoryMuffin::create('FireflyIII\Models\Budget');
- $category = FactoryMuffin::create('FireflyIII\Models\Category');
- $category->transactionJournals()->save($journal);
- $budget->transactionJournals()->save($journal);
-
- // and a piggy bank event:
- $pbEvent = FactoryMuffin::create('FireflyIII\Models\PiggyBankEvent');
- $pbEvent->transaction_journal_id = $journal->id;
- $pbEvent->save();
-
- $this->be($journal->user);
-
-
- // mock!
- $repository = $this->mock('FireflyIII\Repositories\Account\AccountRepositoryInterface');
-
-
- // fake!
- $repository->shouldReceive('getAccounts')->andReturn(new Collection);
-
- $this->call('GET', '/transaction/edit/' . $journal->id);
- $this->assertResponseOk();
- }
-
- /**
- * @covers FireflyIII\Http\Controllers\TransactionController::edit
- * @SuppressWarnings(PHPMD.ExcessiveMethodLength)
- */
- public function testEditCashDestination()
- {
- $user = FactoryMuffin::create('FireflyIII\User');
- $this->be($user);
- // make complete journal:
- $journal = FactoryMuffin::create('FireflyIII\Models\TransactionJournal');
- //$expense = FactoryMuffin::create('FireflyIII\Models\Account'); // expense account
- //$revenue = FactoryMuffin::create('FireflyIII\Models\Account'); // revenue account
- $asset = FactoryMuffin::create('FireflyIII\Models\Account'); // asset account
- $cash = FactoryMuffin::create('FireflyIII\Models\Account'); // cash account
-
- $journal->transactions[0]->account_id = $asset->id;
- $journal->transactions[0]->amount = -300;
- $journal->transactions[0]->save();
-
- $journal->transactions[0]->account_id = $cash->id;
- $journal->transactions[0]->amount = 300;
- $journal->transactions[0]->save();
-
- $this->be($journal->user);
- // mock!
- $repository = $this->mock('FireflyIII\Repositories\Account\AccountRepositoryInterface');
-
- // fake!
- $repository->shouldReceive('getAccounts')->andReturn(new Collection);
-
- $this->call('GET', '/transaction/edit/' . $journal->id);
-
- $this->assertResponseOk();
- }
-
- /**
- * @covers FireflyIII\Http\Controllers\TransactionController::edit
- * @SuppressWarnings(PHPMD.ExcessiveMethodLength)
- */
- public function testEditDeposit()
- {
- $user = FactoryMuffin::create('FireflyIII\User');
- $this->be($user);
- // make complete journal:
- $accountType = FactoryMuffin::create('FireflyIII\Models\AccountType');
- FactoryMuffin::create('FireflyIII\Models\TransactionType'); // withdrawal
- $journal = FactoryMuffin::create('FireflyIII\Models\TransactionJournal');
- $account = FactoryMuffin::create('FireflyIII\Models\Account');
- $transaction1 = FactoryMuffin::create('FireflyIII\Models\Transaction');
- $transaction2 = FactoryMuffin::create('FireflyIII\Models\Transaction');
-
- $accountType->type = 'Asset account';
- $account->account_type_id = $accountType->id;
-
- $account->save();
- $transaction1->account_id = $account->id;
- $transaction1->transaction_journal_id = $journal->id;
- $transaction1->save();
-
- $transaction2->account_id = $account->id;
- $transaction2->transaction_journal_id = $journal->id;
- $transaction2->save();
-
- // also add some tags:
- $tag = FactoryMuffin::create('FireflyIII\Models\Tag');
- $tag->transactionJournals()->save($journal);
-
- // and a category and a budget:
- $budget = FactoryMuffin::create('FireflyIII\Models\Budget');
- $category = FactoryMuffin::create('FireflyIII\Models\Category');
- $category->transactionJournals()->save($journal);
- $budget->transactionJournals()->save($journal);
-
- // and a piggy bank event:
- $pbEvent = FactoryMuffin::create('FireflyIII\Models\PiggyBankEvent');
- $pbEvent->transaction_journal_id = $journal->id;
- $pbEvent->save();
-
- $this->be($journal->user);
-
-
- // mock!
- $repository = $this->mock('FireflyIII\Repositories\Account\AccountRepositoryInterface');
-
-
- // fake!
- $repository->shouldReceive('getAccounts')->andReturn(new Collection);
-
- $this->call('GET', '/transaction/edit/' . $journal->id);
- $this->assertResponseOk();
- }
-
- /**
- * @covers FireflyIII\Http\Controllers\TransactionController::index
- */
- public function testIndexRevenue()
- {
- $user = FactoryMuffin::create('FireflyIII\User');
- $this->be($user);
-
- // mock!
- $repository = $this->mock('FireflyIII\Repositories\Journal\JournalRepositoryInterface');
-
- // fake!
- $repository->shouldReceive('getJournalsOfTypes')->withArgs([['Deposit'], 0, 0])->andReturn(new LengthAwarePaginator(new Collection, 0, 50));
-
- $this->call('GET', '/transactions/deposit');
- $this->assertResponseOk();
-
- }
-
- /**
- * @covers FireflyIII\Http\Controllers\TransactionController::index
- */
- public function testIndexTransfer()
- {
- $user = FactoryMuffin::create('FireflyIII\User');
- $this->be($user);
-
- // mock!
- $repository = $this->mock('FireflyIII\Repositories\Journal\JournalRepositoryInterface');
-
- // fake!
- $repository->shouldReceive('getJournalsOfTypes')->withArgs([['Transfer'], 0, 0])->andReturn(new LengthAwarePaginator(new Collection, 0, 50));
-
- $this->call('GET', '/transactions/transfers');
- $this->assertResponseOk();
- }
-
- /**
- * @covers FireflyIII\Http\Controllers\TransactionController::index
- */
- public function testIndexWithdrawal()
- {
- $user = FactoryMuffin::create('FireflyIII\User');
- $this->be($user);
-
- // mock!
- $repository = $this->mock('FireflyIII\Repositories\Journal\JournalRepositoryInterface');
-
- // fake!
- $repository->shouldReceive('getJournalsOfTypes')->withArgs([['Withdrawal'], 0, 0])->andReturn(new LengthAwarePaginator(new Collection, 0, 50));
-
- $this->call('GET', '/transactions/withdrawal');
- $this->assertResponseOk();
- }
-
- /**
- * @covers FireflyIII\Http\Controllers\TransactionController::reorder
- */
- public function testReorder()
- {
- $journal = FactoryMuffin::create('FireflyIII\Models\TransactionJournal');
- $this->be($journal->user);
-
- // mock!
- $repository = $this->mock('FireflyIII\Repositories\Journal\JournalRepositoryInterface');
-
- // fake!
- $repository->shouldReceive('getWithDate')->withAnyArgs()->andReturn($journal);
-
- $data = [
- 'items' => [$journal->id],
- 'date' => $journal->date->format('Y-m-d'),
- '_token' => 'replaceMe'
- ];
-
- $this->call('POST', '/transaction/reorder', $data);
- $this->assertResponseOk();
- }
-
- /**
- * @covers FireflyIII\Http\Controllers\TransactionController::show
- */
- public function testShow()
- {
- $journal = FactoryMuffin::create('FireflyIII\Models\TransactionJournal');
- $transaction1 = FactoryMuffin::create('FireflyIII\Models\Transaction');
- $currency = FactoryMuffin::create('FireflyIII\Models\TransactionCurrency');
- $transaction1->transaction_journal_id = $journal->id;
- $transaction1->save();
- $this->be($journal->user);
-
-
- // mock!
- $repository = $this->mock('FireflyIII\Repositories\Journal\JournalRepositoryInterface');
-
- // fake!
- $repository->shouldReceive('getAmountBefore')->withAnyArgs()->andReturn(5);
- Amount::shouldReceive('getDefaultCurrency')->andReturn($currency);
- Amount::shouldReceive('getAllCurrencies')->andReturn([$currency]);
- Amount::shouldReceive('getCurrencyCode')->andReturn('X');
- Amount::shouldReceive('getCurrencySymbol')->andReturn('X');
- Amount::shouldReceive('formatTransaction')->andReturn('X');
- Amount::shouldReceive('format')->andReturn('X');
-
-
- $this->call('GET', '/transaction/show/' . $journal->id);
- $this->assertResponseOk();
- }
-
- /**
- * @SuppressWarnings(PHPMD.ExcessiveMethodLength)
- * @covers FireflyIII\Http\Controllers\TransactionController::store
- */
- public function testStore()
- {
- $account = FactoryMuffin::create('FireflyIII\Models\Account');
- $currency = FactoryMuffin::create('FireflyIII\Models\TransactionCurrency');
- $journal = FactoryMuffin::create('FireflyIII\Models\TransactionJournal');
- FactoryMuffin::create('FireflyIII\Models\TransactionType');
- FactoryMuffin::create('FireflyIII\Models\TransactionType');
- FactoryMuffin::create('FireflyIII\Models\TransactionType');
- $this->be($account->user);
-
- $data = [
- 'what' => 'withdrawal',
- 'description' => 'Bla bla bla',
- 'account_id' => $account->id,
- 'expense_account' => 'Bla bla',
- 'amount' => '100',
- 'amount_currency_id' => $currency->id,
- 'date' => '2015-05-05',
- 'budget_id' => '0',
- 'category' => '',
- 'tags' => 'fat-test',
- 'piggy_bank_id' => '0',
- '_token' => 'replaceMe',
- ];
-
- // mock!
- $repository = $this->mock('FireflyIII\Repositories\Journal\JournalRepositoryInterface');
-
- // fake!
- $repository->shouldReceive('store')->andReturn($journal);
-
-
- $this->call('POST', '/transactions/store/withdrawal', $data);
-
- //$this->assertSessionHas('errors','bla');
- $this->assertResponseStatus(302);
- $this->assertSessionHas('success');
-
- }
-
- /**
- * @SuppressWarnings(PHPMD.ExcessiveMethodLength)
- * @covers FireflyIII\Http\Controllers\TransactionController::store
- */
- public function testStoreCreateAnother()
- {
- $account = FactoryMuffin::create('FireflyIII\Models\Account');
- $currency = FactoryMuffin::create('FireflyIII\Models\TransactionCurrency');
- $journal = FactoryMuffin::create('FireflyIII\Models\TransactionJournal');
- FactoryMuffin::create('FireflyIII\Models\TransactionType');
- FactoryMuffin::create('FireflyIII\Models\TransactionType');
- FactoryMuffin::create('FireflyIII\Models\TransactionType');
- $this->be($account->user);
-
- $data = [
- 'what' => 'withdrawal',
- 'description' => 'Bla bla bla',
- 'account_id' => $account->id,
- 'expense_account' => 'Bla bla',
- 'amount' => '100',
- 'amount_currency_id' => $currency->id,
- 'date' => '2015-05-05',
- 'budget_id' => '0',
- 'create_another' => '1',
- 'category' => '',
- 'tags' => 'fat-test',
- 'piggy_bank_id' => '0',
- '_token' => 'replaceMe',
- ];
-
- // mock!
- $repository = $this->mock('FireflyIII\Repositories\Journal\JournalRepositoryInterface');
-
- // fake!
- $repository->shouldReceive('store')->andReturn($journal);
-
-
- $this->call('POST', '/transactions/store/withdrawal', $data);
-
- //$this->assertSessionHas('errors','bla');
- $this->assertResponseStatus(302);
- $this->assertSessionHas('success');
-
- }
-
- /**
- * @SuppressWarnings(PHPMD.ExcessiveMethodLength)
- * @covers FireflyIII\Http\Controllers\TransactionController::store
- */
- public function testStoreTransfer()
- {
- // account types:
- FactoryMuffin::create('FireflyIII\Models\AccountType');
- FactoryMuffin::create('FireflyIII\Models\AccountType');
- $asset = FactoryMuffin::create('FireflyIII\Models\AccountType');
- $account = FactoryMuffin::create('FireflyIII\Models\Account');
- $account2 = FactoryMuffin::create('FireflyIII\Models\Account');
- $currency = FactoryMuffin::create('FireflyIII\Models\TransactionCurrency');
-
- $piggy = FactoryMuffin::create('FireflyIII\Models\PiggyBank');
- FactoryMuffin::create('FireflyIII\Models\TransactionType');
- FactoryMuffin::create('FireflyIII\Models\TransactionType');
- $journal = FactoryMuffin::create('FireflyIII\Models\TransactionJournal');
- $this->be($account->user);
-
- $account2->user_id = $account->user_id;
- $account->account_type_id = $asset->id;
- $account2->account_type_id = $asset->id;
- $piggy->account_id = $account->id;
- $account->save();
- $account2->save();
- $piggy->save();
-
- $data = [
- 'what' => 'transfer',
- 'description' => 'Bla bla bla',
- 'account_from_id' => $account->id,
- 'account_to_id' => $account2->id,
- 'amount' => '100',
- 'amount_currency_id' => $currency->id,
- 'date' => '2015-05-05',
- 'budget_id' => '0',
- 'create_another' => '1',
- 'category' => '',
- 'tags' => 'fat-test',
- 'piggy_bank_id' => $piggy->id,
- '_token' => 'replaceMe',
- ];
-
- // mock!
- $repository = $this->mock('FireflyIII\Repositories\Journal\JournalRepositoryInterface');
-
- // fake!
- $repository->shouldReceive('store')->andReturn($journal);
-
-
- $this->call('POST', '/transactions/store/withdrawal', $data);
-
- //$this->assertSessionHas('errors','bla');
- $this->assertResponseStatus(302);
- $this->assertSessionHas('success');
-
- }
-
- /**
- * @SuppressWarnings(PHPMD.ExcessiveMethodLength)
- * @covers FireflyIII\Http\Controllers\TransactionController::update
- */
- public function testUpdate()
- {
- $account = FactoryMuffin::create('FireflyIII\Models\Account');
- $currency = FactoryMuffin::create('FireflyIII\Models\TransactionCurrency');
- $journal = FactoryMuffin::create('FireflyIII\Models\TransactionJournal');
- FactoryMuffin::create('FireflyIII\Models\TransactionType');
- FactoryMuffin::create('FireflyIII\Models\TransactionType');
- FactoryMuffin::create('FireflyIII\Models\TransactionType');
- $this->be($journal->user);
- $account->user_id = $journal->user_id;
- $account->save();
-
- $data = [
- '_token' => 'replaceMe',
- 'id' => $journal->id,
- 'what' => 'withdrawal',
- 'description' => 'LunchX',
- 'account_id' => $account->id,
- 'expense_account' => 'Lunch House',
- 'amount' => '4.72',
- 'amount_currency_id' => $currency->id,
- 'date' => '2015-05-31',
- 'budget_id' => '0',
- 'category' => 'Lunch',
- 'tags' => 'fat-test',
- 'piggy_bank_id' => '0',
- ];
-
- $this->call('POST', '/transactions/store/withdrawal', $data);
-
- // mock!
- $repository = $this->mock('FireflyIII\Repositories\Journal\JournalRepositoryInterface');
-
- // fake!
- $repository->shouldReceive('update')->andReturn($journal);
-
-
- $this->call('POST', '/transaction/update/' . $journal->id, $data);
- //$this->assertSessionHas('errors','bla');
- $this->assertResponseStatus(302);
- $this->assertSessionHas('success');
-
-
- }
-
- /**
- * @SuppressWarnings(PHPMD.ExcessiveMethodLength)
- * @covers FireflyIII\Http\Controllers\TransactionController::update
- */
- public function testUpdateWithRedirect()
- {
- $account = FactoryMuffin::create('FireflyIII\Models\Account');
- $currency = FactoryMuffin::create('FireflyIII\Models\TransactionCurrency');
- $journal = FactoryMuffin::create('FireflyIII\Models\TransactionJournal');
- FactoryMuffin::create('FireflyIII\Models\TransactionType');
- FactoryMuffin::create('FireflyIII\Models\TransactionType');
- FactoryMuffin::create('FireflyIII\Models\TransactionType');
- $this->be($journal->user);
- $account->user_id = $journal->user_id;
- $account->save();
-
- $data = [
- '_token' => 'replaceMe',
- 'id' => $journal->id,
- 'what' => 'withdrawal',
- 'description' => 'LunchX',
- 'account_id' => $account->id,
- 'expense_account' => 'Lunch House',
- 'amount' => '4.72',
- 'amount_currency_id' => $currency->id,
- 'date' => '2015-05-31',
- 'budget_id' => '0',
- 'category' => 'Lunch',
- 'return_to_edit' => 1,
- 'tags' => 'fat-test',
- 'piggy_bank_id' => '0',
- ];
-
- $this->call('POST', '/transactions/store/withdrawal', $data);
-
- // mock!
- $repository = $this->mock('FireflyIII\Repositories\Journal\JournalRepositoryInterface');
-
- // fake!
- $repository->shouldReceive('update')->andReturn($journal);
-
-
- $this->call('POST', '/transaction/update/' . $journal->id, $data);
- //$this->assertSessionHas('errors','bla');
- $this->assertResponseStatus(302);
- $this->assertSessionHas('success');
-
-
- }
-
-}
diff --git a/tests/controllers/charts/ChartAccountControllerTest.php b/tests/controllers/charts/ChartAccountControllerTest.php
deleted file mode 100644
index 8f41214040..0000000000
--- a/tests/controllers/charts/ChartAccountControllerTest.php
+++ /dev/null
@@ -1,134 +0,0 @@
-account_type_id = $asset->id;
- $two->account_type_id = $asset->id;
- $one->save();
- $two->save();
- $accounts = new Collection([$one, $two]);
- $date = new Carbon;
- $this->be($user);
-
- // make one shared:
- AccountMeta::create(
- [
- 'account_id' => $one->id,
- 'name' => 'accountRole',
- 'data' => 'sharedAsset'
- ]
- );
-
-
- // mock!
- $repository = $this->mock('FireflyIII\Repositories\Account\AccountRepositoryInterface');
-
- // fake!
- $repository->shouldReceive('getAccounts')->once()->andReturn($accounts);
-
- $this->call('GET', '/chart/account/month/' . $date->format('Y/m'));
- $this->assertResponseOk();
- }
-
- /**
- * @covers FireflyIII\Http\Controllers\Chart\AccountController::all
- */
- public function testAllShared()
- {
- $user = FactoryMuffin::create('FireflyIII\User');
- $account = FactoryMuffin::create('FireflyIII\Models\Account');
- $accounts = new Collection([$account]);
- $date = new Carbon;
- $this->be($user);
-
- // make it shared:
- AccountMeta::create(
- [
- 'account_id' => $account->id,
- 'name' => 'accountRole',
- 'data' => 'sharedAsset'
- ]
- );
-
-
- // mock!
- $repository = $this->mock('FireflyIII\Repositories\Account\AccountRepositoryInterface');
-
- // fake!
- $repository->shouldReceive('getAccounts')->once()->andReturn($accounts);
-
-
- $this->call('GET', '/chart/account/month/' . $date->format('Y/m') . '/shared');
- $this->assertResponseOk();
- }
-
- /**
- * @covers FireflyIII\Http\Controllers\Chart\AccountController::frontpage
- */
- public function testFrontpage()
- {
- $accounts = new Collection([FactoryMuffin::create('FireflyIII\Models\Account')]);
- $user = FactoryMuffin::create('FireflyIII\User');
- $this->be($user);
-
- // mock!
- $repository = $this->mock('FireflyIII\Repositories\Account\AccountRepositoryInterface');
-
- // fake!
- $repository->shouldReceive('getFrontpageAccounts')->andReturn($accounts);
-
- $this->call('GET', '/chart/account/frontpage');
- $this->assertResponseOk();
-
- }
-
- /**
- * @covers FireflyIII\Http\Controllers\Chart\AccountController::single
- */
- public function testSingle()
- {
- $account = FactoryMuffin::create('FireflyIII\Models\Account');
- $this->be($account->user);
-
- $this->call('GET', '/chart/account/' . $account->id);
- $this->assertResponseOk();
-
- }
-}
diff --git a/tests/controllers/charts/ChartBillControllerTest.php b/tests/controllers/charts/ChartBillControllerTest.php
deleted file mode 100644
index b7f3ec3f9d..0000000000
--- a/tests/controllers/charts/ChartBillControllerTest.php
+++ /dev/null
@@ -1,100 +0,0 @@
-be($user);
-
-
- }
-
- /**
- * @covers FireflyIII\Http\Controllers\Chart\BillController::frontpage
- */
- public function testFrontpage()
- {
- $user = FactoryMuffin::create('FireflyIII\User');
- $this->be($user);
-
- // set!
- $bills = new Collection([FactoryMuffin::create('FireflyIII\Models\Bill'), FactoryMuffin::create('FireflyIII\Models\Bill')]);
- $journals = new Collection(
- [FactoryMuffin::create('FireflyIII\Models\TransactionJournal'), FactoryMuffin::create('FireflyIII\Models\TransactionJournal')]
- );
- $creditCards = new Collection([FactoryMuffin::create('FireflyIII\Models\Account'), FactoryMuffin::create('FireflyIII\Models\Account')]);
- $ranges = [['start' => new Carbon, 'end' => new Carbon]];
-
- // mock!
- $repository = $this->mock('FireflyIII\Repositories\Bill\BillRepositoryInterface');
- $accounts = $this->mock('FireflyIII\Repositories\Account\AccountRepositoryInterface');
-
-
- // fake!
- $repository->shouldReceive('getActiveBills')->andReturn($bills);
- $repository->shouldReceive('getRanges')->andReturn($ranges);
- $repository->shouldReceive('getJournalsInRange')->andReturn(new Collection, $journals);
- $accounts->shouldReceive('getCreditCards')->andReturn($creditCards);
- $accounts->shouldReceive('getTransfersInRange')->andReturn(new Collection);
- $repository->shouldReceive('createFakeBill')->andReturn($bills->first());
- Steam::shouldReceive('balance')->andReturn(-10, 0);
-
- $lastActivity = FactoryMuffin::create('FireflyIII\Models\Preference');
- $lastActivity->data = microtime();
- Preferences::shouldReceive('lastActivity')->andReturn($lastActivity);
-
- $language = FactoryMuffin::create('FireflyIII\Models\Preference');
- $language->data = 'en';
- Preferences::shouldReceive('get')->withArgs(['language', 'en'])->andReturn($language);
-
-
- $this->call('GET', '/chart/bill/frontpage');
- $this->assertResponseOk();
-
- }
-
- /**
- * @covers FireflyIII\Http\Controllers\Chart\BillController::single
- */
- public function testSingle()
- {
- $bill = FactoryMuffin::create('FireflyIII\Models\Bill');
- $this->be($bill->user);
-
- // set
- $journals = new Collection([FactoryMuffin::create('FireflyIII\Models\TransactionJournal')]);
-
- // mock!
- $repository = $this->mock('FireflyIII\Repositories\Bill\BillRepositoryInterface');
- $repository->shouldReceive('getJournals')->andReturn($journals);
-
- // fake!
-
- $this->call('GET', '/chart/bill/' . $bill->id);
- $this->assertResponseOk();
-
- }
-
-
-}
diff --git a/tests/controllers/charts/ChartBudgetControllerTest.php b/tests/controllers/charts/ChartBudgetControllerTest.php
deleted file mode 100644
index 4670313328..0000000000
--- a/tests/controllers/charts/ChartBudgetControllerTest.php
+++ /dev/null
@@ -1,164 +0,0 @@
-be($budget->user);
-
- $this->call('GET', '/chart/budget/' . $budget->id);
- $this->assertResponseOk();
-
-
- }
-
- /**
- * @covers FireflyIII\Http\Controllers\Chart\BudgetController::budgetLimit
- */
- public function testBudgetLimit()
- {
- $user = FactoryMuffin::create('FireflyIII\User');
- $budget = FactoryMuffin::create('FireflyIII\Models\Budget');
- /** @var \FireflyIII\Models\BudgetLimit $limit */
- $limit = FactoryMuffin::create('FireflyIII\Models\BudgetLimit');
- /** @var \FireflyIII\Models\LimitRepetition $repetition */
- $repetition = FactoryMuffin::create('FireflyIII\Models\LimitRepetition');
-
- $start = Carbon::now()->startOfMonth();
- $end = Carbon::now()->endOfMonth();
-
- $budget->user_id = $user->id;
- $limit->budget_id = $budget->id;
- $limit->startdate = $start;
- $repetition->budget_limit_id = $limit->id;
- $repetition->startdate = $start;
- $repetition->enddate = $end;
-
- $budget->save();
- $limit->save();
- $repetition->save();
-
-
- $this->be($user);
-
- $this->call('GET', '/chart/budget/' . $budget->id . '/' . $repetition->id);
- $this->assertResponseOk();
- }
-
- /**
- * @covers FireflyIII\Http\Controllers\Chart\BudgetController::frontpage
- * @SuppressWarnings(PHPMD.ExcessiveMethodLength)
- */
- public function testFrontpage()
- {
- $user = FactoryMuffin::create('FireflyIII\User');
- $this->be($user);
-
- $start = Carbon::now()->startOfMonth();
- $end = Carbon::now()->endOfMonth();
- $budgets = new Collection;
- $limits = [];
- $repetitions = [];
-
- for ($i = 0; $i < 5; $i++) {
- /** @var \FireflyIII\Models\Budget $budget */
- $budget = FactoryMuffin::create('FireflyIII\Models\Budget');
- $budgets->push($budget);
-
- /** @var \FireflyIII\Models\BudgetLimit $limit */
- $limit = FactoryMuffin::create('FireflyIII\Models\BudgetLimit');
- $limit->budget_id = $budget->id;
- $limit->startdate = $start;
- $limit->save();
-
- $set = new Collection([$limit]);
- $limits[] = $set;
-
- /** @var \FireflyIII\Models\LimitRepetition $repetition */
- $repetition = FactoryMuffin::create('FireflyIII\Models\LimitRepetition');
- $repetition->budget_limit_id = $limit->id;
- $repetition->startdate = $start;
- $repetition->enddate = $end;
- $repetition->save();
- $set = new Collection([$repetition]);
- $repetitions[] = $set;
- }
-
- // mock!
- $repository = $this->mock('FireflyIII\Repositories\Budget\BudgetRepositoryInterface');
-
- // fake!
- $repository->shouldReceive('getBudgets')->andReturn($budgets);
- $repository->shouldReceive('getBudgetLimitRepetitions')->andReturn($repetitions[0], $repetitions[1], new Collection);
- $repository->shouldReceive('spentInPeriodCorrected')->andReturn(10);
- $repository->shouldReceive('getWithoutBudgetSum')->andReturn(10);
-
- $this->call('GET', '/chart/budget/frontpage');
- $this->assertResponseOk();
- }
-
- /**
- * @covers FireflyIII\Http\Controllers\Chart\BudgetController::year
- */
- public function testYear()
- {
- $user = FactoryMuffin::create('FireflyIII\User');
- $budget = FactoryMuffin::create('FireflyIII\Models\Budget');
- $collection = new Collection([$budget]);
- $this->be($user);
-
-
- // mock!
- $repository = $this->mock('FireflyIII\Repositories\Budget\BudgetRepositoryInterface');
-
- // fake!
- $repository->shouldReceive('getBudgets')->andReturn($collection);
- $repository->shouldReceive('spentInPeriodCorrected')->andReturn(0);
-
-
- $this->call('GET', '/chart/budget/year/2015');
- $this->assertResponseOk();
- }
-
- /**
- * @covers FireflyIII\Http\Controllers\Chart\BudgetController::year
- */
- public function testYearShared()
- {
- $user = FactoryMuffin::create('FireflyIII\User');
- $this->be($user);
-
- $this->call('GET', '/chart/budget/year/2015/shared');
- $this->assertResponseOk();
- }
-
-}
diff --git a/tests/controllers/charts/ChartCategoryControllerTest.php b/tests/controllers/charts/ChartCategoryControllerTest.php
deleted file mode 100644
index fe544b7d1f..0000000000
--- a/tests/controllers/charts/ChartCategoryControllerTest.php
+++ /dev/null
@@ -1,125 +0,0 @@
-be($category->user);
-
- $this->call('GET', '/chart/category/' . $category->id . '/all');
- $this->assertResponseOk();
-
-
- }
-
- /**
- * @covers FireflyIII\Http\Controllers\Chart\CategoryController::frontpage
- */
- public function testFrontpage()
- {
- $user = FactoryMuffin::create('FireflyIII\User');
- $this->be($user);
-
- // make data:
- $set = [
- ['name' => 'Something', 'sum' => 100],
- ['name' => 'Something Else', 'sum' => 200],
- ['name' => 'Something Else Entirely', 'sum' => 200]
- ];
-
- // mock!
- $repository = $this->mock('FireflyIII\Repositories\Category\CategoryRepositoryInterface');
-
- // fake!
- $repository->shouldReceive('getCategoriesAndExpensesCorrected')->andReturn($set);
-
- //getCategoriesAndExpensesCorrected
-
- $this->call('GET', '/chart/category/frontpage');
- $this->assertResponseOk();
- }
-
- /**
- * @covers FireflyIII\Http\Controllers\Chart\CategoryController::month
- */
- public function testMonth()
- {
- $category = FactoryMuffin::create('FireflyIII\Models\Category');
- $this->be($category->user);
-
- $this->call('GET', '/chart/category/' . $category->id . '/month');
- $this->assertResponseOk();
- }
-
- /**
- * @covers FireflyIII\Http\Controllers\Chart\CategoryController::year
- */
- public function testYear()
- {
- $user = FactoryMuffin::create('FireflyIII\User');
- $this->be($user);
-
- $categories = new Collection([FactoryMuffin::create('FireflyIII\Models\Category')]);
-
- // mock!
- $repository = $this->mock('FireflyIII\Repositories\Category\CategoryRepositoryInterface');
-
- // fake!
- $repository->shouldReceive('getCategories')->andReturn($categories);
- $repository->shouldReceive('spentInPeriodCorrected')->andReturn(0);
-
- $this->call('GET', '/chart/category/year/2015');
- $this->assertResponseOk();
- }
-
- /**
- * @covers FireflyIII\Http\Controllers\Chart\CategoryController::year
- */
- public function testYearShared()
- {
- $user = FactoryMuffin::create('FireflyIII\User');
- $this->be($user);
-
- $categories = new Collection([FactoryMuffin::create('FireflyIII\Models\Category')]);
-
- // mock!
- $repository = $this->mock('FireflyIII\Repositories\Category\CategoryRepositoryInterface');
-
- // fake!
- $repository->shouldReceive('getCategories')->andReturn($categories);
- $repository->shouldReceive('spentInPeriodCorrected')->andReturn(0);
-
- $this->call('GET', '/chart/category/year/2015/shared');
- $this->assertResponseOk();
- }
-
-}
diff --git a/tests/controllers/charts/ChartPiggyBankControllerTest.php b/tests/controllers/charts/ChartPiggyBankControllerTest.php
deleted file mode 100644
index b5b27fc0c5..0000000000
--- a/tests/controllers/charts/ChartPiggyBankControllerTest.php
+++ /dev/null
@@ -1,53 +0,0 @@
-be($piggy->account->user);
-
- // data:
- $obj = new stdClass;
- $obj->sum = 100;
- $obj->date = '2015-01-01';
- $set = [
- $obj
- ];
-
- // mock!
- $repository = $this->mock('FireflyIII\Repositories\PiggyBank\PiggyBankRepositoryInterface');
-
- // fake!
- $repository->shouldReceive('getEventSummarySet')->andReturn($set);
-
- $this->call('GET', '/chart/piggyBank/' . $piggy->id);
- $this->assertResponseOk();
- }
-}
diff --git a/tests/controllers/charts/ChartReportControllerTest.php b/tests/controllers/charts/ChartReportControllerTest.php
deleted file mode 100644
index 950bcb25a5..0000000000
--- a/tests/controllers/charts/ChartReportControllerTest.php
+++ /dev/null
@@ -1,77 +0,0 @@
-be($user);
-
- $this->call('GET', '/chart/report/in-out/2015');
- $this->assertResponseOk();
-
- }
-
- /**
- * @covers FireflyIII\Http\Controllers\Chart\ReportController::yearInOut
- */
- public function testYearInOutShared()
- {
- $user = FactoryMuffin::create('FireflyIII\User');
- $this->be($user);
-
- $this->call('GET', '/chart/report/in-out/2015/shared');
- $this->assertResponseOk();
-
- }
-
- /**
- * @covers FireflyIII\Http\Controllers\Chart\ReportController::yearInOutSummarized
- */
- public function testYearInOutSummarized()
- {
- $user = FactoryMuffin::create('FireflyIII\User');
- $this->be($user);
-
- $this->call('GET', '/chart/report/in-out-sum/2015');
- $this->assertResponseOk();
- }
-
- /**
- * @covers FireflyIII\Http\Controllers\Chart\ReportController::yearInOutSummarized
- */
- public function testYearInOutSummarizedShared()
- {
- $user = FactoryMuffin::create('FireflyIII\User');
- $this->be($user);
-
- $this->call('GET', '/chart/report/in-out-sum/2015/shared');
- $this->assertResponseOk();
- }
-}
diff --git a/tests/factories/all.php b/tests/factories/all.php
deleted file mode 100644
index 96a6bb4044..0000000000
--- a/tests/factories/all.php
+++ /dev/null
@@ -1,321 +0,0 @@
- 'word',
- ]
-);
-
-FactoryMuffin::define(
- 'FireflyIII\Models\Bill',
- [
- 'user_id' => 'factory|FireflyIII\User',
- 'name' => 'sentence',
- 'match' => function () {
- $words = [];
- for ($i = 0; $i < 3; $i++) {
- $words[] = RandomString::generateRandomString(5);
- }
-
- return join(',', $words);
- },
- 'amount_min' => 10,
- 'amount_max' => 20,
- 'date' => 'date',
- 'active' => 1,
- 'automatch' => 1,
- 'repeat_freq' => 'monthly',
- 'skip' => 0,
- 'name_encrypted' => 1,
- 'match_encrypted' => 1,
-
- ]
-);
-
-FactoryMuffin::define(
- 'FireflyIII\Models\Account',
- [
- 'user_id' => 'factory|FireflyIII\User',
- 'account_type_id' => 'factory|FireflyIII\Models\AccountType',
- 'name' => 'word',
- 'active' => 'boolean',
- 'encrypted' => function () {
- return true;
- },
- 'virtual_balance' => 0
- ]
-);
-
-FactoryMuffin::define(
- 'FireflyIII\Models\Tag',
- [
- 'description' => 'sentence',
- 'user_id' => 'factory|FireflyIII\User',
- 'tag' => function () {
- return RandomString::generateRandomString(20);
- },
- 'tagMode' => 'nothing',
- 'date' => 'date',
- 'latitude' => 12,
- 'longitude' => 13,
- 'zoomLevel' => 3,
- ]
-);
-
-FactoryMuffin::define(
- 'FireflyIII\Models\Budget',
- [
- 'user_id' => 'factory|FireflyIII\User',
- 'name' => 'sentence',
- 'active' => 'boolean',
- 'encrypted' => 1,
- ]
-);
-
-FactoryMuffin::define(
- 'FireflyIII\Models\TransactionGroup',
- [
- 'user_id' => 'factory|FireflyIII\User',
- 'relation' => 'balance',
- ]
-);
-
-
-FactoryMuffin::define(
- 'FireflyIII\Models\Category',
- [
- 'user_id' => 'factory|FireflyIII\User',
- 'name' => 'sentence',
- 'encrypted' => 1,
- ]
-);
-
-FactoryMuffin::define(
- 'FireflyIII\Models\LimitRepetition',
- [
- 'budget_limit_id' => 'factory|FireflyIII\Models\BudgetLimit',
- 'startdate' => 'date',
- 'enddate' => 'date',
- 'amount' => function () {
- return rand(1, 100);
- },
- ]
-);
-
-FactoryMuffin::define(
- 'FireflyIII\Models\BudgetLimit',
- [
- 'budget_id' => 'factory|FireflyIII\Models\Budget',
- 'startdate' => 'date',
- 'amount' => function () {
- return rand(1, 100);
- },
- 'repeats' => 'false',
- 'repeat_freq' => 'monthly',
-
- ]
-);
-
-
-FactoryMuffin::define(
- 'FireflyIII\Models\Preference',
- [
- 'name' => 'word',
- 'data' => 'sentence',
- 'user_id' => 'factory|FireflyIII\User',
- ]
-);
-
-FactoryMuffin::define(
- 'FireflyIII\Models\AccountType',
- [
- 'type' => function () {
- $types = ['Expense account', 'Revenue account', 'Asset account', 'Cash account'];
- $count = DB::table('account_types')->count();
- if ($count < 4) {
- return $types[$count];
- } else {
- return RandomString::generateRandomString(10);
- }
- },
- 'editable' => 1,
- ]
-);
-
-FactoryMuffin::define(
- 'FireflyIII\Models\TransactionCurrency',
- [
- 'code' => function () {
- return RandomString::generateRandomString(3);
- },
- 'symbol' => function () {
- return RandomString::generateRandomString(8);
- },
- 'name' => 'word'
- ]
-);
-
-
-FactoryMuffin::define(
- 'FireflyIII\User',
- [
- 'email' => function () {
- $first = RandomString::generateRandomString(20);
- $second = RandomString::generateRandomString(20);
- $domain = RandomString::generateRandomString(30);
- $email = $first . '.' . $second . '@' . $domain . '.com';
-
- return $email;
- },
- 'password' => bcrypt('james'),
- ]
-);
-
-FactoryMuffin::define(
- 'FireflyIII\Models\Transaction',
- [
- 'transaction_journal_id' => 'factory|FireflyIII\Models\TransactionJournal',
- 'amount' => function () {
- return rand(1, 100);
- },
- 'description' => 'sentence',
- 'account_id' => 'factory|FireflyIII\Models\Account'
- ]
-);
-
-FactoryMuffin::define(
- 'FireflyIII\Models\PiggyBank',
- [
- 'account_id' => 'factory|FireflyIII\Models\Account',
- 'name' => 'sentence',
- 'targetamount' => function () {
- return rand(1, 100);
- },
- 'startdate' => 'date',
- 'targetdate' => 'date',
- 'remind_me' => false,
- 'reminder_skip' => 0,
- 'order' => 0,
- ]
-);
-
-FactoryMuffin::define(
- 'FireflyIII\Models\PiggyBankRepetition',
- [
- 'piggy_bank_id' => 'factory|FireflyIII\Models\PiggyBank',
- 'startdate' => 'date',
- 'targetdate' => 'date',
- 'currentamount' => function () {
- return rand(1, 100);
- },
- ]
-);
-
-
-FactoryMuffin::define(
- 'FireflyIII\Models\PiggyBankEvent',
- [
- 'piggy_bank_id' => 'factory|FireflyIII\Models\PiggyBank',
- 'transaction_journal_id' => 'factory|FireflyIII\Models\TransactionJournal',
- 'date' => 'date',
- 'amount' => function () {
- return rand(1, 100);
- },
- ]
-);
-
-
-FactoryMuffin::define(
- 'FireflyIII\Models\TransactionType',
- [
- 'type' => function () {
- $types = ['Withdrawal', 'Deposit', 'Transfer'];
- $count = DB::table('transaction_types')->count();
- if ($count < 3) {
- return $types[$count];
- } else {
- return RandomString::generateRandomString(10);
- }
- }
- ]
-);
-
-FactoryMuffin::define(
- 'FireflyIII\Models\TransactionJournal',
- [
- 'user_id' => 'factory|FireflyIII\User',
- 'transaction_type_id' => 'factory|FireflyIII\Models\TransactionType',
- 'transaction_currency_id' => 'factory|FireflyIII\Models\TransactionCurrency',
- 'description' => 'sentence',
- 'completed' => '1',
- 'date' => 'date',
- 'encrypted' => '1',
- 'order' => '0',
- ], function (TransactionJournal $object, $saved) {
- if ($saved) {
- $one = FactoryMuffin::create('FireflyIII\Models\Account');
- $two = FactoryMuffin::create('FireflyIII\Models\Account');
-
- Transaction::create(
- [
- 'account_id' => $one->id,
- 'transaction_journal_id' => $object->id,
- 'amount' => 100
- ]
- );
- Transaction::create(
- [
- 'account_id' => $two->id,
- 'transaction_journal_id' => $object->id,
- 'amount' => -100
- ]
- );
-
- }
-
-}
-);
diff --git a/tests/functional.suite.yml b/tests/functional.suite.yml
new file mode 100644
index 0000000000..075765bd90
--- /dev/null
+++ b/tests/functional.suite.yml
@@ -0,0 +1,11 @@
+# Codeception Test Suite Configuration
+#
+# Suite for functional (integration) tests
+# Emulate web requests and make application process them
+# Include one of framework modules (Symfony2, Yii2, Laravel5) to use it
+
+class_name: FunctionalTester
+modules:
+ enabled:
+ # add framework module here
+ - \Helper\Functional
\ No newline at end of file
diff --git a/tests/functional/_bootstrap.php b/tests/functional/_bootstrap.php
new file mode 100644
index 0000000000..8a88555806
--- /dev/null
+++ b/tests/functional/_bootstrap.php
@@ -0,0 +1,2 @@
+object = new ChartJsAccountChartGenerator;
-
- parent::setUp();
-
-
- }
-
- /**
- * 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();
- }
-
- /**
- * @covers FireflyIII\Generator\Chart\Account\ChartJsAccountChartGenerator::frontpage
- */
- public function testFrontpage()
- {
- // be somebody
- $user = FactoryMuffin::create('FireflyIII\User');
- $this->be($user);
-
- // create some accounts:
- $accounts = new Collection;
- for ($i = 0; $i < 5; $i++) {
- $accounts->push(FactoryMuffin::create('FireflyIII\Models\Account'));
- }
-
- $preference = FactoryMuffin::create('FireflyIII\Models\Preference');
- $preference->data = 'en';
- $preference->save();
-
- // data for call:
- $start = Carbon::createFromDate(2015, 1, 1);
- $end = Carbon::createFromDate(2015, 1, 15);
-
- // mock language preference:
- Preferences::shouldReceive('get')->withArgs(['language', 'en'])->andReturn($preference);
-
- // mock Steam::balance
- Steam::shouldReceive('balance')->withAnyArgs()->andReturn(0);
-
- // call
- $result = $this->object->frontpage($accounts, $start, $end);
-
- $this->assertEquals($accounts->count(), $result['count']);
- $this->assertCount(15, $result['labels']);
- $this->assertCount($accounts->count(), $result['datasets']);
- }
-
- /**
- * @covers FireflyIII\Generator\Chart\Account\ChartJsAccountChartGenerator::single
- */
- public function testSingle()
- {
- // be somebody
- $user = FactoryMuffin::create('FireflyIII\User');
- $this->be($user);
-
- $preference = FactoryMuffin::create('FireflyIII\Models\Preference');
- $preference->data = 'en';
- $preference->save();
-
- // mock language preference:
- Preferences::shouldReceive('get')->withArgs(['language', 'en'])->andReturn($preference);
-
- // mock Steam::balance
- Steam::shouldReceive('balance')->withAnyArgs()->andReturn(0);
-
- // data for call:
- $start = Carbon::createFromDate(2015, 1, 1);
- $end = Carbon::createFromDate(2015, 1, 15);
- $account = FactoryMuffin::create('FireflyIII\Models\Account');
-
- // call
- $result = $this->object->single($account, $start, $end);
-
-
- // test
- $this->assertCount(15, $result['labels']);
- $this->assertEquals($account->name, $result['datasets'][0]['label']);
- $this->assertCount(15, $result['datasets'][0]['data']);
-
-
- }
-}
\ No newline at end of file
diff --git a/tests/generators/ChartJsBillChartGeneratorTest.php b/tests/generators/ChartJsBillChartGeneratorTest.php
deleted file mode 100644
index 62485e9c84..0000000000
--- a/tests/generators/ChartJsBillChartGeneratorTest.php
+++ /dev/null
@@ -1,100 +0,0 @@
-object = new ChartJsBillChartGenerator();
-
-
- }
-
- /**
- * 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();
- }
-
- /**
- * @covers FireflyIII\Generator\Chart\Bill\ChartJsBillChartGenerator::frontpage
- */
- public function testFrontpage()
- {
- // to test frontpage, we generate the exact fake entries
- // needed:
- $paid = new Collection;
- for ($i = 0; $i < 5; $i++) {
- $obj = new stdClass();
- $obj->description = 'Something';
- $obj->amount = 100;
- $paid->push($obj);
- }
-
- $unpaid = new Collection;
- $sum = 0;
- for ($i = 0; $i < 5; $i++) {
- $bill = FactoryMuffin::create('FireflyIII\Models\Bill');
- $date = new Carbon;
- $sum += (($bill->amount_max + $bill->amount_min) / 2);
- $unpaid->push([$bill, $date]);
- }
-
-
- $data = $this->object->frontpage($paid, $unpaid);
-
- $this->assertCount(2, $data);
- $this->assertEquals($sum, $data[0]['value']);
- $this->assertEquals(500, $data[1]['value']);
- }
-
- /**
- * @covers FireflyIII\Generator\Chart\Bill\ChartJsBillChartGenerator::single
- */
- public function testSingle()
- {
-
- $preference = FactoryMuffin::create('FireflyIII\Models\Preference');
- $preference->data = 'en';
- $preference->save();
-
- // mock language preference:
- Preferences::shouldReceive('get')->withArgs(['language', 'en'])->andReturn($preference);
-
- $bill = FactoryMuffin::create('FireflyIII\Models\Bill');
- $entries = new Collection;
- for ($i = 0; $i < 5; $i++) {
- $obj = new stdClass;
- $obj->amount = 100;
- $obj->date = new Carbon;
- $entries->push($obj);
- }
- $data = $this->object->single($bill, $entries);
-
- $this->assertCount(5, $data['labels']);
- $this->assertCount(5, $data['datasets'][1]['data']);
- $this->assertEquals(100, $data['datasets'][1]['data'][0]); // see if first is equal.
-
-
- }
-}
\ No newline at end of file
diff --git a/tests/generators/ChartJsBudgetChartGeneratorTest.php b/tests/generators/ChartJsBudgetChartGeneratorTest.php
deleted file mode 100644
index 4fe5e2290e..0000000000
--- a/tests/generators/ChartJsBudgetChartGeneratorTest.php
+++ /dev/null
@@ -1,113 +0,0 @@
-object = new ChartJsBudgetChartGenerator();
-
- }
-
- /**
- * 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();
- }
-
- /**
- * @covers FireflyIII\Generator\Chart\Budget\ChartJsBudgetChartGenerator::budget
- */
- public function testBudget()
- {
- $preference = FactoryMuffin::create('FireflyIII\Models\Preference');
- $preference->data = 'en';
- $preference->save();
-
- // mock language preference:
- Preferences::shouldReceive('get')->withArgs(['language', 'en'])->andReturn($preference);
-
- // make a collection with some amounts in them.
- $collection = new Collection;
- for ($i = 0; $i < 5; $i++) {
- $collection->push([new Carbon, 100]);
- }
-
- $data = $this->object->budget($collection);
-
- $this->assertCount(5, $data['labels']);
- $this->assertCount(5, $data['datasets'][0]['data']);
- $this->assertEquals(100, $data['datasets'][0]['data'][0]);
- }
-
- /**
- * @covers FireflyIII\Generator\Chart\Budget\ChartJsBudgetChartGenerator::frontpage
- */
- public function testFrontpage()
- {
- // make a collection with some amounts in them.
- $collection = new Collection;
- for ($i = 0; $i < 5; $i++) {
- $collection->push(['Some label', 100, 200, 300]);
- }
-
- $data = $this->object->frontpage($collection);
-
- $this->assertCount(5, $data['labels']);
- $this->assertCount(5, $data['datasets'][0]['data']);
- $this->assertEquals(100, $data['datasets'][0]['data'][0]);
- $this->assertEquals(200, $data['datasets'][1]['data'][0]);
- $this->assertEquals(300, $data['datasets'][2]['data'][0]);
-
- }
-
- /**
- * @covers FireflyIII\Generator\Chart\Budget\ChartJsBudgetChartGenerator::year
- */
- public function testYear()
- {
- $preference = FactoryMuffin::create('FireflyIII\Models\Preference');
- $preference->data = 'en';
- $preference->save();
-
- $budgets = new Collection;
- $entries = new Collection;
-
- // make some budgets:
- for ($i = 0; $i < 5; $i++) {
- $budgets->push(FactoryMuffin::create('FireflyIII\Models\Budget'));
- $entries->push([new Carbon, 100, 100, 100]);
- }
-
- // mock language preference:
- Preferences::shouldReceive('get')->withArgs(['language', 'en'])->andReturn($preference);
-
- $data = $this->object->year($budgets, $entries);
-
- $this->assertCount(5, $data['labels']);
- $this->assertCount(5, $data['datasets']);
- $this->assertCount(3, $data['datasets'][0]['data']);
-
- }
-}
\ No newline at end of file
diff --git a/tests/generators/ChartJsCategoryChartGeneratorTest.php b/tests/generators/ChartJsCategoryChartGeneratorTest.php
deleted file mode 100644
index 3b75f4361a..0000000000
--- a/tests/generators/ChartJsCategoryChartGeneratorTest.php
+++ /dev/null
@@ -1,114 +0,0 @@
-object = new ChartJsCategoryChartGenerator;
-
- }
-
- /**
- * 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();
- }
-
- /**
- * @covers FireflyIII\Generator\Chart\Category\ChartJsCategoryChartGenerator::all
- */
- public function testAll()
- {
-
- $preference = FactoryMuffin::create('FireflyIII\Models\Preference');
- $preference->data = 'en';
- $preference->save();
-
- // mock language preference:
- Preferences::shouldReceive('get')->withArgs(['language', 'en'])->andReturn($preference);
-
-
- // make a collection of stuff:
- $collection = new Collection;
- for ($i = 0; $i < 5; $i++) {
- $collection->push([new Carbon, 100]);
- }
-
- $data = $this->object->all($collection);
-
- $this->assertCount(5, $data['labels']);
- $this->assertCount(5, $data['datasets'][0]['data']);
- $this->assertEquals(100, $data['datasets'][0]['data'][0]);
- }
-
- /**
- * @covers FireflyIII\Generator\Chart\Category\ChartJsCategoryChartGenerator::frontpage
- */
- public function testFrontpage()
- {
- // make a collection of stuff:
- $collection = new Collection;
- for ($i = 0; $i < 5; $i++) {
- $collection->push(['name' => 'Something', 'sum' => 100]);
- }
-
- $data = $this->object->frontpage($collection);
-
- $this->assertCount(5, $data['labels']);
- $this->assertCount(5, $data['datasets'][0]['data']);
- $this->assertEquals('Something', $data['labels'][0]);
- $this->assertEquals(100, $data['datasets'][0]['data'][0]);
- }
-
- /**
- * @covers FireflyIII\Generator\Chart\Category\ChartJsCategoryChartGenerator::year
- */
- public function testYear()
- {
- $preference = FactoryMuffin::create('FireflyIII\Models\Preference');
- $preference->data = 'en';
- $preference->save();
-
- // mock language preference:
- Preferences::shouldReceive('get')->withArgs(['language', 'en'])->andReturn($preference);
-
- // make a collection of stuff:
- $collection = new Collection;
- $categories = new Collection;
- for ($i = 0; $i < 5; $i++) {
- $categories->push(FactoryMuffin::create('FireflyIII\Models\Category'));
- $collection->push([new Carbon, 100, 100, 100]);
- }
-
- $data = $this->object->year($categories, $collection);
-
- $this->assertCount(5, $data['labels']);
- $this->assertEquals($categories->first()->name, $data['labels'][0]);
- $this->assertCount(3, $data['datasets'][0]['data']);
-
-
- }
-}
\ No newline at end of file
diff --git a/tests/generators/ChartJsPiggyBankChartGeneratorTest.php b/tests/generators/ChartJsPiggyBankChartGeneratorTest.php
deleted file mode 100644
index e63b9d73fd..0000000000
--- a/tests/generators/ChartJsPiggyBankChartGeneratorTest.php
+++ /dev/null
@@ -1,66 +0,0 @@
-object = new ChartJsPiggyBankChartGenerator;
-
- }
-
- /**
- * 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();
- }
-
- /**
- * @covers FireflyIII\Generator\Chart\PiggyBank\ChartJsPiggyBankChartGenerator::history
- */
- public function testHistory()
- {
- $preference = FactoryMuffin::create('FireflyIII\Models\Preference');
- $preference->data = 'en';
- $preference->save();
-
- // mock language preference:
- Preferences::shouldReceive('get')->withArgs(['language', 'en'])->andReturn($preference);
-
- // create a set
- $set = new Collection;
- for ($i = 0; $i < 5; $i++) {
- $obj = new stdClass;
- $obj->date = new Carbon;
- $obj->sum = 100;
- $set->push($obj);
- }
-
- $data = $this->object->history($set);
- $this->assertCount(5, $data['labels']);
- $this->assertCount(5, $data['datasets'][0]['data']);
- $this->assertEquals(100, $data['datasets'][0]['data'][0]);
- $this->assertEquals(500, $data['datasets'][0]['data'][4]);
-
-
- }
-}
\ No newline at end of file
diff --git a/tests/generators/ChartJsReportChartGeneratorTest.php b/tests/generators/ChartJsReportChartGeneratorTest.php
deleted file mode 100644
index 4c41c23123..0000000000
--- a/tests/generators/ChartJsReportChartGeneratorTest.php
+++ /dev/null
@@ -1,80 +0,0 @@
-object = new ChartJsReportChartGenerator;
-
- }
-
- /**
- * 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();
- }
-
- /**
- * FireflyIII\Generator\Chart\Report\ChartJsReportChartGenerator::yearInOut
- */
- public function testYearInOut()
- {
- $preference = FactoryMuffin::create('FireflyIII\Models\Preference');
- $preference->data = 'en';
- $preference->save();
-
- // mock language preference:
- Preferences::shouldReceive('get')->withArgs(['language', 'en'])->andReturn($preference);
-
- // make set:
- $collection = new Collection;
- for ($i = 0; $i < 5; $i++) {
- $collection->push([new Carbon, 200, 100]);
- }
-
- $data = $this->object->yearInOut($collection);
-
- $this->assertEquals(200, $data['datasets'][0]['data'][0]);
- $this->assertEquals(100, $data['datasets'][1]['data'][0]);
- $this->assertCount(5, $data['labels']);
-
- }
-
- /**
- * FireflyIII\Generator\Chart\Report\ChartJsReportChartGenerator::yearInOutSummarized
- */
- public function testYearInOutSummarized()
- {
- // make set:
- $income = 2400;
- $expense = 1200;
-
- $data = $this->object->yearInOutSummarized($income, $expense, 12);
-
- $this->assertEquals(200, $data['datasets'][0]['data'][1]);
- $this->assertEquals(100, $data['datasets'][1]['data'][1]);
-
- }
-}
\ No newline at end of file
diff --git a/tests/generators/GoogleAccountChartGeneratorTest.php b/tests/generators/GoogleAccountChartGeneratorTest.php
deleted file mode 100644
index 864034180b..0000000000
--- a/tests/generators/GoogleAccountChartGeneratorTest.php
+++ /dev/null
@@ -1,120 +0,0 @@
-object = new GoogleAccountChartGenerator;
-
- }
-
- /**
- * 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();
- }
-
- /**
- * @covers FireflyIII\Generator\Chart\Account\GoogleAccountChartGenerator::all
- */
- public function testAll()
- {
- // be somebody
- $user = FactoryMuffin::create('FireflyIII\User');
- $this->be($user);
-
- // create some accounts:
- $accounts = new Collection;
- for ($i = 0; $i < 5; $i++) {
- $accounts->push(FactoryMuffin::create('FireflyIII\Models\Account'));
- }
-
- // data for call:
- $start = Carbon::createFromDate(2015, 1, 1);
- $end = Carbon::createFromDate(2015, 1, 15);
-
- // mock Steam::balance
- Steam::shouldReceive('balance')->withAnyArgs()->andReturn(0);
-
- $data = $this->object->all($accounts, $start, $end);
- $this->assertCount(11, $data['cols']); // accounts * 2 + date.
- // fifteen days,
- $this->assertCount(16, $data['rows']); // 15 + 1?
- }
-
- /**
- * @covers FireflyIII\Generator\Chart\Account\GoogleAccountChartGenerator::frontpage
- */
- public function testFrontpage()
- {
- // be somebody
- $user = FactoryMuffin::create('FireflyIII\User');
- $this->be($user);
-
- // create some accounts:
- $accounts = new Collection;
- for ($i = 0; $i < 5; $i++) {
- $accounts->push(FactoryMuffin::create('FireflyIII\Models\Account'));
- }
-
- // data for call:
- $start = Carbon::createFromDate(2015, 1, 1);
- $end = Carbon::createFromDate(2015, 1, 15);
-
- // mock Steam::balance
- Steam::shouldReceive('balance')->withAnyArgs()->andReturn(0);
-
- $data = $this->object->frontpage($accounts, $start, $end);
- $this->assertCount(11, $data['cols']); // accounts * 2 + date.
- // fifteen days,
- $this->assertCount(16, $data['rows']); // 15 + 1?
- }
-
- /**
- * @covers FireflyIII\Generator\Chart\Account\GoogleAccountChartGenerator::single
- */
- public function testSingle()
- {
- // be somebody
- $user = FactoryMuffin::create('FireflyIII\User');
- $this->be($user);
-
- /** @var Account $account */
- $account = FactoryMuffin::create('FireflyIII\Models\Account');
-
- // data for call:
- $start = Carbon::createFromDate(2015, 1, 1);
- $end = Carbon::createFromDate(2015, 1, 15);
-
- // mock Steam::balance
- Steam::shouldReceive('balance')->withAnyArgs()->andReturn(0);
-
- $data = $this->object->single($account, $start, $end);
- $this->assertCount(3, $data['cols']); // account, date, certainty
- // fifteen days,
- $this->assertCount(15, $data['rows']); // 15 days
- }
-
-}
\ No newline at end of file
diff --git a/tests/generators/GoogleBillChartGeneratorTest.php b/tests/generators/GoogleBillChartGeneratorTest.php
deleted file mode 100644
index 5576098595..0000000000
--- a/tests/generators/GoogleBillChartGeneratorTest.php
+++ /dev/null
@@ -1,90 +0,0 @@
-object = new GoogleBillChartGenerator;
-
- }
-
- /**
- * 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();
- }
-
- /**
- * @covers FireflyIII\Generator\Chart\Bill\GoogleBillChartGenerator::frontpage
- */
- public function testFrontpage()
- {
- // to test frontpage, we generate the exact fake entries
- // needed:
- $paid = new Collection;
- for ($i = 0; $i < 5; $i++) {
- $obj = new stdClass();
- $obj->description = 'Something';
- $obj->amount = 100;
- $paid->push($obj);
- }
-
- $unpaid = new Collection;
- $sum = 0;
- for ($i = 0; $i < 5; $i++) {
- $bill = FactoryMuffin::create('FireflyIII\Models\Bill');
- $date = new Carbon;
- $sum += (($bill->amount_max + $bill->amount_min) / 2);
- $unpaid->push([$bill, $date]);
- }
-
-
- $data = $this->object->frontpage($paid, $unpaid);
-
- $this->assertCount(2, $data['cols']);
- $this->assertCount(2, $data['rows']); // two rows, two columns.
- }
-
- /**
- * @covers FireflyIII\Generator\Chart\Bill\GoogleBillChartGenerator::single
- */
- public function testSingle()
- {
- $bill = FactoryMuffin::create('FireflyIII\Models\Bill');
- $entries = new Collection;
- for ($i = 0; $i < 5; $i++) {
- $obj = new stdClass;
- $obj->amount = 100;
- $obj->date = new Carbon;
- $entries->push($obj);
- }
- $data = $this->object->single($bill, $entries);
-
- $this->assertCount(5, $data['rows']);
- $this->assertCount(4, $data['cols']);
- $this->assertEquals(100, $data['rows'][0]['c'][3]['v']);
- }
-}
\ No newline at end of file
diff --git a/tests/generators/GoogleBudgetChartGeneratorTest.php b/tests/generators/GoogleBudgetChartGeneratorTest.php
deleted file mode 100644
index 13b3cb54bc..0000000000
--- a/tests/generators/GoogleBudgetChartGeneratorTest.php
+++ /dev/null
@@ -1,99 +0,0 @@
-object = new GoogleBudgetChartGenerator();
-
- }
-
-
- /**
- * 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();
- }
-
-
- /**
- * @covers FireflyIII\Generator\Chart\Budget\GoogleBudgetChartGenerator::budget
- */
- public function testBudget()
- {
- // make a collection with some amounts in them.
- $collection = new Collection;
- for ($i = 0; $i < 5; $i++) {
- $collection->push([new Carbon, 100]);
- }
-
- $data = $this->object->budget($collection);
-
- $this->assertCount(5, $data['rows']);
- $this->assertCount(2, $data['cols']);
- $this->assertEquals(100, $data['rows'][0]['c'][1]['v']);
- }
-
- /**
- * @covers FireflyIII\Generator\Chart\Budget\GoogleBudgetChartGenerator::frontpage
- */
- public function testFrontpage()
- {
- // make a collection with some amounts in them.
- $collection = new Collection;
- for ($i = 0; $i < 5; $i++) {
- $collection->push(['Some label', 100, 200, 300]);
- }
-
- $data = $this->object->frontpage($collection);
-
- $this->assertCount(5, $data['rows']);
- $this->assertEquals(100, $data['rows'][0]['c'][1]['v']);
- $this->assertEquals(200, $data['rows'][0]['c'][2]['v']);
- $this->assertEquals(300, $data['rows'][0]['c'][3]['v']);
- }
-
- /**
- * @covers FireflyIII\Generator\Chart\Budget\GoogleBudgetChartGenerator::year
- */
- public function testYear()
- {
- $budgets = new Collection;
- $entries = new Collection;
-
- // make some budgets:
- for ($i = 0; $i < 5; $i++) {
- $budgets->push(FactoryMuffin::create('FireflyIII\Models\Budget'));
- $entries->push([new Carbon, 100, 100, 100]);
- }
-
- $data = $this->object->year($budgets, $entries);
-
- $this->assertCount(5, $data['rows']);
- $this->assertCount(6, $data['cols']);
- }
-}
\ No newline at end of file
diff --git a/tests/generators/GoogleCategoryChartGeneratorTest.php b/tests/generators/GoogleCategoryChartGeneratorTest.php
deleted file mode 100644
index 78f0ffde39..0000000000
--- a/tests/generators/GoogleCategoryChartGeneratorTest.php
+++ /dev/null
@@ -1,116 +0,0 @@
-object = new GoogleCategoryChartGenerator();
-
- }
-
- /**
- * 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();
- }
-
-
- /**
- * @covers FireflyIII\Generator\Chart\Category\GoogleCategoryChartGenerator::all
- */
- public function testAll()
- {
- // make a collection of stuff:
- $collection = new Collection;
- for ($i = 0; $i < 5; $i++) {
- $collection->push([new Carbon, 100]);
- }
-
- $data = $this->object->all($collection);
-
- $this->assertCount(5, $data['rows']);
- $this->assertCount(2, $data['cols']);
- $this->assertEquals(100, $data['rows'][0]['c'][1]['v']);
- }
-
- /**
- * @covers FireflyIII\Generator\Chart\Category\GoogleCategoryChartGenerator::frontpage
- */
- public function testFrontpage()
- {
- // make a collection of stuff:
- $collection = new Collection;
- for ($i = 0; $i < 5; $i++) {
- $collection->push(['name' => 'Something', 'sum' => 100]);
- }
-
- $data = $this->object->frontpage($collection);
-
- $this->assertCount(5, $data['rows']);
- $this->assertCount(2, $data['cols']);
- $this->assertEquals('Something', $data['rows'][0]['c'][0]['v']);
- $this->assertEquals(100, $data['rows'][0]['c'][1]['v']);
-
- }
-
- /**
- * @covers FireflyIII\Generator\Chart\Category\GoogleCategoryChartGenerator::month
- */
- public function testMonth()
- {
- // make a collection of stuff:
- $collection = new Collection;
- for ($i = 0; $i < 5; $i++) {
- $collection->push([new Carbon, 100]);
- }
-
- $data = $this->object->month($collection);
-
- $this->assertCount(5, $data['rows']);
- $this->assertCount(2, $data['cols']);
- $this->assertEquals(100, $data['rows'][0]['c'][1]['v']);
- }
-
- /**
- * @covers FireflyIII\Generator\Chart\Category\GoogleCategoryChartGenerator::year
- */
- public function testYear()
- {
- // make a collection of stuff:
- $collection = new Collection;
- $categories = new Collection;
- for ($i = 0; $i < 5; $i++) {
- $categories->push(FactoryMuffin::create('FireflyIII\Models\Category'));
- $collection->push([new Carbon, 100, 100, 100]);
- }
-
- $data = $this->object->year($categories, $collection);
-
- $this->assertCount(5, $data['rows']);
- $this->assertEquals($categories->first()->name, $data['cols'][1]['label']);
- $this->assertEquals(100, $data['rows'][0]['c'][1]['v']);
-
- }
-}
\ No newline at end of file
diff --git a/tests/generators/GooglePiggyBankChartGeneratorTest.php b/tests/generators/GooglePiggyBankChartGeneratorTest.php
deleted file mode 100644
index 7c1daf7a9f..0000000000
--- a/tests/generators/GooglePiggyBankChartGeneratorTest.php
+++ /dev/null
@@ -1,58 +0,0 @@
-object = new GooglePiggyBankChartGenerator();
-
- }
-
- /**
- * 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();
- }
-
- /**
- * @covers FireflyIII\Generator\Chart\PiggyBank\GooglePiggyBankChartGenerator::history
- */
- public function testHistory()
- {
- // create a set
- $set = new Collection;
- for ($i = 0; $i < 5; $i++) {
- $obj = new stdClass;
- $obj->date = new Carbon;
- $obj->sum = 100;
- $set->push($obj);
- }
-
- $data = $this->object->history($set);
- $this->assertCount(5, $data['rows']);
- $this->assertCount(2, $data['cols']);
-
- $this->assertEquals(100, $data['rows'][0]['c'][1]['v']);
- $this->assertEquals(500, $data['rows'][4]['c'][1]['v']);
- }
-}
\ No newline at end of file
diff --git a/tests/generators/GoogleReportChartGeneratorTest.php b/tests/generators/GoogleReportChartGeneratorTest.php
deleted file mode 100644
index 57c715ad02..0000000000
--- a/tests/generators/GoogleReportChartGeneratorTest.php
+++ /dev/null
@@ -1,69 +0,0 @@
-object = new GoogleReportChartGenerator;
-
- }
-
- /**
- * 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();
- }
-
- /**
- * FireflyIII\Generator\Chart\Report\GoogleReportChartGenerator::yearInOut
- */
- public function testYearInOut()
- {
- // make set:
- $collection = new Collection;
- for ($i = 0; $i < 5; $i++) {
- $collection->push([new Carbon, 200, 100]);
- }
-
- $data = $this->object->yearInOut($collection);
-
- $this->assertCount(5, $data['rows']);
-
- $this->assertEquals(200, $data['rows'][0]['c'][1]['v']);
- $this->assertEquals(100, $data['rows'][0]['c'][2]['v']);
- }
-
- /**
- * FireflyIII\Generator\Chart\Report\GoogleReportChartGenerator::yearInOutSummarized
- */
- public function testYearInOutSummarized()
- {
- // make set:
- $income = 2400;
- $expense = 1200;
-
- $data = $this->object->yearInOutSummarized($income, $expense, 12);
-
- $this->assertEquals(200, $data['rows'][1]['c'][1]['v']);
- $this->assertEquals(100, $data['rows'][1]['c'][2]['v']);
- }
-}
\ No newline at end of file
diff --git a/tests/helpers/ConnectJournalToPiggyBankTest.php b/tests/helpers/ConnectJournalToPiggyBankTest.php
deleted file mode 100644
index 09967aa788..0000000000
--- a/tests/helpers/ConnectJournalToPiggyBankTest.php
+++ /dev/null
@@ -1,139 +0,0 @@
-get('piggy_bank_id'))));
-
- /**
- * Sets up the fixture, for example, opens a network connection.
- * This method is called before a test is executed.
- */
- public function setUp()
- {
- parent::setUp();
- }
-
- /**
- * Tears down the fixture, for example, closes a network connection.
- * This method is called after a test is executed.
- */
- public function tearDown()
- {
- parent::tearDown();
- }
-
- /**
- * @SuppressWarnings(PHPMD.ExcessiveMethodLength)
- * @covers FireflyIII\Handlers\Events\ConnectJournalToPiggyBank::handle
- */
- public function testNoRepetition()
- {
- FactoryMuffin::create('FireflyIII\Models\TransactionType');
- FactoryMuffin::create('FireflyIII\Models\TransactionType');
-
- $user = FactoryMuffin::create('FireflyIII\User');
- $this->be($user);
-
- $journal = FactoryMuffin::create('FireflyIII\Models\TransactionJournal');
- /** @var \FireflyIII\Models\PiggyBank $piggyBank */
- $piggyBank = FactoryMuffin::create('FireflyIII\Models\PiggyBank');
- $account1 = FactoryMuffin::create('FireflyIII\Models\Account');
- $account2 = FactoryMuffin::create('FireflyIII\Models\Account');
- $account1->user_id = $user->id;
- $account2->user_id = $user->id;
- $piggyBank->account_id = $account1->id;
- $account1->save();
- $account2->save();
- $piggyBank->save();
-
- // because the event handler responds to this piggy bank, we must remove
- // the piggy bank repetition:
- /** @var \FireflyIII\Models\PiggyBankRepetition $rep */
- foreach ($piggyBank->piggyBankRepetitions()->get() as $rep) {
- $rep->forceDelete();
- }
-
-
- $event = new JournalCreated($journal, $piggyBank->id);
- $class = new ConnectJournalToPiggyBank();
- $result = $class->handle($event);
-
-
- $this->assertFalse($result);
- }
-
- /**
- * @covers FireflyIII\Handlers\Events\ConnectJournalToPiggyBank::handle
- */
- public function testNoSuchPiggy()
- {
- $user = FactoryMuffin::create('FireflyIII\User');
- $this->be($user);
-
- $journal = FactoryMuffin::create('FireflyIII\Models\TransactionJournal');
- $event = new JournalCreated($journal, 1);
- $class = new ConnectJournalToPiggyBank();
- $result = $class->handle($event);
-
-
- $this->assertFalse($result);
- }
-
- /**
- * @covers FireflyIII\Handlers\Events\ConnectJournalToPiggyBank::handle
- */
- public function testWithRepetition()
- {
- $user = FactoryMuffin::create('FireflyIII\User');
- $this->be($user);
- FactoryMuffin::create('FireflyIII\Models\TransactionType'); // withdrawal
- FactoryMuffin::create('FireflyIII\Models\TransactionType'); // deposit
-
- $journal = FactoryMuffin::create('FireflyIII\Models\TransactionJournal');
- $piggyBank = FactoryMuffin::create('FireflyIII\Models\PiggyBank');
-
- $journal->user_id = $user->id;
- $journal->save();
-
- // create piggy bank event to continue handler:
- $start = clone $journal->date;
- $end = clone $journal->date;
- $start->subDay();
- $end->addDay();
-
- PiggyBankRepetition::create(
- [
- 'piggy_bank_id' => $piggyBank->id,
- 'startdate' => $start->format('Y-m-d'),
- 'targetdate' => $end->format('Y-m-d'),
- 'currentamount' => 0,
- ]
- );
-
-
- /** @var Transaction $transaction */
- foreach ($journal->transactions()->get() as $transaction) {
- if ($transaction->amount < 0) {
- $piggyBank->account_id = $transaction->account_id;
- $account = $transaction->account;
- $account->user_id = $user->id;
- $account->save();
- $piggyBank->account_id = $account->id;
- $piggyBank->save();
- }
- }
- $event = new JournalCreated($journal, $piggyBank->id);
- $class = new ConnectJournalToPiggyBank();
- $result = $class->handle($event);
-
- $this->assertTrue($result);
- }
-}
diff --git a/tests/helpers/ReportHelperTest.php b/tests/helpers/ReportHelperTest.php
deleted file mode 100644
index 91a3576d47..0000000000
--- a/tests/helpers/ReportHelperTest.php
+++ /dev/null
@@ -1,329 +0,0 @@
-object = new ReportHelper($query);
- }
-
- /**
- * Tears down the fixture, for example, closes a network connection.
- * This method is called after a test is executed.
- */
- public function tearDown()
- {
- parent::tearDown();
- }
-
- /**
- * @covers FireflyIII\Helpers\Report\ReportHelper::getAccountReport
- */
- public function testGetAccountReport()
- {
- FactoryMuffin::create('FireflyIII\Models\AccountType');
- FactoryMuffin::create('FireflyIII\Models\AccountType');
- $asset = FactoryMuffin::create('FireflyIII\Models\AccountType');
- $cash = FactoryMuffin::create('FireflyIII\Models\AccountType');
- $user = FactoryMuffin::create('FireflyIII\User');
- for ($i = 0; $i < 5; $i++) {
- $account = FactoryMuffin::create('FireflyIII\Models\Account');
- $account->user_id = $user->id;
- $account->account_type_id = $asset->id;
- $account->save();
-
- }
-
- $cashAccount = FactoryMuffin::create('FireflyIII\Models\Account');
- $cashAccount->user_id = $user->id;
- $cashAccount->account_type_id = $cash->id;
- $cashAccount->save();
-
- $this->be($user);
- /** @var AccountCollection $object */
- $object = $this->object->getAccountReport(Carbon::now()->startOfMonth(), Carbon::now()->endOfMonth(), false);
-
- $this->assertCount(5, $object->getAccounts());
- $this->assertEquals(0, $object->getDifference());
- $this->assertEquals(0, $object->getEnd());
- $this->assertEquals(0, $object->getStart());
- }
-
- /**
- * @covers FireflyIII\Helpers\Report\ReportHelper::getBalanceReport
- */
- public function testGetBalanceReport()
- {
- // factory!
- FactoryMuffin::create('FireflyIII\Models\AccountType');
- FactoryMuffin::create('FireflyIII\Models\AccountType');
- $asset = FactoryMuffin::create('FireflyIII\Models\AccountType');
- $user = FactoryMuffin::create('FireflyIII\User');
- $rep = FactoryMuffin::create('FireflyIII\Models\LimitRepetition');
- for ($i = 0; $i < 5; $i++) {
- $account = FactoryMuffin::create('FireflyIII\Models\Account');
- $account->user_id = $user->id;
- $account->account_type_id = $asset->id;
- $account->save();
- }
-
- $set = new Collection;
- for ($i = 0; $i < 5; $i++) {
- $set->push(FactoryMuffin::create('FireflyIII\Models\Budget'));
- }
-
- $this->be($user);
-
- // mock!
- $budgetRepos = $this->mock('FireflyIII\Repositories\Budget\BudgetRepositoryInterface');
- $tagRepos = $this->mock('FireflyIII\Repositories\Tag\TagRepositoryInterface');
-
- // fake!
- $budgetRepos->shouldReceive('getBudgets')->andReturn($set);
- $budgetRepos->shouldReceive('getCurrentRepetition')->andReturn($rep);
- $tagRepos->shouldReceive('coveredByBalancingActs')->andReturn(0);
-
- // test!
- $object = $this->object->getBalanceReport(Carbon::now()->startOfMonth(), Carbon::now()->endOfMonth(), false);
- $this->assertCount(8, $object->getBalanceLines());
- $this->assertCount(5, $object->getBalanceHeader()->getAccounts());
- }
-
- /**
- * @covers FireflyIII\Helpers\Report\ReportHelper::getBillReport
- * @SuppressWarnings(PHPMD.ExcessiveMethodLength)
- */
- public function testGetBillReport()
- {
- $user = FactoryMuffin::create('FireflyIII\User');
- $this->be($user);
-
- // factory!
- $set = new Collection;
- $journals = new Collection;
- FactoryMuffin::create('FireflyIII\Models\Account');
- FactoryMuffin::create('FireflyIII\Models\Account');
- for ($i = 0; $i < 5; $i++) {
- $set->push(FactoryMuffin::create('FireflyIII\Models\Bill'));
- }
-
- for ($i = 0; $i < 5; $i++) {
- $journal = FactoryMuffin::create('FireflyIII\Models\TransactionJournal');
- $journals->push($journal);
- }
-
-
- // mock!
- $repository = $this->mock('FireflyIII\Repositories\Bill\BillRepositoryInterface');
-
- // fake!
- $repository->shouldReceive('getBills')->andReturn($set);
- $repository->shouldReceive('getJournalsInRange')->withAnyArgs()->andReturn(new Collection, $journals);
-
- // test!
- $object = $this->object->getBillReport(Carbon::now()->startOfMonth(), Carbon::now()->endOfMonth(), false);
- $this->assertCount(5, $object->getBills());
- }
-
- /**
- * @covers FireflyIII\Helpers\Report\ReportHelper::getBudgetReport
- */
- public function testGetBudgetReport()
- {
- // factory!
- $user = FactoryMuffin::create('FireflyIII\User');
- $set = new Collection;
- $rep1 = new Collection;
- $rep2 = new Collection;
- for ($i = 0; $i < 5; $i++) {
- $set->push(FactoryMuffin::create('FireflyIII\Models\Budget'));
- }
- for ($i = 0; $i < 5; $i++) {
- $rep1->push(FactoryMuffin::create('FireflyIII\Models\LimitRepetition'));
- }
-
- $this->be($user);
-
- // mock!
- $repository = $this->mock('FireflyIII\Repositories\Budget\BudgetRepositoryInterface');
-
- // fake!
- $repository->shouldReceive('getBudgets')->andReturn($set);
- $repository->shouldReceive('getBudgetLimitRepetitions')->andReturn($rep1, $rep2);
- $repository->shouldReceive('spentInPeriodCorrected')->andReturn(rand(0, 100));
- $repository->shouldReceive('getWithoutBudgetSum')->andReturn(rand(0, 100));
-
- // test!
- $object = $this->object->getBudgetReport(Carbon::now()->startOfMonth(), Carbon::now()->endOfMonth(), false);
-
- $this->assertCount(10, $object->getBudgetLines());
- }
-
- /**
- * @covers FireflyIII\Helpers\Report\ReportHelper::getCategoryReport
- */
- public function testGetCategoryReport()
- {
- // factory!
- $user = FactoryMuffin::create('FireflyIII\User');
- $set = new Collection;
- for ($i = 0; $i < 5; $i++) {
- $set->push(FactoryMuffin::create('FireflyIII\Models\Category'));
- }
-
- $this->be($user);
-
- // mock!
- $repository = $this->mock('FireflyIII\Repositories\Category\CategoryRepositoryInterface');
-
- // fake!
- $repository->shouldReceive('getCategories')->andReturn($set);
- $repository->shouldReceive('spentInPeriodCorrected')->andReturn(rand(1, 100));
-
- // test!
- $object = $this->object->getCategoryReport(Carbon::now()->startOfMonth(), Carbon::now()->endOfMonth(), false);
- $this->assertCount(5, $object->getCategories());
- }
-
-
- /**
- * @covers FireflyIII\Helpers\Report\ReportHelper::getExpenseReport
- * @SuppressWarnings(PHPMD.ExcessiveMethodLength)
- */
- public function testGetExpenseReport()
- {
- // factory!
- $user = FactoryMuffin::create('FireflyIII\User');
- $this->be($user);
- $type = FactoryMuffin::create('FireflyIII\Models\TransactionType');
-
- // create five journals in this month for the report:
- $date = Carbon::now()->startOfMonth()->addDay();
- $asset = FactoryMuffin::create('FireflyIII\Models\AccountType');
- $left = FactoryMuffin::create('FireflyIII\Models\Account');
- $right = FactoryMuffin::create('FireflyIII\Models\Account');
- $left->account_type_id = $asset->id;
- $right->account_type_id = $asset->id;
- $right->save();
- $left->save();
-
- // save meta for account:
- AccountMeta::create(
- [
- 'account_id' => $left->id,
- 'name' => 'accountRole',
- 'data' => 'defaultAsset'
- ]
- );
- AccountMeta::create(
- [
- 'account_id' => $right->id,
- 'name' => 'accountRole',
- 'data' => 'defaultAsset'
- ]
- );
-
-
- for ($i = 0; $i < 5; $i++) {
- $journal = FactoryMuffin::create('FireflyIII\Models\TransactionJournal');
- $journal->date = $date;
- $journal->transaction_type_id = $type->id;
- $journal->user_id = $user->id;
- $journal->save();
- }
-
- // test!
- $object = $this->object->getExpenseReport(Carbon::now()->startOfMonth(), Carbon::now()->endOfMonth(), true);
- $this->assertCount(5, $object->getExpenses());
- }
-
- /**
- * @covers FireflyIII\Helpers\Report\ReportHelper::getIncomeReport
- * @SuppressWarnings(PHPMD.ExcessiveMethodLength)
- */
- public function testGetIncomeReport()
- {
- // factory!
- $user = FactoryMuffin::create('FireflyIII\User');
- $this->be($user);
- FactoryMuffin::create('FireflyIII\Models\TransactionType');
- $type = FactoryMuffin::create('FireflyIII\Models\TransactionType');
-
- // create five journals in this month for the report:
- $date = Carbon::now()->startOfMonth()->addDay();
- $left = FactoryMuffin::create('FireflyIII\Models\Account');
- $right = FactoryMuffin::create('FireflyIII\Models\Account');
- $asset = FactoryMuffin::create('FireflyIII\Models\AccountType');
- $left->account_type_id = $asset->id;
- $right->account_type_id = $asset->id;
-
- // save meta for account:
- AccountMeta::create(
- [
- 'account_id' => $left->id,
- 'name' => 'accountRole',
- 'data' => 'defaultAsset'
- ]
- );
- AccountMeta::create(
- [
- 'account_id' => $right->id,
- 'name' => 'accountRole',
- 'data' => 'defaultAsset'
- ]
- );
-
- $right->save();
- $left->save();
- for ($i = 0; $i < 5; $i++) {
- $journal = FactoryMuffin::create('FireflyIII\Models\TransactionJournal');
- $journal->date = $date;
- $journal->transaction_type_id = $type->id;
- $journal->user_id = $user->id;
- $journal->save();
- }
-
- // test!
- $object = $this->object->getIncomeReport(Carbon::now()->startOfMonth(), Carbon::now()->endOfMonth(), true);
- $this->assertCount(5, $object->getIncomes());
-
- }
-
- /**
- * @covers FireflyIII\Helpers\Report\ReportHelper::listOfMonths
- */
- public function testListOfMonths()
- {
- // start of year up until now
- $date = new Carbon('2015-01-01');
- $now = new Carbon;
- $diff = $now->diffInMonths($date) + 1; // the month itself.
- $result = $this->object->listOfMonths($date);
-
- $this->assertCount($diff, $result[2015]);
-
- }
-
-}
diff --git a/tests/helpers/ReportQueryTest.php b/tests/helpers/ReportQueryTest.php
deleted file mode 100644
index a7451c5319..0000000000
--- a/tests/helpers/ReportQueryTest.php
+++ /dev/null
@@ -1,397 +0,0 @@
-object = new ReportQuery;
- }
-
- /**
- * Tears down the fixture, for example, closes a network connection.
- * This method is called after a test is executed.
- */
- public function tearDown()
- {
- parent::tearDown();
- }
-
-
- /**
- * @covers FireflyIII\Helpers\Report\ReportQuery::expenseInPeriodCorrected
- * @covers FireflyIII\Helpers\Report\ReportQuery::queryJournalsWithTransactions
- * @SuppressWarnings(PHPMD.ExcessiveMethodLength)
- */
- public function testExpenseInPeriodCorrected()
- {
- $start = new Carbon('2015-01-01');
- $end = new Carbon('2015-02-01');
-
- $user = FactoryMuffin::create('FireflyIII\User');
- $type = FactoryMuffin::create('FireflyIII\Models\TransactionType');
-
- $expense = FactoryMuffin::create('FireflyIII\Models\AccountType');
- $asset = FactoryMuffin::create('FireflyIII\Models\AccountType');
-
- $date = new Carbon('2015-01-12');
-
- for ($i = 0; $i < 10; $i++) {
- $journal = FactoryMuffin::create('FireflyIII\Models\TransactionJournal');
- $journal->date = $date;
- $journal->user_id = $user->id;
- $journal->transaction_type_id = $type->id;
- $journal->save();
-
- // two transactions:
- $account1 = FactoryMuffin::create('FireflyIII\Models\Account');
- $account2 = FactoryMuffin::create('FireflyIII\Models\Account');
- $account1->account_type_id = $asset->id;
- $account1->user_id = $user->id;
- $account2->account_type_id = $expense->id;
- $account2->user_id = $user->id;
- $account1->save();
- $account2->save();
-
- AccountMeta::create(
- [
- 'account_id' => $account1->id,
- 'name' => 'accountRole',
- 'data' => 'defaultAsset'
- ]
- );
-
- $amount = 100;
- if ($i == 8) {
- $amount = 0; // at least one "empty" journal.
- }
-
- // update both transactions
- $journal->transactions[0]->account_id = $account1->id;
- $journal->transactions[0]->amount = $amount * -1;
- $journal->transactions[0]->save();
-
- $journal->transactions[1]->account_id = $account2->id;
- $journal->transactions[1]->amount = $amount;
- $journal->transactions[1]->save();
-
-
- }
- $this->be($user);
-
-
- $set = $this->object->expenseInPeriodCorrected($start, $end, false);
-
-
- $this->assertCount(9, $set);
- }
-
- /**
- * @covers FireflyIII\Helpers\Report\ReportQuery::expenseInPeriodCorrected
- * @covers FireflyIII\Helpers\Report\ReportQuery::queryJournalsWithTransactions
- * @SuppressWarnings(PHPMD.ExcessiveMethodLength)
- */
- public function testExpenseInPeriodCorrectedShared()
- {
- $start = new Carbon('2015-01-01');
- $end = new Carbon('2015-02-01');
-
- $user = FactoryMuffin::create('FireflyIII\User');
- $type = FactoryMuffin::create('FireflyIII\Models\TransactionType');
-
- $expense = FactoryMuffin::create('FireflyIII\Models\AccountType');
- $asset = FactoryMuffin::create('FireflyIII\Models\AccountType');
-
- $date = new Carbon('2015-01-12');
-
- for ($i = 0; $i < 10; $i++) {
- $journal = FactoryMuffin::create('FireflyIII\Models\TransactionJournal');
- $journal->date = $date;
- $journal->user_id = $user->id;
- $journal->transaction_type_id = $type->id;
- $journal->save();
-
- // two transactions:
- $account1 = FactoryMuffin::create('FireflyIII\Models\Account');
- $account2 = FactoryMuffin::create('FireflyIII\Models\Account');
- $account1->account_type_id = $asset->id;
- $account1->user_id = $user->id;
- $account2->account_type_id = $expense->id;
- $account2->user_id = $user->id;
- $account1->save();
- $account2->save();
-
- AccountMeta::create(
- [
- 'account_id' => $account1->id,
- 'name' => 'accountRole',
- 'data' => 'defaultAsset'
- ]
- );
-
- $amount = 100;
- if ($i == 8) {
- $amount = 0; // at least one "empty" journal.
- }
-
- // update both transactions
- $journal->transactions[0]->account_id = $account1->id;
- $journal->transactions[0]->amount = $amount * -1;
- $journal->transactions[0]->save();
-
- $journal->transactions[1]->account_id = $account2->id;
- $journal->transactions[1]->amount = $amount;
- $journal->transactions[1]->save();
-
- }
- $this->be($user);
-
- $set = $this->object->expenseInPeriodCorrected($start, $end, true);
-
- $this->assertCount(9, $set);
- }
-
- /**
- * @covers FireflyIII\Helpers\Report\ReportQuery::getAllAccounts
- */
- public function testGetAllAccounts()
- {
- $start = new Carbon('2015-01-01');
- $end = new Carbon('2015-02-01');
- $user = FactoryMuffin::create('FireflyIII\User');
- FactoryMuffin::create('FireflyIII\Models\Account');
- FactoryMuffin::create('FireflyIII\Models\Account');
- $asset = FactoryMuffin::create('FireflyIII\Models\Account');
-
- for ($i = 0; $i < 10; $i++) {
- $account = FactoryMuffin::create('FireflyIII\Models\Account');
- $account->account_type_id = $asset->id;
- $account->user_id = $user->id;
- $account->save();
- }
-
- Steam::shouldReceive('balance')->andReturn(0);
-
- $this->be($user);
-
- $set = $this->object->getAllAccounts($start, $end, false);
- $this->assertCount(10, $set);
- }
-
- /**
- * @covers FireflyIII\Helpers\Report\ReportQuery::getAllAccounts
- */
- public function testGetAllAccountsShared()
- {
- $start = new Carbon('2015-01-01');
- $end = new Carbon('2015-02-01');
- $user = FactoryMuffin::create('FireflyIII\User');
- FactoryMuffin::create('FireflyIII\Models\Account');
- FactoryMuffin::create('FireflyIII\Models\Account');
- $asset = FactoryMuffin::create('FireflyIII\Models\Account');
-
- for ($i = 0; $i < 10; $i++) {
- $account = FactoryMuffin::create('FireflyIII\Models\Account');
- $account->account_type_id = $asset->id;
- $account->user_id = $user->id;
- $account->save();
- }
-
- Steam::shouldReceive('balance')->andReturn(0);
-
- $this->be($user);
-
- $set = $this->object->getAllAccounts($start, $end, true);
- $this->assertCount(10, $set);
- }
-
- /**
- * @covers FireflyIII\Helpers\Report\ReportQuery::incomeInPeriodCorrected
- * @covers FireflyIII\Helpers\Report\ReportQuery::queryJournalsWithTransactions
- * @SuppressWarnings(PHPMD.ExcessiveMethodLength)
- */
- public function testIncomeInPeriodCorrected()
- {
- $start = new Carbon('2015-01-01');
- $end = new Carbon('2015-02-01');
-
- $user = FactoryMuffin::create('FireflyIII\User');
- FactoryMuffin::create('FireflyIII\Models\TransactionType');
- $type = FactoryMuffin::create('FireflyIII\Models\TransactionType');
-
- $expense = FactoryMuffin::create('FireflyIII\Models\AccountType');
- $asset = FactoryMuffin::create('FireflyIII\Models\AccountType');
-
- $date = new Carbon('2015-01-12');
-
- for ($i = 0; $i < 10; $i++) {
- $journal = FactoryMuffin::create('FireflyIII\Models\TransactionJournal');
- $journal->date = $date;
- $journal->user_id = $user->id;
- $journal->transaction_type_id = $type->id;
- $journal->save();
-
- // two transactions:
- $account1 = FactoryMuffin::create('FireflyIII\Models\Account');
- $account2 = FactoryMuffin::create('FireflyIII\Models\Account');
- $account1->account_type_id = $asset->id;
- $account1->user_id = $user->id;
- $account2->account_type_id = $expense->id;
- $account2->user_id = $user->id;
- $account1->save();
- $account2->save();
-
- AccountMeta::create(
- [
- 'account_id' => $account1->id,
- 'name' => 'accountRole',
- 'data' => 'defaultAsset'
- ]
- );
-
- $amount = 100;
- if ($i == 8) {
- $amount = 0; // at least one "empty" journal.
- }
-
- // update both transactions
- $journal->transactions[0]->account_id = $account1->id;
- $journal->transactions[0]->amount = $amount;
- $journal->transactions[0]->save();
-
- $journal->transactions[1]->account_id = $account2->id;
- $journal->transactions[1]->amount = $amount * -1;
- $journal->transactions[1]->save();
-
- }
- $this->be($user);
-
- $set = $this->object->incomeInPeriodCorrected($start, $end, false);
-
- $this->assertCount(9, $set);
- }
-
- /**
- * @covers FireflyIII\Helpers\Report\ReportQuery::incomeInPeriodCorrected
- * @covers FireflyIII\Helpers\Report\ReportQuery::queryJournalsWithTransactions
- * @SuppressWarnings(PHPMD.ExcessiveMethodLength)
- */
- public function testIncomeInPeriodCorrectedShared()
- {
- $start = new Carbon('2015-01-01');
- $end = new Carbon('2015-02-01');
-
- $user = FactoryMuffin::create('FireflyIII\User');
- FactoryMuffin::create('FireflyIII\Models\TransactionType');
- $type = FactoryMuffin::create('FireflyIII\Models\TransactionType');
-
- $expense = FactoryMuffin::create('FireflyIII\Models\AccountType');
- $asset = FactoryMuffin::create('FireflyIII\Models\AccountType');
-
- $date = new Carbon('2015-01-12');
-
- for ($i = 0; $i < 10; $i++) {
- $journal = FactoryMuffin::create('FireflyIII\Models\TransactionJournal');
- $journal->date = $date;
- $journal->user_id = $user->id;
- $journal->transaction_type_id = $type->id;
- $journal->save();
-
- // two transactions:
- $account1 = FactoryMuffin::create('FireflyIII\Models\Account');
- $account2 = FactoryMuffin::create('FireflyIII\Models\Account');
- $account1->account_type_id = $asset->id;
- $account1->user_id = $user->id;
- $account2->account_type_id = $expense->id;
- $account2->user_id = $user->id;
- $account1->save();
- $account2->save();
-
- AccountMeta::create(
- [
- 'account_id' => $account1->id,
- 'name' => 'accountRole',
- 'data' => 'defaultAsset'
- ]
- );
-
- $amount = 100;
- if ($i == 8) {
- $amount = 0; // at least one "empty" journal.
- }
-
- // update both transactions
- $journal->transactions[0]->account_id = $account1->id;
- $journal->transactions[0]->amount = $amount * -1;
- $journal->transactions[0]->save();
-
- $journal->transactions[1]->account_id = $account2->id;
- $journal->transactions[1]->amount = $amount;
- $journal->transactions[1]->save();
-
- }
- $this->be($user);
-
- $set = $this->object->incomeInPeriodCorrected($start, $end, true);
-
- $this->assertCount(9, $set);
- }
-
- /**
- * @covers FireflyIII\Helpers\Report\ReportQuery::spentInBudgetCorrected
- */
- public function testSpentInBudgetCorrected()
- {
- $user = FactoryMuffin::create('FireflyIII\User');
- $account = FactoryMuffin::create('FireflyIII\Models\Account');
- $account->user_id = $user->id;
- $budget = FactoryMuffin::create('FireflyIII\Models\Budget');
- $budget->user_id = $user->id;
-
- $account->save();
- $budget->save();
-
- $this->be($user);
-
- $result = $this->object->spentInBudgetCorrected($account, $budget, new Carbon, new Carbon);
- $this->assertEquals(0, $result);
-
- }
-
- /**
- * @covers FireflyIII\Helpers\Report\ReportQuery::spentNoBudget
- */
- public function testSpentNoBudget()
- {
-
- $user = FactoryMuffin::create('FireflyIII\User');
- $account = FactoryMuffin::create('FireflyIII\Models\Account');
- $account->user_id = $user->id;
-
- $account->save();
-
- $this->be($user);
-
- $result = $this->object->spentNoBudget($account, new Carbon, new Carbon);
- $this->assertEquals(0, $result);
- }
-
-}
diff --git a/tests/models/AccountModelTest.php b/tests/models/AccountModelTest.php
deleted file mode 100644
index 662a2a73a2..0000000000
--- a/tests/models/AccountModelTest.php
+++ /dev/null
@@ -1,162 +0,0 @@
- $account->name,
- 'account_type_id' => $account->account_type_id,
- 'user_id' => $account->user_id
- ];
-
- $result = Account::firstOrCreateEncrypted($search);
-
- // should be the same account:
-
- $this->assertEquals($account->id, $result->id);
-
- }
-
- /**
- * @covers FireflyIII\Models\Account::firstOrCreateEncrypted
- */
- public function testFirstOrCreateEncryptedNew()
- {
- // create account:
- $account = FactoryMuffin::create('FireflyIII\Models\Account');
- FactoryMuffin::create('FireflyIII\User');
-
- // search for account with the same properties:
- $search = [
- 'name' => 'Some new account',
- 'account_type_id' => $account->account_type_id,
- 'user_id' => $account->user_id,
- 'active' => 1,
- ];
-
- $result = Account::firstOrCreateEncrypted($search);
-
- // should not be the same account:
-
- $this->assertNotEquals($account->id, $result->id);
-
-
- }
-
- /**
- * @covers FireflyIII\Models\Account::firstOrNullEncrypted
- */
- public function testFirstOrNullEncrypted()
- {
- // create account:
- $account = FactoryMuffin::create('FireflyIII\Models\Account');
-
-
- // search for account with the same properties:
- $search = [
- 'name' => $account->name,
- 'account_type_id' => $account->account_type_id,
- 'user_id' => $account->user_id
- ];
-
- $result = Account::firstOrNullEncrypted($search);
-
- // should be the same account:
-
- $this->assertEquals($account->id, $result->id);
- }
-
- /**
- * @covers FireflyIII\Models\Account::firstOrNullEncrypted
- */
- public function testFirstOrNullEncryptedNew()
- {
- // create account:
- $account = FactoryMuffin::create('FireflyIII\Models\Account');
- FactoryMuffin::create('FireflyIII\User');
-
- // search for account with the same properties:
- $search = [
- 'name' => 'Some new account',
- 'account_type_id' => $account->account_type_id,
- 'user_id' => $account->user_id,
- 'active' => 1,
- ];
-
- $result = Account::firstOrNullEncrypted($search);
-
- // should not be the same account:
-
- $this->assertNull($result);
-
-
- }
-
- /**
- * @covers FireflyIII\Models\Account::getNameForEditformAttribute
- */
- public function testGetNameForEditformAttribute()
- {
- // normal name is normal
- $account = FactoryMuffin::create('FireflyIII\Models\Account');
- $this->assertEquals($account->name, $account->getNameForEditformAttribute());
- }
- /**
- * @covers FireflyIII\Models\Account::getNameForEditformAttribute
- */
- public function testGetNameForEditformAttributeCash()
- {
- FactoryMuffin::create('FireflyIII\Models\AccountType');
- FactoryMuffin::create('FireflyIII\Models\AccountType');
- FactoryMuffin::create('FireflyIII\Models\AccountType');
- // cash name is empty
- $account = FactoryMuffin::create('FireflyIII\Models\Account');
- $this->assertEquals('', $account->getNameForEditformAttribute());
- }
-
-}
diff --git a/tests/models/CategoryModelTest.php b/tests/models/CategoryModelTest.php
deleted file mode 100644
index c4abe4cfb5..0000000000
--- a/tests/models/CategoryModelTest.php
+++ /dev/null
@@ -1,76 +0,0 @@
- $category->name,
- 'user_id' => $category->user_id
- ];
-
- $result = Category::firstOrCreateEncrypted($search);
-
- $this->assertEquals($result->id, $category->id);
- }
-
- /**
- * @covers FireflyIII\Models\Category::firstOrCreateEncrypted
- */
- public function testFirstOrCreateEncryptedNew()
- {
- $category = FactoryMuffin::create('FireflyIII\Models\Category');
-
- $search = [
- 'name' => 'Some category name',
- 'user_id' => $category->user_id
- ];
-
- $result = Category::firstOrCreateEncrypted($search);
-
- $this->assertNotEquals($result->id, $category->id);
- }
-
-}
diff --git a/tests/models/TagModelTest.php b/tests/models/TagModelTest.php
deleted file mode 100644
index b4411d1eb1..0000000000
--- a/tests/models/TagModelTest.php
+++ /dev/null
@@ -1,95 +0,0 @@
- 'something',
- 'tag' => $tag->tag,
- 'user_id' => $tag->user_id,
- ];
-
- $result = Tag::firstOrCreateEncrypted($search);
-
- $this->assertEquals($tag->id, $result->id);
- }
-
- /**
- * @covers FireflyIII\Models\Tag::firstOrCreateEncrypted
- */
- public function testFirstOrCreateEncryptedNew()
- {
- $tag = FactoryMuffin::create('FireflyIII\Models\Tag');
-
- $search = [
- 'tagMode' => 'something',
- 'tag' => 'Something else',
- 'user_id' => $tag->user_id,
- ];
-
- $result = Tag::firstOrCreateEncrypted($search);
-
- $this->assertNotEquals($tag->id, $result->id);
- }
-
- /**
- * @covers FireflyIII\Models\Tag::save
- */
- public function testSave()
- {
- $tag = FactoryMuffin::create('FireflyIII\Models\Tag');
- // connect some transaction journals to the tag:
- $journal = FactoryMuffin::create('FireflyIII\Models\TransactionJournal');
- $journal->tags()->save($tag);
- $tag->save();
- $journal = TransactionJournal::find($journal->id);
-
- $this->assertEquals(1, $journal->tag_count);
-
-
- }
-
-}
diff --git a/tests/models/TransactionJournalModelTest.php b/tests/models/TransactionJournalModelTest.php
deleted file mode 100644
index 17d8646557..0000000000
--- a/tests/models/TransactionJournalModelTest.php
+++ /dev/null
@@ -1,636 +0,0 @@
-transactions[0]->amount = '123.45';
- $journal->transactions[0]->save();
- $journal->transactions[1]->amount = '-123.45';
- $journal->transactions[1]->save();
-
- $amount = $journal->actual_amount;
- $this->assertEquals('123.45', $amount);
- }
-
- /**
- * Journal has one tag.
- *
- * @covers FireflyIII\Models\TransactionJournal::getAmountAttribute
- * @covers FireflyIII\Models\TransactionJournal::amountByTag
- * @covers FireflyIII\Models\TransactionJournal::save
- * @covers FireflyIII\Models\TransactionJournal::amountByTags
- * @SuppressWarnings(PHPMD.ExcessiveMethodLength)
- */
- public function testGetAmountAttributeAdvancePayment()
- {
- $user = FactoryMuffin::create('FireflyIII\User');
- $this->be($user);
- // make types:
- $withdrawalType = FactoryMuffin::create('FireflyIII\Models\TransactionType');
- $depositType = FactoryMuffin::create('FireflyIII\Models\TransactionType');
-
- // make tag
- $tag = FactoryMuffin::create('FireflyIII\Models\Tag');
- $tag->tagMode = 'advancePayment';
- $tag->save();
-
- // make withdrawal
- $withdrawal = FactoryMuffin::create('FireflyIII\Models\TransactionJournal');
- $withdrawal->transaction_type_id = $withdrawalType->id;
- $withdrawal->save();
-
- // make deposit
- $deposit = FactoryMuffin::create('FireflyIII\Models\TransactionJournal');
- $deposit->transaction_type_id = $depositType->id;
- $deposit->save();
-
- // make accounts
- $expense = FactoryMuffin::create('FireflyIII\Models\Account');
- $revenue = FactoryMuffin::create('FireflyIII\Models\Account');
- $asset = FactoryMuffin::create('FireflyIII\Models\Account');
-
- // transactions are already in place, update them:
- $withdrawal->transactions[0]->account_id = $asset->id;
- $withdrawal->transactions[0]->amount = -300;
- $withdrawal->transactions[0]->save();
-
- $withdrawal->transactions[1]->account_id = $expense->id;
- $withdrawal->transactions[1]->amount = 300;
- $withdrawal->transactions[1]->save();
-
- $deposit->transactions[0]->account_id = $revenue->id;
- $deposit->transactions[0]->amount = -89.88;
- $deposit->transactions[0]->save();
-
- $deposit->transactions[1]->account_id = $asset->id;
- $deposit->transactions[1]->amount = 89.88;
- $deposit->transactions[1]->save();
-
- // connect to tag:
- $tag->transactionJournals()->save($withdrawal);
- $tag->transactionJournals()->save($deposit);
-
- $withdrawal->save();
- $deposit->save();
- $withdrawal = TransactionJournal::find($withdrawal->id);
- $deposit = TransactionJournal::find($deposit->id);
-
- // amount should be 210.12:
- $this->assertEquals('210.12', $withdrawal->amount);
- $this->assertEquals('0', $deposit->amount);
-
-
- }
-
-
- /**
- * Journal has one tag.
- *
- * @covers FireflyIII\Models\TransactionJournal::getAmountAttribute
- * @covers FireflyIII\Models\TransactionJournal::amountByTag
- * @covers FireflyIII\Models\TransactionJournal::amountByTags
- * @SuppressWarnings(PHPMD.ExcessiveMethodLength)
- */
- public function testGetAmountAttributeBalancingAct()
- {
- $user = FactoryMuffin::create('FireflyIII\User');
- $this->be($user);
-
- // make types:
- $withdrawalType = FactoryMuffin::create('FireflyIII\Models\TransactionType');
- FactoryMuffin::create('FireflyIII\Models\TransactionType');
- $transferType = FactoryMuffin::create('FireflyIII\Models\TransactionType');
-
- // make a tag
- $tag = FactoryMuffin::create('FireflyIII\Models\Tag');
- $tag->tagMode = 'balancingAct';
- $tag->save();
-
- // make a withdrawal and a transfer
- $withdrawal = FactoryMuffin::create('FireflyIII\Models\TransactionJournal');
- $withdrawal->transaction_type_id = $withdrawalType->id;
- $withdrawal->save();
-
- $transfer = FactoryMuffin::create('FireflyIII\Models\TransactionJournal');
- $transfer->transaction_type_id = $transferType->id;
- $transfer->save();
-
- // connect to tag:
- $tag->transactionJournals()->save($withdrawal);
- $tag->transactionJournals()->save($transfer);
-
- // make accounts:
- $expense = FactoryMuffin::create('FireflyIII\Models\Account');
- $revenue = FactoryMuffin::create('FireflyIII\Models\Account');
- $asset = FactoryMuffin::create('FireflyIII\Models\Account');
- $revenue->account_type_id = $asset->account_type_id;
- $revenue->save();
-
- // transactions are already in place, update them:
- $withdrawal->transactions[0]->account_id = $asset->id;
- $withdrawal->transactions[0]->amount = -123.45;
- $withdrawal->transactions[0]->save();
-
- $withdrawal->transactions[1]->account_id = $expense->id;
- $withdrawal->transactions[1]->amount = 123.45;
- $withdrawal->transactions[1]->save();
-
- $transfer->transactions[0]->account_id = $revenue->id;
- $transfer->transactions[0]->amount = -123.45;
- $transfer->transactions[0]->save();
-
- $transfer->transactions[1]->account_id = $asset->id;
- $transfer->transactions[1]->amount = 123.45;
- $transfer->transactions[1]->save();
-
- $withdrawal->save();
-
- $withdrawal = TransactionJournal::find($withdrawal->id);
-
- $amount = $withdrawal->amount;
-
-
- $this->assertEquals('0', $amount);
- }
-
- /**
- * Journal has no tags.
- *
- * @covers FireflyIII\Models\TransactionJournal::getAmountAttribute
- * @covers FireflyIII\Models\TransactionJournal::amountByTag
- * @covers FireflyIII\Models\TransactionJournal::amountByTags
- */
- public function testGetAmountAttributeNoTags()
- {
- $user = FactoryMuffin::create('FireflyIII\User');
- $this->be($user);
- $journal = FactoryMuffin::create('FireflyIII\Models\TransactionJournal');
-
- $journal->transactions[0]->amount = 123.45;
- $journal->transactions[0]->save();
-
- $journal->transactions[1]->amount = -123.45;
- $journal->transactions[1]->save();
-
- $amount = $journal->amount;
- $this->assertEquals('123.45', $amount);
- }
-
- /**
- *
- * Journal has one tag.
- *
- * @covers FireflyIII\Models\TransactionJournal::getAmountAttribute
- * @covers FireflyIII\Models\TransactionJournal::amountByTag
- * @covers FireflyIII\Models\TransactionJournal::amountByTags
- */
- public function testGetAmountAttributeTag()
- {
- $user = FactoryMuffin::create('FireflyIII\User');
- $this->be($user);
-
- // has a normal tag, but nothing special.
- // make tag
- $tag = FactoryMuffin::create('FireflyIII\Models\Tag');
- $tag->tagMode = 'nothing';
- $tag->save();
-
- // make withdrawal
- $withdrawalType = FactoryMuffin::create('FireflyIII\Models\TransactionType');
- $withdrawal = FactoryMuffin::create('FireflyIII\Models\TransactionJournal');
- $withdrawal->transaction_type_id = $withdrawalType->id;
- $withdrawal->save();
-
- // make accounts
- $expense = FactoryMuffin::create('FireflyIII\Models\Account');
- $asset = FactoryMuffin::create('FireflyIII\Models\Account');
-
- $withdrawal->transactions[0]->amount = -300;
- $withdrawal->transactions[0]->account_id = $asset->id;
- $withdrawal->transactions[0]->save();
-
- $withdrawal->transactions[1]->amount = 300;
- $withdrawal->transactions[1]->account_id = $expense->id;
- $withdrawal->transactions[1]->save();
-
- // connect to tag:
- $tag->transactionJournals()->save($withdrawal);
-
- $withdrawal->save();
- $withdrawal = TransactionJournal::find($withdrawal->id);
-
- $this->assertEquals('300', $withdrawal->amount);
-
-
- }
-
- /**
- * Journal has multiple tags, withdrawal. All default tag.
- *
- * @covers FireflyIII\Models\TransactionJournal::getAmountAttribute
- * @covers FireflyIII\Models\TransactionJournal::amountByTag
- * @covers FireflyIII\Models\TransactionJournal::amountByTags
- */
- public function testGetAmountAttributeTags()
- {
- $user = FactoryMuffin::create('FireflyIII\User');
- $this->be($user);
-
- // has two normal tags:
- $tag = FactoryMuffin::create('FireflyIII\Models\Tag');
- $tag->tagMode = 'nothing';
- $tag->save();
- $tag2 = FactoryMuffin::create('FireflyIII\Models\Tag');
- $tag2->tagMode = 'nothing';
- $tag2->save();
-
- // make withdrawal
- $withdrawalType = FactoryMuffin::create('FireflyIII\Models\TransactionType');
- $withdrawal = FactoryMuffin::create('FireflyIII\Models\TransactionJournal');
- $withdrawal->transaction_type_id = $withdrawalType->id;
- $withdrawal->save();
-
- // make accounts
- $expense = FactoryMuffin::create('FireflyIII\Models\Account');
- $asset = FactoryMuffin::create('FireflyIII\Models\Account');
-
- $withdrawal->transactions[0]->amount = -300;
- $withdrawal->transactions[0]->account_id = $asset->id;
- $withdrawal->transactions[0]->save();
-
- $withdrawal->transactions[1]->amount = 300;
- $withdrawal->transactions[1]->account_id = $expense->id;
- $withdrawal->transactions[1]->save();
-
- // connect to tag:
- $tag->transactionJournals()->save($withdrawal);
- $tag2->transactionJournals()->save($withdrawal);
-
- // grab withdrawal again to update tag count:
- $withdrawal->save();
- $withdrawal = TransactionJournal::find($withdrawal->id);
-
- $this->assertEquals('300', $withdrawal->amount);
-
-
- }
-
- /**
- * Multiple tags, transfer, and one is a balancing act
- *
- * @covers FireflyIII\Models\TransactionJournal::getAmountAttribute
- * @covers FireflyIII\Models\TransactionJournal::amountByTag
- * @covers FireflyIII\Models\TransactionJournal::amountByTags
- */
- public function testGetAmountAttributeTagsTransfer()
- {
- $user = FactoryMuffin::create('FireflyIII\User');
- $this->be($user);
-
- // has two normal tags:
- $tag = FactoryMuffin::create('FireflyIII\Models\Tag');
- $tag->tagMode = 'balancingAct';
- $tag->save();
- $tag2 = FactoryMuffin::create('FireflyIII\Models\Tag');
- $tag2->tagMode = 'nothing';
- $tag2->save();
-
- // make withdrawal
- FactoryMuffin::create('FireflyIII\Models\TransactionType');
- FactoryMuffin::create('FireflyIII\Models\TransactionType');
- $transferType = FactoryMuffin::create('FireflyIII\Models\TransactionType');
- $transfer = FactoryMuffin::create('FireflyIII\Models\TransactionJournal');
- $transfer->transaction_type_id = $transferType->id;
- $transfer->save();
-
- // make accounts
- $expense = FactoryMuffin::create('FireflyIII\Models\Account');
- $asset = FactoryMuffin::create('FireflyIII\Models\Account');
-
- $transfer->transactions[0]->amount = -300;
- $transfer->transactions[0]->account_id = $asset->id;
- $transfer->transactions[0]->save();
-
- $transfer->transactions[1]->amount = 300;
- $transfer->transactions[1]->account_id = $expense->id;
- $transfer->transactions[1]->save();
-
- // connect to tag:
- $tag->transactionJournals()->save($transfer);
- $tag2->transactionJournals()->save($transfer);
-
- $transfer->save();
- $transfer = TransactionJournal::find($transfer->id);
-
- $this->assertEquals('300', $transfer->amount);
-
-
- }
-
- /**
- * Multiple tags, transfer, and one is a advance payment.
- *
- * @covers FireflyIII\Models\TransactionJournal::getAmountAttribute
- * @covers FireflyIII\Models\TransactionJournal::amountByTag
- * @covers FireflyIII\Models\TransactionJournal::amountByTags
- */
- public function testGetAmountAttributeTagsTransferAdvance()
- {
- $user = FactoryMuffin::create('FireflyIII\User');
- $this->be($user);
-
- // has two normal tags:
- $tag = FactoryMuffin::create('FireflyIII\Models\Tag');
- $tag->tagMode = 'advancePayment';
- $tag->save();
- $tag2 = FactoryMuffin::create('FireflyIII\Models\Tag');
- $tag2->tagMode = 'nothing';
- $tag2->save();
-
- // make withdrawal
- FactoryMuffin::create('FireflyIII\Models\TransactionType');
- FactoryMuffin::create('FireflyIII\Models\TransactionType');
- $transferType = FactoryMuffin::create('FireflyIII\Models\TransactionType');
- $transfer = FactoryMuffin::create('FireflyIII\Models\TransactionJournal');
- $transfer->transaction_type_id = $transferType->id;
- $transfer->save();
-
- // make accounts
- $expense = FactoryMuffin::create('FireflyIII\Models\Account');
- $asset = FactoryMuffin::create('FireflyIII\Models\Account');
-
- $transfer->transactions[0]->amount = -300;
- $transfer->transactions[0]->account_id = $asset->id;
- $transfer->transactions[0]->save();
-
- $transfer->transactions[1]->amount = 300;
- $transfer->transactions[1]->account_id = $expense->id;
- $transfer->transactions[1]->save();
-
- // connect to tag:
- $tag->transactionJournals()->save($transfer);
- $tag2->transactionJournals()->save($transfer);
-
- $transfer->save();
- $transfer = TransactionJournal::find($transfer->id);
-
- $this->assertEquals('300', $transfer->amount);
-
-
- }
-
- /**
- * Multiple tags, withdrawal, and one is a balancingAct.
- *
- * @covers FireflyIII\Models\TransactionJournal::getAmountAttribute
- * @covers FireflyIII\Models\TransactionJournal::amountByTag
- * @covers FireflyIII\Models\TransactionJournal::amountByTags
- */
- public function testGetAmountAttributeTagsWithdrawalAdvance()
- {
- $user = FactoryMuffin::create('FireflyIII\User');
- $this->be($user);
-
- // has two normal tags:
- $tag = FactoryMuffin::create('FireflyIII\Models\Tag');
- $tag->tagMode = 'balancingAct';
- $tag->save();
- $tag2 = FactoryMuffin::create('FireflyIII\Models\Tag');
- $tag2->tagMode = 'nothing';
- $tag2->save();
-
- // make withdrawal
- $withdrawalType = FactoryMuffin::create('FireflyIII\Models\TransactionType');
- $withdrawal = FactoryMuffin::create('FireflyIII\Models\TransactionJournal');
- $withdrawal->transaction_type_id = $withdrawalType->id;
- $withdrawal->save();
-
- // make accounts
- $expense = FactoryMuffin::create('FireflyIII\Models\Account');
- $asset = FactoryMuffin::create('FireflyIII\Models\Account');
-
- $withdrawal->transactions[0]->amount = -300;
- $withdrawal->transactions[0]->account_id = $asset->id;
- $withdrawal->transactions[0]->save();
-
- $withdrawal->transactions[1]->amount = 300;
- $withdrawal->transactions[1]->account_id = $expense->id;
- $withdrawal->transactions[1]->save();
-
- // connect to tag:
- $tag->transactionJournals()->save($withdrawal);
- $tag2->transactionJournals()->save($withdrawal);
-
- $withdrawal->save();
- $withdrawal = TransactionJournal::find($withdrawal->id);
-
- $this->assertEquals('300', $withdrawal->amount);
-
-
- }
-
-
- /**
- * @covers FireflyIII\Models\TransactionJournal::getCorrectAmountAttribute
- */
- public function testGetCorrectAmountAttribute()
- {
- $withdrawal = FactoryMuffin::create('FireflyIII\Models\TransactionType'); // withdrawal
-
- // make accounts
- FactoryMuffin::create('FireflyIII\Models\Account');
- $revenue = FactoryMuffin::create('FireflyIII\Models\Account');
- $asset = FactoryMuffin::create('FireflyIII\Models\Account');
-
- // make withdrawal
- $journal = FactoryMuffin::create('FireflyIII\Models\TransactionJournal');
- $journal->transaction_type_id = $withdrawal->id;
- $journal->save();
-
- $journal->transactions[0]->account_id = $asset->id;
- $journal->transactions[0]->amount = 300;
- $journal->transactions[0]->save();
-
- $journal->transactions[1]->account_id = $revenue->id;
- $journal->transactions[1]->amount = -300;
- $journal->transactions[1]->save();
-
- // get asset account:
- $result = $journal->correct_amount;
-
- $this->assertEquals(-300, $result);
- }
-
- /**
- * @covers FireflyIII\Models\TransactionJournal::getCorrectAmountAttribute
- */
- public function testGetCorrectAmountAttributeDeposit()
- {
- FactoryMuffin::create('FireflyIII\Models\TransactionType'); // withdrawal
- $deposit = FactoryMuffin::create('FireflyIII\Models\TransactionType'); // deposit
-
- // make accounts
- FactoryMuffin::create('FireflyIII\Models\Account');
- $revenue = FactoryMuffin::create('FireflyIII\Models\Account');
- $asset = FactoryMuffin::create('FireflyIII\Models\Account');
-
- // make withdrawal
- $journal = FactoryMuffin::create('FireflyIII\Models\TransactionJournal');
- $journal->transaction_type_id = $deposit->id;
- $journal->save();
-
- $journal->transactions[0]->account_id = $asset->id;
- $journal->transactions[0]->amount = 300;
- $journal->transactions[0]->save();
-
- $journal->transactions[1]->account_id = $revenue->id;
- $journal->transactions[1]->amount = -300;
- $journal->transactions[1]->save();
-
- // get asset account:
- $result = $journal->correct_amount;
-
- $this->assertEquals(300, $result);
- }
-
- /**
- * @covers FireflyIII\Models\TransactionJournal::getCorrectAmountAttribute
- */
- public function testGetCorrectAmountAttributeTransfer()
- {
- FactoryMuffin::create('FireflyIII\Models\TransactionType'); // withdrawal
- FactoryMuffin::create('FireflyIII\Models\TransactionType'); // deposit
- $transfer = FactoryMuffin::create('FireflyIII\Models\TransactionType'); // transfer
-
- // make accounts
- FactoryMuffin::create('FireflyIII\Models\Account');
- $revenue = FactoryMuffin::create('FireflyIII\Models\Account');
- $asset = FactoryMuffin::create('FireflyIII\Models\Account');
-
- // make withdrawal
- $journal = FactoryMuffin::create('FireflyIII\Models\TransactionJournal');
- $journal->transaction_type_id = $transfer->id;
- $journal->save();
-
- $journal->transactions[0]->account_id = $asset->id;
- $journal->transactions[0]->amount = 300;
- $journal->transactions[0]->save();
-
- $journal->transactions[1]->account_id = $revenue->id;
- $journal->transactions[1]->amount = -300;
- $journal->transactions[1]->save();
-
- // get asset account:
- $result = $journal->correct_amount;
-
- $this->assertEquals('300', $result);
- }
-
- /**
- * @covers FireflyIII\Models\TransactionJournal::getDestinationAccountAttribute
- */
- public function testGetDestinationAccountAttribute()
- {
- $user = FactoryMuffin::create('FireflyIII\User');
- $this->be($user);
- FactoryMuffin::create('FireflyIII\Models\TransactionType');
- $depositType = FactoryMuffin::create('FireflyIII\Models\TransactionType');
- $deposit = FactoryMuffin::create('FireflyIII\Models\TransactionJournal');
- $deposit->transaction_type_id = $depositType->id;
- $deposit->save();
-
- // make accounts
- FactoryMuffin::create('FireflyIII\Models\Account');
- $revenue = FactoryMuffin::create('FireflyIII\Models\Account');
- $asset = FactoryMuffin::create('FireflyIII\Models\Account');
-
- $deposit->transactions[0]->account_id = $asset->id;
- $deposit->transactions[0]->amount = 300;
- $deposit->transactions[0]->save();
-
- $deposit->transactions[1]->account_id = $revenue->id;
- $deposit->transactions[1]->amount = -300;
- $deposit->transactions[1]->save();
-
- // get asset account:
- $result = $deposit->destination_account;
-
- $this->assertEquals($asset->id, $result->id);
- }
-
- /**
- * @covers FireflyIII\Models\TransactionJournal::getSourceAccountAttribute
- */
- public function testGetSourceAccountAttribute()
- {
- $user = FactoryMuffin::create('FireflyIII\User');
- $this->be($user);
- FactoryMuffin::create('FireflyIII\Models\TransactionType');
- $depositType = FactoryMuffin::create('FireflyIII\Models\TransactionType');
- $deposit = FactoryMuffin::create('FireflyIII\Models\TransactionJournal');
- $deposit->transaction_type_id = $depositType->id;
- $deposit->save();
-
- // make accounts
- FactoryMuffin::create('FireflyIII\Models\Account');
- $revenue = FactoryMuffin::create('FireflyIII\Models\Account');
- $asset = FactoryMuffin::create('FireflyIII\Models\Account');
-
- $deposit->transactions[0]->account_id = $asset->id;
- $deposit->transactions[0]->amount = 300;
- $deposit->transactions[0]->save();
-
- $deposit->transactions[1]->account_id = $revenue->id;
- $deposit->transactions[1]->amount = -300;
- $deposit->transactions[1]->save();
-
- // get asset account:
- $result = $deposit->source_account;
-
- $this->assertEquals($revenue->id, $result->id);
- }
-
-}
diff --git a/tests/repositories/AccountRepositoryTest.php b/tests/repositories/AccountRepositoryTest.php
deleted file mode 100644
index 6a17b5d564..0000000000
--- a/tests/repositories/AccountRepositoryTest.php
+++ /dev/null
@@ -1,891 +0,0 @@
-object = new AccountRepository;
- parent::setUp();
- }
-
- /**
- * Tears down the fixture, for example, closes a network connection.
- * This method is called after a test is executed.
- */
- public function tearDown()
- {
- parent::tearDown();
- }
-
- /**
- * @covers FireflyIII\Repositories\Account\AccountRepository::countAccounts
- */
- public function testCountAccounts()
- {
- $account = FactoryMuffin::create('FireflyIII\Models\Account');
- $type = $account->accountType->type;
- $this->be($account->user);
-
- $this->assertEquals(1, $this->object->countAccounts([$type]));
- }
-
- /**
- * @covers FireflyIII\Repositories\Account\AccountRepository::destroy
- * @covers FireflyIII\Providers\EventServiceProvider::boot
- * @covers FireflyIII\Providers\EventServiceProvider::registerDeleteEvents
- */
- public function testDestroy()
- {
- // create account:
- $account = FactoryMuffin::create('FireflyIII\Models\Account');
-
- // create some transactions and attach them to the account:
- for ($i = 0; $i < 5; $i++) {
- $transaction = FactoryMuffin::create('FireflyIII\Models\Transaction');
- $transaction->account_id = $account->id;
- $transaction->save();
- }
-
- $accountId = $account->id;
- $this->be($account->user);
-
-
- $this->object->destroy($account);
-
- // cannot find account:
- $this->assertCount(0, Account::whereId($accountId)->whereNotNull('deleted_at')->get());
- }
-
- /**
- * @covers FireflyIII\Repositories\Account\AccountRepository::getAccounts
- */
- public function testGetAccounts()
- {
- $account = FactoryMuffin::create('FireflyIII\Models\Account');
- $type = $account->accountType->type;
- $this->be($account->user);
-
- $this->assertCount(1, $this->object->getAccounts([$type]));
- }
-
- /**
- * @covers FireflyIII\Repositories\Account\AccountRepository::getCreditCards
- */
- public function testGetCreditCards()
- {
- $account = FactoryMuffin::create('FireflyIII\Models\Account');
-
- // create account meta object:
- $meta = new AccountMeta;
- $meta->name = 'accountRole';
- $meta->data = 'ccAsset';
- $meta->account_id = $account->id;
- $meta->save();
-
- // meta account type
- $meta = new AccountMeta;
- $meta->name = 'ccType';
- $meta->data = 'monthlyFull';
- $meta->account_id = $account->id;
- $meta->save();
-
- // login
- $this->be($account->user);
-
- // test!
- $this->assertCount(1, $this->object->getCreditCards());
-
- }
-
- /**
- * @covers FireflyIII\Repositories\Account\AccountRepository::getFirstTransaction
- */
- public function testGetFirstTransaction()
- {
- $account = FactoryMuffin::create('FireflyIII\Models\Account');
- $journal = FactoryMuffin::create('FireflyIII\Models\TransactionJournal');
- $first = $journal->transactions()->orderBy('date', 'DESC')->first();
- $first->account_id = $account->id;
- $first->save();
-
-
- // login
- $this->be($account->user);
-
- $oldest = $this->object->getFirstTransaction($journal, $account);
-
- $this->assertEquals($first->amount, $oldest->amount);
- $this->assertEquals($first->id, $oldest->id);
-
- }
-
- /**
- * @covers FireflyIII\Repositories\Account\AccountRepository::getFrontpageAccounts
- */
- public function testGetFrontpageAccounts()
- {
- FactoryMuffin::create('FireflyIII\Models\AccountType');
- FactoryMuffin::create('FireflyIII\Models\AccountType');
-
-
- // making two account types is kind of cheating but it works.
- $account = FactoryMuffin::create('FireflyIII\Models\Account');
- /** @var Preference $preference */
- $preference = FactoryMuffin::create('FireflyIII\Models\Preference');
- $preference->data = [];
- $preference->save();
- $this->be($account->user);
-
- $set = $this->object->getFrontpageAccounts($preference);
-
- $this->assertEquals($account->id, $set->first()->id);
-
- }
-
- /**
- * @covers FireflyIII\Repositories\Account\AccountRepository::getFrontpageAccounts
- */
- public function testGetFrontpageAccountsWithPreference()
- {
- FactoryMuffin::create('FireflyIII\Models\AccountType');
- FactoryMuffin::create('FireflyIII\Models\AccountType');
-
-
- // making two account types is kind of cheating but it works.
- $account = FactoryMuffin::create('FireflyIII\Models\Account');
- /** @var Preference $preference */
- $preference = FactoryMuffin::create('FireflyIII\Models\Preference');
- $preference->data = [$account->id];
- $preference->save();
- $this->be($account->user);
-
- $set = $this->object->getFrontpageAccounts($preference);
-
- $this->assertEquals($account->id, $set->first()->id);
- }
-
- /**
- * @covers FireflyIII\Repositories\Account\AccountRepository::getFrontpageTransactions
- * @SuppressWarnings(PHPMD.ExcessiveMethodLength)
- */
- public function testGetFrontpageTransactions()
- {
- // three journals
- /** @var Account $account */
- $account = FactoryMuffin::create('FireflyIII\Models\Account');
- $journal1 = FactoryMuffin::create('FireflyIII\Models\TransactionJournal');
- $journal2 = FactoryMuffin::create('FireflyIII\Models\TransactionJournal');
- $journal3 = FactoryMuffin::create('FireflyIII\Models\TransactionJournal');
-
- // three dates (one is out of bounds)
- $journal1->date = new Carbon('2012-01-02');
- $journal1->user_id = $account->user_id;
- $journal2->date = new Carbon('2012-01-09');
- $journal2->user_id = $account->user_id;
- $journal3->date = new Carbon('2012-02-02');
- $journal3->user_id = $account->user_id;
-
- // save all
- $journal1->save();
- $journal2->save();
- $journal3->save();
-
- $journal1->transactions[0]->account_id = $account->id;
- $journal1->transactions[0]->save();
- $journal2->transactions[0]->account_id = $account->id;
- $journal2->transactions[0]->save();
- $journal3->transactions[0]->account_id = $account->id;
- $journal3->transactions[0]->save();
-
- // be user
- $this->be($journal1->user);
-
- // get set:
-
- $set = $this->object->getFrontpageTransactions($account, new Carbon('2012-01-01'), new Carbon('2012-01-31'));
-
- // should have two left.
- $this->assertCount(2, $set);
-
- }
-
- /**
- * @covers FireflyIII\Repositories\Account\AccountRepository::getJournals
- * @SuppressWarnings(PHPMD.ExcessiveMethodLength)
- */
- public function testGetJournals()
- {
- $date = new Carbon;
- // three journals
- /** @var Account $account */
- $account = FactoryMuffin::create('FireflyIII\Models\Account');
- $journal1 = FactoryMuffin::create('FireflyIII\Models\TransactionJournal');
- $journal2 = FactoryMuffin::create('FireflyIII\Models\TransactionJournal');
- $journal3 = FactoryMuffin::create('FireflyIII\Models\TransactionJournal');
-
- // three dates (one is out of bounds)
- $journal1->date = $date;
- $journal1->user_id = $account->user_id;
- $journal2->date = $date;
- $journal2->user_id = $account->user_id;
- $journal3->date = $date;
- $journal3->user_id = $account->user_id;
-
- // save all
- $journal1->save();
- $journal2->save();
- $journal3->save();
-
- $journal1->transactions[0]->account_id = $account->id;
- $journal1->transactions[0]->save();
- $journal2->transactions[0]->account_id = $account->id;
- $journal2->transactions[0]->save();
- $journal3->transactions[0]->account_id = $account->id;
- $journal3->transactions[0]->save();
-
- // be user
- $this->be($journal1->user);
-
- // get paginator:
- /** @var LengthAwarePaginator $paginator */
- $paginator = $this->object->getJournals($account, 1);
-
- // should have three entries:
- $this->assertEquals(3, $paginator->count());
- $this->assertEquals(1, $paginator->currentPage());
- $this->assertFalse($paginator->isEmpty());
-
-
- }
-
- /**
- * @covers FireflyIII\Repositories\Account\AccountRepository::getLastActivity
- */
- public function testGetLastActivity()
- {
- $date = new Carbon('2012-02-02');
- // one journal
- /** @var Account $account */
- $account = FactoryMuffin::create('FireflyIII\Models\Account');
- $journal = FactoryMuffin::create('FireflyIII\Models\TransactionJournal');
- $journal->date = $date;
- $journal->user_id = $account->user_id;
- $journal->save();
-
- $journal->transactions[0]->account_id = $account->id;
- $journal->transactions[0]->save();
-
- // be user
- $this->be($journal->user);
-
- $latest = $this->object->getLastActivity($account);
- $this->assertEquals($date->format('Y-m-d'), $latest->format('Y-m-d'));
-
- }
-
- /**
- * @covers FireflyIII\Repositories\Account\AccountRepository::getLastActivity
- */
- public function testGetLastActivityNoActivity()
- {
- /** @var Account $account */
- $account = FactoryMuffin::create('FireflyIII\Models\Account');
- $this->be($account->user);
-
- $latest = $this->object->getLastActivity($account);
- $this->assertnull($latest);
-
- }
-
- /**
- * @covers FireflyIII\Repositories\Account\AccountRepository::getPiggyBankAccounts
- */
- public function testGetPiggyBankAccounts()
- {
- $date = Carbon::now()->startOfMonth()->addDays(3);
- /*
- * Quite the collection of objects for this one.
- */
- $piggyBank = FactoryMuffin::create('FireflyIII\Models\PiggyBank');
- $account = FactoryMuffin::create('FireflyIII\Models\Account');
- $piggyBankRepetition = $piggyBank->piggybankRepetitions()->first();
- /*
- * Update id's to match each other:
- */
- $piggyBankRepetition->currentamount = rand(1, 100);
- $piggyBankRepetition->startdate = $date;
- $piggyBankRepetition->targetdate = $date;
- $piggyBank->account_id = $account->id;
- $piggyBankRepetition->save();
- $piggyBank->save();
-
- /*
- * Put dates in session:
- */
- $this->session(['start' => Carbon::now()->startOfMonth(), 'end' => Carbon::now()->endOfMonth()]);
-
- /*
- * Run method:
- */
- $this->be($account->user);
- $collection = $this->object->getPiggyBankAccounts();
-
- $this->assertCount(1, $collection);
- $this->assertEquals($collection->first()->id, $account->id);
- $this->assertEquals($collection->first()->piggyBalance, $piggyBankRepetition->currentamount);
- $this->assertEquals(0, $collection->first()->startBalance);
- $this->assertEquals(0, $collection->first()->endBalance);
- }
-
- /**
- * @covers FireflyIII\Repositories\Account\AccountRepository::getSavingsAccounts
- * @SuppressWarnings(PHPMD.ExcessiveMethodLength)
- */
- public function testGetSavingsAccounts()
- {
- // create three accounts:
- FactoryMuffin::create('FireflyIII\Models\AccountType');
- FactoryMuffin::create('FireflyIII\Models\AccountType');
- $type = FactoryMuffin::create('FireflyIII\Models\AccountType');
- $account1 = FactoryMuffin::create('FireflyIII\Models\Account');
- $account1->account_type_id = $type->id;
- $account2 = FactoryMuffin::create('FireflyIII\Models\Account');
- $account2->account_type_id = $type->id;
- $account3 = FactoryMuffin::create('FireflyIII\Models\Account');
- $account3->account_type_id = $type->id;
-
- // make them savings accounts:
- $meta = new AccountMeta;
- $meta->name = 'accountRole';
- $meta->data = 'savingAsset';
- $meta->account_id = $account1->id;
- $meta->save();
-
- $meta = new AccountMeta;
- $meta->name = 'accountRole';
- $meta->data = 'savingAsset';
- $meta->account_id = $account2->id;
- $meta->save();
-
- $meta = new AccountMeta;
- $meta->name = 'accountRole';
- $meta->data = 'savingAsset';
- $meta->account_id = $account3->id;
- $meta->save();
-
- // assign to the same user:
- $account2->user_id = $account1->user_id;
- $account3->user_id = $account1->user_id;
- $account1->save();
- $account2->save();
- $account3->save();
- $this->be($account1->user);
-
- // mock steam balance:
- Steam::shouldReceive('balance')->andReturn(0, 0, 1, 2, 4, 3);
-
- // get the result from the method:
- $result = $this->object->getSavingsAccounts();
-
- $this->assertEquals(0, $result->get(0)->difference);
- $this->assertEquals(1, $result->get(1)->difference);
- $this->assertEquals(-1, $result->get(2)->difference);
-
- $this->assertEquals(100, $result->get(0)->percentage);
- $this->assertEquals(100, $result->get(1)->percentage);
- $this->assertEquals(25, $result->get(2)->percentage);
- }
-
- /**
- * @covers FireflyIII\Repositories\Account\AccountRepository::getTransfersInRange
- * @SuppressWarnings(PHPMD.ExcessiveMethodLength)
- */
- public function testGetTransfersInRange()
- {
- FactoryMuffin::create('FireflyIII\Models\Account');
- FactoryMuffin::create('FireflyIII\Models\TransactionType'); // withdrawal
- FactoryMuffin::create('FireflyIII\Models\TransactionType'); // deposit
- FactoryMuffin::create('FireflyIII\Models\AccountType'); // expense
- FactoryMuffin::create('FireflyIII\Models\AccountType'); // revenue
- $asset = FactoryMuffin::create('FireflyIII\Models\AccountType'); // asset
- $transfer = FactoryMuffin::create('FireflyIII\Models\TransactionType'); // transfer
- $user = FactoryMuffin::create('FireflyIII\User'); // user!
- $accounts = [];
- $opposings = []; // opposing accounts.
- $journals = [];
- // dates
- $start = new Carbon('2014-01-01');
- $end = new Carbon('2014-01-31');
- $inRange = new Carbon('2014-01-15');
- $before = new Carbon('2013-01-15');
-
- // create two accounts:
- for ($i = 0; $i < 2; $i++) {
- $account = FactoryMuffin::create('FireflyIII\Models\Account');
- $account->account_type_id = $asset->id;
- $account->user_id = $user->id;
- $account->save();
- $accounts[] = $account;
-
- $opposing = FactoryMuffin::create('FireflyIII\Models\Account');
- $opposing->account_type_id = $asset->id;
- $opposing->user_id = $user->id;
- $opposing->save();
- $opposings[] = $opposing;
- }
-
- // for each account, create ten journals
- foreach ($accounts as $index => $account) {
- for ($i = 0; $i < 10; $i++) {
- $journal = FactoryMuffin::create('FireflyIII\Models\TransactionJournal');
- $journal->user_id = $user->id;
- $journal->transaction_type_id = $transfer->id;
- $journal->save();
-
- // if $i < 6, transfer is in range:
- if ($i < 6) {
- $journal->date = $inRange;
- } else {
- $journal->date = $before;
- }
-
- /*
- * Transfers can go either way (see the amount)
- */
- if ($i < 4) {
- $amount = 100;
- } else {
- $amount = -100;
- }
-
-
- $journal->transactions[0]->account_id = $account->id;
- $journal->transactions[0]->amount = $amount;
- $journal->transactions[1]->account_id = $opposings[$index]->id;
- $journal->transactions[1]->amount = $amount * -1;
- $journal->transactions[0]->save();
- $journal->transactions[1]->save();
- // save journal:
- $journal->save();
- $journals[] = $journal;
- }
- }
- $this->be($user);
-
- $set = $this->object->getTransfersInRange($accounts[0], $start, $end);
-
- $this->assertEquals(4, $set->count());
- $this->assertEquals(100, $set->first()->amount);
- $this->assertEquals($journals[0]->description, $set->first()->description);
-
- }
-
- /**
- * @covers FireflyIII\Repositories\Account\AccountRepository::leftOnAccount
- */
- public function testLeftOnAccount()
- {
- $piggyBank = FactoryMuffin::create('FireflyIII\Models\PiggyBank');
- $piggyBankRepetition = $piggyBank->piggybankRepetitions()->first();
- $piggyBankRepetition->currentamount = rand(1, 100);
- $piggyBankRepetition->save();
- $this->be($piggyBank->account->user);
-
-
- $result = $this->object->leftOnAccount($piggyBank->account, new Carbon);
-
- $this->assertEquals($piggyBankRepetition->currentamount * -1, $result);
-
-
- }
-
- /**
- * @covers FireflyIII\Repositories\Account\AccountRepository::openingBalanceTransaction
- * @SuppressWarnings(PHPMD.ExcessiveMethodLength)
- */
- public function testOpeningBalanceTransaction()
- {
- $account = FactoryMuffin::create('FireflyIII\Models\Account');
- $journal1 = FactoryMuffin::create('FireflyIII\Models\TransactionJournal');
- $journal2 = FactoryMuffin::create('FireflyIII\Models\TransactionJournal');
-
- // dates
- $one = new Carbon('2013-01-15');
- $two = new Carbon('2015-01-15');
-
- // journal 1 will match:
- $journal1->date = $one;
- $journal1->user_id = $account->user_id;
- $journal2->date = $two;
- $journal2->user_id = $account->user_id;
-
- // add account things:
- $journal1->transactions[0]->account_id = $account->id;
- $journal1->transactions[1]->account_id = $account->id;
- $journal2->transactions[0]->account_id = $account->id;
- $journal2->transactions[1]->account_id = $account->id;
- $journal1->transactions[0]->save();
- $journal1->transactions[1]->save();
- $journal2->transactions[0]->save();
- $journal2->transactions[1]->save();
-
-
- $journal1->save();
- $journal2->save();
-
-
- $this->be($account->user);
-
- $result = $this->object->openingBalanceTransaction($account);
- $this->assertEquals($journal1->id, $result->id);
- $this->assertEquals($journal1->description, $result->description);
- $this->assertEquals(100, $result->amount);
- }
-
- /**
- * @covers FireflyIII\Repositories\Account\AccountRepository::openingBalanceTransaction
- */
- public function testOpeningBalanceTransactionNull()
- {
- $account = FactoryMuffin::create('FireflyIII\Models\Account');
- $this->be($account->user);
-
- $result = $this->object->openingBalanceTransaction($account);
- $this->assertNull($result);
- }
-
- /**
- * @covers FireflyIII\Repositories\Account\AccountRepository::store
- * @covers FireflyIII\Repositories\Account\AccountRepository::storeAccount
- * @covers FireflyIII\Repositories\Account\AccountRepository::storeMetadata
- * @covers FireflyIII\Repositories\Account\AccountRepository::storeInitialBalance
- *
- */
- public function testStore()
- {
- $user = FactoryMuffin::create('FireflyIII\User');
- FactoryMuffin::create('FireflyIII\Models\AccountType');
- FactoryMuffin::create('FireflyIII\Models\AccountType');
- FactoryMuffin::create('FireflyIII\Models\AccountType');
- FactoryMuffin::create('FireflyIII\Models\TransactionType');
- FactoryMuffin::create('FireflyIII\Models\TransactionType');
- FactoryMuffin::create('FireflyIII\Models\TransactionType');
- $currency = FactoryMuffin::create('FireflyIII\Models\TransactionCurrency');
- $this->be($user);
-
- $data = [
- 'accountType' => 'expense',
- 'user' => $user->id,
- 'name' => 'Test account #' . rand(1, 100),
- 'active' => true,
- 'accountRole' => 'testAccount',
- 'openingBalance' => 100,
- 'virtualBalance' => 0,
- 'openingBalanceCurrency' => $currency->id,
- 'openingBalanceDate' => '2015-01-01',
- ];
-
-
- $account = $this->object->store($data);
-
- $this->assertEquals($data['name'], $account->name);
-
- }
-
- /**
- * This function should give a big fat error, but it doesnt.
- *
- * @covers FireflyIII\Repositories\Account\AccountRepository::store
- * @covers FireflyIII\Repositories\Account\AccountRepository::storeAccount
- * @covers FireflyIII\Repositories\Account\AccountRepository::storeMetadata
- * @covers FireflyIII\Repositories\Account\AccountRepository::storeInitialBalance
- */
- public function testStoreWithExistingAccount()
- {
- $account = FactoryMuffin::create('FireflyIII\Models\Account'); // expense
- FactoryMuffin::create('FireflyIII\Models\AccountType'); // revenue
- FactoryMuffin::create('FireflyIII\Models\AccountType'); // asset
- FactoryMuffin::create('FireflyIII\Models\TransactionType'); // withdrawal
- FactoryMuffin::create('FireflyIII\Models\TransactionType'); // deposit
- FactoryMuffin::create('FireflyIII\Models\TransactionType'); // transfer
- $currency = FactoryMuffin::create('FireflyIII\Models\TransactionCurrency');
- $this->be($account->user);
-
-
- $data = [
- 'accountType' => 'expense',
- 'user' => $account->user->id,
- 'name' => $account->name,
- 'active' => $account->active,
- 'accountRole' => 'testAccount',
- 'openingBalance' => 0,
- 'virtualBalance' => 0,
- 'openingBalanceCurrency' => $currency->id,
- 'openingBalanceDate' => '2015-01-01',
- ];
-
- $newAccount = $this->object->store($data);
-
- $this->assertEquals($account->name, $newAccount->name);
- $this->assertEquals($account->id, $newAccount->id);
-
- }
-
- /**
- * @covers FireflyIII\Repositories\Account\AccountRepository::store
- * @covers FireflyIII\Repositories\Account\AccountRepository::storeAccount
- * @covers FireflyIII\Repositories\Account\AccountRepository::storeMetadata
- * @covers FireflyIII\Repositories\Account\AccountRepository::storeInitialBalance
- * @expectedException Symfony\Component\HttpKernel\Exception\HttpException
- */
- public function testStoreWithInvalidAccountData()
- {
- $account = FactoryMuffin::create('FireflyIII\Models\Account');
- FactoryMuffin::create('FireflyIII\Models\AccountType');
- FactoryMuffin::create('FireflyIII\Models\AccountType');
- FactoryMuffin::create('FireflyIII\Models\TransactionType');
- FactoryMuffin::create('FireflyIII\Models\TransactionType');
- FactoryMuffin::create('FireflyIII\Models\TransactionType');
- $currency = FactoryMuffin::create('FireflyIII\Models\TransactionCurrency');
- $this->be($account->user);
-
-
- $data = [
- 'accountType' => 'expense',
- 'user' => $account->user->id + 12,
- 'name' => $account->name,
- 'active' => $account->active,
- 'accountRole' => 'testAccount',
- 'openingBalance' => 0,
- 'virtualBalance' => 0,
- 'openingBalanceCurrency' => $currency->id,
- 'openingBalanceDate' => '2015-01-01',
- ];
-
- $this->object->store($data);
-
- }
-
- /**
- * @covers FireflyIII\Repositories\Account\AccountRepository::store
- * @covers FireflyIII\Repositories\Account\AccountRepository::storeAccount
- * @covers FireflyIII\Repositories\Account\AccountRepository::storeMetadata
- * @covers FireflyIII\Repositories\Account\AccountRepository::storeInitialBalance
- */
- public function testStoreWithNegativeInitialBalance()
- {
- $user = FactoryMuffin::create('FireflyIII\User');
- FactoryMuffin::create('FireflyIII\Models\AccountType');
- FactoryMuffin::create('FireflyIII\Models\AccountType');
- FactoryMuffin::create('FireflyIII\Models\AccountType');
- FactoryMuffin::create('FireflyIII\Models\TransactionType');
- FactoryMuffin::create('FireflyIII\Models\TransactionType');
- FactoryMuffin::create('FireflyIII\Models\TransactionType');
- $currency = FactoryMuffin::create('FireflyIII\Models\TransactionCurrency');
- $this->be($user);
-
- $data = [
- 'accountType' => 'expense',
- 'user' => $user->id,
- 'name' => 'Test account #' . rand(1, 100),
- 'active' => true,
- 'accountRole' => 'testAccount',
- 'openingBalance' => -100,
- 'virtualBalance' => 0,
- 'openingBalanceCurrency' => $currency->id,
- 'openingBalanceDate' => '2015-01-01',
- ];
-
-
- $account = $this->object->store($data);
-
- $this->assertEquals($data['name'], $account->name);
- $this->assertEquals(-100, $account->transactions()->first()->amount);
-
- }
-
- /**
- * @covers FireflyIII\Repositories\Account\AccountRepository::sumOfEverything
- */
- public function testSumOfEverything()
- {
- $user = FactoryMuffin::create('FireflyIII\User');
- $this->be($user);
-
- $this->assertEquals(0, $this->object->sumOfEverything());
- }
-
- /**
- * @covers FireflyIII\Repositories\Account\AccountRepository::update
- * @covers FireflyIII\Repositories\Account\AccountRepository::updateMetadata
- * @covers FireflyIII\Repositories\Account\AccountRepository::updateInitialBalance
- * @SuppressWarnings(PHPMD.ExcessiveMethodLength)
- */
- public function testUpdate()
- {
- $user = FactoryMuffin::create('FireflyIII\User');
- FactoryMuffin::create('FireflyIII\Models\AccountType');
- FactoryMuffin::create('FireflyIII\Models\AccountType');
- FactoryMuffin::create('FireflyIII\Models\AccountType');
- FactoryMuffin::create('FireflyIII\Models\TransactionType');
- FactoryMuffin::create('FireflyIII\Models\TransactionType');
- FactoryMuffin::create('FireflyIII\Models\TransactionType');
- $currency = FactoryMuffin::create('FireflyIII\Models\TransactionCurrency');
- $this->be($user);
-
- $data = [
- 'accountType' => 'expense',
- 'user' => $user->id,
- 'name' => 'Test account #' . rand(1, 100),
- 'active' => true,
- 'accountRole' => 'testAccount',
- 'openingBalance' => 100,
- 'virtualBalance' => 0,
- 'openingBalanceCurrency' => $currency->id,
- 'openingBalanceDate' => '2015-01-01',
- ];
-
-
- $account = $this->object->store($data);
-
- // now update that same account:
- $data = [
- 'name' => 'New account name' . rand(0, 100),
- 'active' => 1,
- 'virtualBalance' => 0,
- 'openingBalance' => 50,
- 'openingBalanceCurrency' => $currency->id,
- 'openingBalanceDate' => '2015-02-02',
- ];
-
- $newAccount = $this->object->update($account, $data);
-
- $this->assertEquals($data['name'], $newAccount->name);
- $this->assertEquals(50, $account->transactions()->first()->amount);
-
-
- }
-
- /**
- * @covers FireflyIII\Repositories\Account\AccountRepository::update
- * @covers FireflyIII\Repositories\Account\AccountRepository::updateMetadata
- * @covers FireflyIII\Repositories\Account\AccountRepository::updateInitialBalance
- * @SuppressWarnings(PHPMD.ExcessiveMethodLength)
- */
- public function testUpdateDeleteOpeningBalance()
- {
- $user = FactoryMuffin::create('FireflyIII\User');
- FactoryMuffin::create('FireflyIII\Models\AccountType');
- FactoryMuffin::create('FireflyIII\Models\AccountType');
- FactoryMuffin::create('FireflyIII\Models\AccountType');
- FactoryMuffin::create('FireflyIII\Models\TransactionType');
- FactoryMuffin::create('FireflyIII\Models\TransactionType');
- FactoryMuffin::create('FireflyIII\Models\TransactionType');
- $currency = FactoryMuffin::create('FireflyIII\Models\TransactionCurrency');
- $this->be($user);
-
- $data = [
- 'accountType' => 'expense',
- 'user' => $user->id,
- 'name' => 'Test account #' . rand(1, 100),
- 'active' => true,
- 'accountRole' => 'testAccount',
- 'openingBalance' => 100,
- 'virtualBalance' => 0,
- 'openingBalanceCurrency' => $currency->id,
- 'openingBalanceDate' => '2015-01-01',
- ];
-
-
- $account = $this->object->store($data);
-
- // now update that same account:
- $data = [
- 'name' => 'New account name' . rand(0, 100),
- 'active' => 1,
- 'user' => $user->id,
- 'accountRole' => 'testAccount',
- 'virtualBalance' => 0,
- 'openingBalance' => 0,
- ];
-
- $newAccount = $this->object->update($account, $data);
-
- $this->assertEquals($data['name'], $newAccount->name);
- $this->assertEquals(0, $newAccount->transactions()->whereNull('deleted_at')->count());
-
-
- }
-
- /**
- * @covers FireflyIII\Repositories\Account\AccountRepository::update
- * @covers FireflyIII\Repositories\Account\AccountRepository::updateMetadata
- * @covers FireflyIII\Repositories\Account\AccountRepository::updateInitialBalance
- * @SuppressWarnings(PHPMD.ExcessiveMethodLength)
- */
- public function testUpdateNewOpeningBalance()
- {
- $user = FactoryMuffin::create('FireflyIII\User');
- FactoryMuffin::create('FireflyIII\Models\AccountType');
- FactoryMuffin::create('FireflyIII\Models\AccountType');
- FactoryMuffin::create('FireflyIII\Models\AccountType');
- FactoryMuffin::create('FireflyIII\Models\TransactionType');
- FactoryMuffin::create('FireflyIII\Models\TransactionType');
- FactoryMuffin::create('FireflyIII\Models\TransactionType');
- $currency = FactoryMuffin::create('FireflyIII\Models\TransactionCurrency');
- $this->be($user);
-
- $data = [
- 'accountType' => 'expense',
- 'user' => $user->id,
- 'name' => 'Test account #' . rand(1, 100),
- 'active' => true,
- 'accountRole' => 'testAccount',
- 'openingBalance' => 0,
- 'virtualBalance' => 0,
- ];
-
-
- $account = $this->object->store($data);
-
- // now update that same account:
- $data = [
- 'name' => 'New account name' . rand(0, 100),
- 'active' => 1,
- 'user' => $user->id,
- 'virtualBalance' => 0,
- 'accountRole' => 'testAccount',
- 'ccMonthlyPaymentDate' => '2015-01-01',
- 'openingBalance' => 51,
- 'openingBalanceCurrency' => $currency->id,
- 'openingBalanceDate' => '2015-02-02',
- ];
-
- $newAccount = $this->object->update($account, $data);
-
- $this->assertEquals($data['name'], $newAccount->name);
- $this->assertEquals(51, $account->transactions()->first()->amount);
-
-
- }
-}
diff --git a/tests/repositories/BillRepositoryTest.php b/tests/repositories/BillRepositoryTest.php
deleted file mode 100644
index 36356391f5..0000000000
--- a/tests/repositories/BillRepositoryTest.php
+++ /dev/null
@@ -1,467 +0,0 @@
-object = new BillRepository;
- parent::setUp();
- }
-
- /**
- * 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 testBillPaymentsInRange()
- {
- $user = FactoryMuffin::create('FireflyIII\User');
- $this->be($user);
-
- $bill = FactoryMuffin::create('FireflyIII\Models\Bill');
- $start = Carbon::now()->startOfMonth();
- $end = Carbon::now()->endOfMonth();
-
- // payment:
- $journal = FactoryMuffin::create('FireflyIII\Models\TransactionJournal');
- $journal->date = $start;
- $journal->bill_id = $bill->id;
- $journal->save();
-
-
- $this->object->billPaymentsInRange($bill, $start, $end);
- }
-
- /**
- * @covers FireflyIII\Repositories\Bill\BillRepository::createFakeBill
- */
- public function testCreateFakeBill()
- {
- $description = 'Fake bill ' . rand(10, 100);
- $date = new Carbon('2013-01-01');
- $amount = 1200;
- $bill = $this->object->createFakeBill($description, $date, $amount);
-
- $this->assertEquals($amount, $bill->amount_max);
- $this->assertEquals($amount, $bill->amount_min);
- $this->assertNull($bill->id);
- $this->assertEquals($description, $bill->name);
-
- }
-
- /**
- * @covers FireflyIII\Repositories\Bill\BillRepository::destroy
- */
- public function testDestroy()
- {
- $bill = FactoryMuffin::create('FireflyIII\Models\Bill');
- $accountId = $bill->id;
- $this->object->destroy($bill);
-
- // cannot find bill:
- $this->assertCount(0, Bill::whereId($accountId)->whereNotNull('deleted_at')->get());
- }
-
- /**
- * @covers FireflyIII\Repositories\Bill\BillRepository::getActiveBills
- */
- public function testGetActiveBills()
- {
- $bill1 = FactoryMuffin::create('FireflyIII\Models\Bill');
- $bill2 = FactoryMuffin::create('FireflyIII\Models\Bill');
-
- // update bills
- $bill1->active = 1;
- $bill2->active = 0;
- $bill2->user_id = $bill1->user_id;
- $bill1->save();
- $bill2->save();
- $this->be($bill1->user);
-
- $set = $this->object->getActiveBills();
-
- $this->assertCount(1, $set);
- }
-
- /**
- * @covers FireflyIII\Repositories\Bill\BillRepository::getBills
- */
- public function testGetBills()
- {
- $bill1 = FactoryMuffin::create('FireflyIII\Models\Bill');
- $bill2 = FactoryMuffin::create('FireflyIII\Models\Bill');
-
- // update bills
- $bill1->active = 1;
- $bill2->active = 0;
- $bill2->user_id = $bill1->user_id;
- $bill1->save();
- $bill2->save();
- $this->be($bill1->user);
-
- $set = $this->object->getBills();
-
- $this->assertCount(2, $set);
- }
-
- /**
- * @covers FireflyIII\Repositories\Bill\BillRepository::getJournals
- */
- public function testGetJournals()
- {
- $bill1 = FactoryMuffin::create('FireflyIII\Models\Bill');
-
- // update bills
- $bill1->active = 1;
- $bill1->save();
- $this->be($bill1->user);
-
- $set = $this->object->getJournals($bill1);
-
- $this->assertCount(0, $set);
- }
-
- /**
- * @covers FireflyIII\Repositories\Bill\BillRepository::getJournalsInRange
- */
- public function testGetJournalsInRange()
- {
- $bill1 = FactoryMuffin::create('FireflyIII\Models\Bill');
-
- // update bills
- $bill1->active = 1;
- $bill1->save();
- $this->be($bill1->user);
-
- $set = $this->object->getJournalsInRange($bill1, new Carbon, new Carbon);
-
- $this->assertCount(0, $set);
- }
-
- /**
- * @covers FireflyIII\Repositories\Bill\BillRepository::getPossiblyRelatedJournals
- */
- public function testGetPossiblyRelatedJournals()
- {
- $bill1 = FactoryMuffin::create('FireflyIII\Models\Bill');
- $account = FactoryMuffin::create('FireflyIII\Models\Account');
- $bill1->amount_min = 100;
- $bill1->amount_max = 1000;
- $account->user_id = $bill1->user_id;
- $bill1->save();
- $account->save();
-
- // create some transactions to match our bill:
- for ($i = 0; $i < 8; $i++) {
- $journal = FactoryMuffin::create('FireflyIII\Models\TransactionJournal');
- $journal->user_id = $bill1->user_id;
- $journal->save();
- $journal->transactions[0]->account_id = $account->id;
- $journal->transactions[0]->save();
- }
- $this->be($bill1->user);
-
- $set = $this->object->getPossiblyRelatedJournals($bill1);
- $this->assertCount(8, $set);
- }
-
- /**
- * @covers FireflyIII\Repositories\Bill\BillRepository::getRanges
- */
- public function testGetRanges()
- {
- $bill1 = FactoryMuffin::create('FireflyIII\Models\Bill');
- $bill1->date = new Carbon('2012-01-01');
- $bill1->repeat_freq = 'monthly';
- $bill1->save();
-
- $set = $this->object->getRanges($bill1, new Carbon('2012-01-01'), new Carbon('2012-12-31'));
-
- $this->assertCount(12, $set);
- }
-
- /**
- * @covers FireflyIII\Repositories\Bill\BillRepository::lastFoundMatch
- */
- public function testLastFoundMatch()
- {
- $bill = FactoryMuffin::create('FireflyIII\Models\Bill');
- $journal = FactoryMuffin::create('FireflyIII\Models\TransactionJournal');
- $journal->bill_id = $bill->id;
- $journal->user_id = $bill->user_id;
- $journal->save();
-
- $this->be($bill->user);
-
- $date = $this->object->lastFoundMatch($bill);
-
- $this->assertEquals($journal->date->format('Y-m-d'), $date->format('Y-m-d'));
- }
-
- /**
- * @covers FireflyIII\Repositories\Bill\BillRepository::lastFoundMatch
- */
- public function testLastFoundMatchNull()
- {
- $bill = FactoryMuffin::create('FireflyIII\Models\Bill');
-
- $this->be($bill->user);
-
- $date = $this->object->lastFoundMatch($bill);
-
- $this->assertNull($date);
- }
-
- /**
- * @covers FireflyIII\Repositories\Bill\BillRepository::nextExpectedMatch
- */
- public function testNextExpectedMatch()
- {
- $bill = FactoryMuffin::create('FireflyIII\Models\Bill');
- $bill->date = new Carbon('2012-01-07');
- $bill->repeat_freq = 'monthly';
- $bill->save();
- $this->be($bill->user);
-
- // journal:
- $journal = FactoryMuffin::create('FireflyIII\Models\TransactionJournal');
- $journal->date = Carbon::now()->format('Y-m-d');
- $journal->user_id = $bill->user_id;
- $journal->bill_id = $bill->id;
- $journal->save();
-
- $next = $this->object->nextExpectedMatch($bill);
- $today = Carbon::now()->endOfMonth()->addDay();
- $this->assertEquals($today->format('Y-m-d'), $next->format('Y-m-d'));
-
-
- }
-
- /**
- * @covers FireflyIII\Repositories\Bill\BillRepository::nextExpectedMatch
- */
- public function testNextExpectedMatchInactive()
- {
- $bill = FactoryMuffin::create('FireflyIII\Models\Bill');
- $bill->active = 0;
- $bill->save();
- $this->be($bill->user);
-
- $this->assertNull($this->object->nextExpectedMatch($bill));
-
-
- }
-
- /**
- * @covers FireflyIII\Repositories\Bill\BillRepository::nextExpectedMatch
- */
- public function testNextExpectedMatchNoJournals()
- {
- $bill = FactoryMuffin::create('FireflyIII\Models\Bill');
- $bill->date = new Carbon('2012-01-07');
- $bill->repeat_freq = 'monthly';
- $bill->save();
-
- $this->be($bill->user);
-
- $next = $this->object->nextExpectedMatch($bill);
- $today = Carbon::now()->startOfMonth();
- $this->assertEquals($today->format('Y-m-d'), $next->format('Y-m-d'));
-
-
- }
-
-
- /**
- * One
- * @SuppressWarnings(PHPMD.ExcessiveMethodLength)
- *
- * @covers FireflyIII\Repositories\Bill\BillRepository::scan
- * @covers FireflyIII\Repositories\Bill\BillRepository::doWordMatch
- * @covers FireflyIII\Repositories\Bill\BillRepository::doAmountMatch
- */
- public function testScanMatch()
- {
- $user = FactoryMuffin::create('FireflyIII\User');
- $this->be($user);
- $bill = FactoryMuffin::create('FireflyIII\Models\Bill');
- $bill->date = new Carbon('2012-01-07');
- $bill->repeat_freq = 'monthly';
- $bill->match = 'jemoeder';
- $bill->amount_min = 90;
- $bill->amount_max = 110;
- $bill->save();
- $this->be($bill->user);
-
- // journal:
- $journal = FactoryMuffin::create('FireflyIII\Models\TransactionJournal');
- $journal->date = Carbon::now()->format('Y-m-d');
- $journal->description = 'jemoeder';
- $journal->user_id = $bill->user_id;
- $journal->save();
-
- $this->object->scan($bill, $journal);
- $newJournal = TransactionJournal::find($journal->id);
-
- $this->assertEquals($bill->id, $newJournal->bill_id);
- }
-
- /**
- * @covers FireflyIII\Repositories\Bill\BillRepository::scan
- * @covers FireflyIII\Repositories\Bill\BillRepository::doWordMatch
- * @covers FireflyIII\Repositories\Bill\BillRepository::doAmountMatch
- */
- public function testScanNoMatch()
- {
- $bill = FactoryMuffin::create('FireflyIII\Models\Bill');
- $bill->date = new Carbon('2012-01-07');
- $bill->repeat_freq = 'monthly';
- $bill->save();
- $this->be($bill->user);
-
- // journal:
- $journal = FactoryMuffin::create('FireflyIII\Models\TransactionJournal');
- $journal->date = Carbon::now()->format('Y-m-d');
- $journal->user_id = $bill->user_id;
- $journal->save();
-
- // two transactions:
- $account1 = FactoryMuffin::create('FireflyIII\Models\Account');
- $account2 = FactoryMuffin::create('FireflyIII\Models\Account');
- Transaction::create(
- [
- 'account_id' => $account1->id,
- 'transaction_journal_id' => $journal->id,
- 'amount' => 100,
- ]
- );
- Transaction::create(
- [
- 'account_id' => $account2->id,
- 'transaction_journal_id' => $journal->id,
- 'amount' => 100,
- ]
- );
-
- $this->object->scan($bill, $journal);
- $newJournal = TransactionJournal::find($journal->id);
-
- $this->assertNull($newJournal->bill_id);
- }
-
- /**
- * @covers FireflyIII\Repositories\Bill\BillRepository::scan
- * @covers FireflyIII\Repositories\Bill\BillRepository::doWordMatch
- * @covers FireflyIII\Repositories\Bill\BillRepository::doAmountMatch
- */
- public function testScanNoMatchButAttached()
- {
- $bill = FactoryMuffin::create('FireflyIII\Models\Bill');
- $bill->date = new Carbon('2012-01-07');
- $bill->match = 'blablabla';
- $bill->repeat_freq = 'monthly';
- $bill->save();
- $this->be($bill->user);
-
- // journal:
- $journal = FactoryMuffin::create('FireflyIII\Models\TransactionJournal');
- $journal->date = Carbon::now()->format('Y-m-d');
- $journal->user_id = $bill->user_id;
- $journal->bill_id = $bill->id;
- $journal->save();
-
- // two transactions:
- $account1 = FactoryMuffin::create('FireflyIII\Models\Account');
- $account2 = FactoryMuffin::create('FireflyIII\Models\Account');
- Transaction::create(
- [
- 'account_id' => $account1->id,
- 'transaction_journal_id' => $journal->id,
- 'amount' => 100,
- ]
- );
- Transaction::create(
- [
- 'account_id' => $account2->id,
- 'transaction_journal_id' => $journal->id,
- 'amount' => 100,
- ]
- );
-
- $this->object->scan($bill, $journal);
- $newJournal = TransactionJournal::find($journal->id);
-
- $this->assertNull($newJournal->bill_id);
- }
-
- /**
- * @covers FireflyIII\Repositories\Bill\BillRepository::store
- */
- public function testStore()
- {
- $user = FactoryMuffin::create('FireflyIII\User');
- $data = [
- 'name' => 'Something',
- 'match' => 'Something',
- 'amount_min' => 100,
- 'user' => $user->id,
- 'amount_max' => 110,
- 'date' => new Carbon,
- 'repeat_freq' => 'monthly',
- 'skip' => 0,
- 'automatch' => 1,
- 'active' => 1,
-
- ];
- $bill = $this->object->store($data);
-
- $this->assertEquals($data['name'], $bill->name);
- }
-
- /**
- * @covers FireflyIII\Repositories\Bill\BillRepository::update
- */
- public function testUpdate()
- {
- $bill = FactoryMuffin::create('FireflyIII\Models\Bill');
- $data = [
- 'name' => 'new Name',
- 'match' => $bill->match,
- 'amount_min' => 100,
- 'amount_max' => 110,
- 'date' => new Carbon,
- 'repeat_freq' => 'monthly',
- 'skip' => 0,
- 'automatch' => 1,
- 'active' => 1,
-
- ];
- $newBill = $this->object->update($bill, $data);
-
- $this->assertEquals($data['name'], $newBill->name);
- $this->assertEquals($bill->match, $newBill->match);
- }
-}
diff --git a/tests/repositories/BudgetRepositoryTest.php b/tests/repositories/BudgetRepositoryTest.php
deleted file mode 100644
index f172274f1e..0000000000
--- a/tests/repositories/BudgetRepositoryTest.php
+++ /dev/null
@@ -1,399 +0,0 @@
-object = new BudgetRepository;
- parent::setUp();
- }
-
- /**
- * Tears down the fixture, for example, closes a network connection.
- * This method is called after a test is executed.
- */
- public function tearDown()
- {
- parent::tearDown();
- }
-
- /**
- * @covers FireflyIII\Repositories\Budget\BudgetRepository::cleanupBudgets
- * @covers FireflyIII\Providers\EventServiceProvider::boot
- */
- public function testCleanupBudgets()
- {
- // create some budgets:
- for ($i = 0; $i < 3; $i++) {
- $budget = FactoryMuffin::create('FireflyIII\Models\Budget');
- $limit = FactoryMuffin::create('FireflyIII\Models\BudgetLimit');
- $limit->budget_id = $budget->id;
- $limit->amount = 0;
- $limit->save();
- }
-
-
- $this->object->cleanupBudgets();
-
- $this->assertCount(0, BudgetLimit::get());
-
- }
-
- /**
- * @covers FireflyIII\Repositories\Budget\BudgetRepository::destroy
- */
- public function testDestroy()
- {
- $budget = FactoryMuffin::create('FireflyIII\Models\Budget');
-
- $this->object->destroy($budget);
-
- $this->assertCount(0, Budget::where('id', $budget->id)->whereNull('deleted_at')->get());
- }
-
- /**
- * @covers FireflyIII\Repositories\Budget\BudgetRepository::expensesOnDayCorrected
- */
- public function testExpensesOnDayCorrected()
- {
- $budget = FactoryMuffin::create('FireflyIII\Models\Budget');
-
- $result = $this->object->expensesOnDayCorrected($budget, new Carbon);
-
- $this->assertEquals(0, $result);
- }
-
- /**
- * @covers FireflyIII\Repositories\Budget\BudgetRepository::getActiveBudgets
- */
- public function testGetActiveBudgets()
- {
- $budget1 = FactoryMuffin::create('FireflyIII\Models\Budget');
- $budget2 = FactoryMuffin::create('FireflyIII\Models\Budget');
- $budget1->active = 1;
- $budget2->active = 0;
- $budget2->user_id = $budget1->user_id;
- $budget1->save();
- $budget2->save();
- $this->be($budget1->user);
-
- $set = $this->object->getActiveBudgets();
-
- $this->assertCount(1, $set);
- $this->assertEquals($set->first()->id, $budget1->id);
-
- }
-
- /**
- * @covers FireflyIII\Repositories\Budget\BudgetRepository::getBudgetLimitRepetitions
- */
- public function testGetBudgetLimitRepetitions()
- {
- $rep = FactoryMuffin::create('FireflyIII\Models\LimitRepetition');
- $limit = $rep->budgetlimit;
- $limit->startdate = new Carbon('2015-02-02');
- $rep->startdate = new Carbon('2015-02-02');
- $rep->enddate = new Carbon('2015-02-28');
- $limit->save();
- $rep->save();
-
- $set = $this->object->getBudgetLimitRepetitions($rep->budgetlimit->budget, new Carbon('2015-02-01'), new Carbon('2015-02-28'));
- $this->assertCount(2, $set);
- }
-
- /**
- * @covers FireflyIII\Repositories\Budget\BudgetRepository::getBudgetLimits
- */
- public function testGetBudgetLimits()
- {
- /** @var Budget $budget */
- $budget = FactoryMuffin::create('FireflyIII\Models\Budget');
- $set = $this->object->getBudgetLimits($budget);
-
- $this->assertCount(0, $set);
- }
-
- /**
- * @covers FireflyIII\Repositories\Budget\BudgetRepository::getBudgets
- */
- public function testGetBudgets()
- {
- $budget1 = FactoryMuffin::create('FireflyIII\Models\Budget');
- $budget2 = FactoryMuffin::create('FireflyIII\Models\Budget');
- $budget1->active = 1;
- $budget2->active = 0;
- $budget2->user_id = $budget1->user_id;
- $budget1->save();
- $budget2->save();
- $this->be($budget1->user);
-
- $set = $this->object->getBudgets();
-
- $this->assertCount(2, $set);
- }
-
- /**
- * @covers FireflyIII\Repositories\Budget\BudgetRepository::getCurrentRepetition
- */
- public function testGetCurrentRepetition()
- {
- $user = FactoryMuffin::create('FireflyIII\User');
- $this->be($user);
- /** @var Budget $budget */
- $budget = FactoryMuffin::create('FireflyIII\Models\Budget');
- $rep = $this->object->getCurrentRepetition($budget, new Carbon);
- $this->assertNull($rep);
-
- }
-
- /**
- * @covers FireflyIII\Repositories\Budget\BudgetRepository::getFirstBudgetLimitDate
- */
- public function testGetFirstBudgetLimitDate()
- {
- /** @var BudgetLimit $budget */
- $limit = FactoryMuffin::create('FireflyIII\Models\BudgetLimit');
- $date = $this->object->getFirstBudgetLimitDate($limit->budget);
- $this->assertEquals($date->format('Y-m-d'), $limit->startdate->format('Y-m-d'));
- }
-
- /**
- * @covers FireflyIII\Repositories\Budget\BudgetRepository::getFirstBudgetLimitDate
- */
- public function testGetFirstBudgetLimitDateNull()
- {
- /** @var Budget $budget */
- $budget = FactoryMuffin::create('FireflyIII\Models\Budget');
- $date = $this->object->getFirstBudgetLimitDate($budget);
- $ownDate = Carbon::now()->startOfYear();
- $this->assertEquals($date->format('Y-m-d'), $ownDate->format('Y-m-d'));
- }
-
- /**
- * @covers FireflyIII\Repositories\Budget\BudgetRepository::getInactiveBudgets
- */
- public function testGetInactiveBudgets()
- {
- $budget1 = FactoryMuffin::create('FireflyIII\Models\Budget');
- $budget2 = FactoryMuffin::create('FireflyIII\Models\Budget');
- $budget1->active = 1;
- $budget2->active = 0;
- $budget2->user_id = $budget1->user_id;
- $budget1->save();
- $budget2->save();
- $this->be($budget1->user);
-
- $set = $this->object->getInactiveBudgets();
-
- $this->assertCount(1, $set);
- $this->assertEquals($set->first()->id, $budget2->id);
- }
-
- /**
- * @covers FireflyIII\Repositories\Budget\BudgetRepository::getJournals
- */
- public function testGetJournals()
- {
- $user = FactoryMuffin::create('FireflyIII\User');
- $this->be($user);
-
- $repetition = FactoryMuffin::create('FireflyIII\Models\LimitRepetition');
-
- $set = $this->object->getJournals($repetition->budgetlimit->budget, $repetition);
- $this->assertTrue($set instanceof LengthAwarePaginator);
- $this->assertCount(0, $set);
- $this->assertEquals(1, $set->currentPage());
- }
-
- /**
- * @covers FireflyIII\Repositories\Budget\BudgetRepository::getLastBudgetLimitDate
- */
- public function testGetLastBudgetLimitDate()
- {
- /** @var BudgetLimit $budget */
- $limit = FactoryMuffin::create('FireflyIII\Models\BudgetLimit');
- $date = $this->object->getLastBudgetLimitDate($limit->budget);
- $this->assertEquals($date->format('Y-m-d'), $limit->startdate->format('Y-m-d'));
- }
-
- /**
- * @covers FireflyIII\Repositories\Budget\BudgetRepository::getLastBudgetLimitDate
- */
- public function testGetLastBudgetLimitDateNull()
- {
-
- /** @var Budget $budget */
- $budget = FactoryMuffin::create('FireflyIII\Models\Budget');
- $date = $this->object->getLastBudgetLimitDate($budget);
- $ownDate = Carbon::now()->startOfYear();
- $this->assertEquals($date->format('Y-m-d'), $ownDate->format('Y-m-d'));
- }
-
- /**
- * @covers FireflyIII\Repositories\Budget\BudgetRepository::getLimitAmountOnDate
- */
- public function testGetLimitAmountOnDate()
- {
- $rep = FactoryMuffin::create('FireflyIII\Models\LimitRepetition');
-
- $amount = $this->object->getLimitAmountOnDate($rep->budgetlimit->budget, $rep->startdate);
-
- $this->assertEquals($rep->amount, $amount);
- }
-
- /**
- * @covers FireflyIII\Repositories\Budget\BudgetRepository::getLimitAmountOnDate
- */
- public function testGetLimitAmountOnDateNull()
- {
- $budget = FactoryMuffin::create('FireflyIII\Models\Budget');
-
- $amount = $this->object->getLimitAmountOnDate($budget, new Carbon);
-
- $this->assertNull($amount);
- }
-
- /**
- * @covers FireflyIII\Repositories\Budget\BudgetRepository::getWithoutBudget
- */
- public function testGetWithoutBudget()
- {
- $user = FactoryMuffin::create('FireflyIII\User');
- $this->be($user);
- $set = $this->object->getWithoutBudget(new Carbon, new Carbon);
- $this->assertCount(0, $set);
- }
-
- /**
- * @covers FireflyIII\Repositories\Budget\BudgetRepository::getWithoutBudgetSum
- */
- public function testGetWithoutBudgetSum()
- {
- $user = FactoryMuffin::create('FireflyIII\User');
- $this->be($user);
- $sum = $this->object->getWithoutBudgetSum(new Carbon, new Carbon);
- $this->assertEquals(0, $sum);
- }
-
- /**
- * @covers FireflyIII\Repositories\Budget\BudgetRepository::spentInPeriodCorrected
- * @covers FireflyIII\Repositories\Shared\ComponentRepository::spentInPeriod
- */
- public function testSpentInPeriodCorrected()
- {
- $user = FactoryMuffin::create('FireflyIII\User');
- $this->be($user);
-
- $budget = FactoryMuffin::create('FireflyIII\Models\Budget');
-
- $amount = $this->object->spentInPeriodCorrected($budget, new Carbon, new Carbon, false);
- $this->assertEquals(0, $amount);
- }
-
- /**
- * @covers FireflyIII\Repositories\Budget\BudgetRepository::spentInPeriodCorrected
- * @covers FireflyIII\Repositories\Shared\ComponentRepository::spentInPeriod
- */
- public function testSpentInPeriodCorrectedShared()
- {
- $user = FactoryMuffin::create('FireflyIII\User');
- $this->be($user);
-
- $budget = FactoryMuffin::create('FireflyIII\Models\Budget');
-
- $amount = $this->object->spentInPeriodCorrected($budget, new Carbon, new Carbon, true);
- $this->assertEquals(0, $amount);
- }
-
- /**
- * @covers FireflyIII\Repositories\Budget\BudgetRepository::store
- */
- public function testStore()
- {
- $user = FactoryMuffin::create('FireflyIII\User');
-
- $data = [
- 'name' => 'new budget ' . rand(1, 100),
- 'user' => $user->id
- ];
- $result = $this->object->store($data);
-
- $this->assertTrue($result instanceof Budget);
- $this->assertEquals($result->name, $data['name']);
- }
-
- /**
- * @covers FireflyIII\Repositories\Budget\BudgetRepository::update
- */
- public function testUpdate()
- {
- $budget = FactoryMuffin::create('FireflyIII\Models\Budget');
-
- $data = [
- 'name' => 'update budget ' . rand(1, 100),
- 'active' => true
- ];
- $result = $this->object->update($budget, $data);
-
- $this->assertTrue($result instanceof Budget);
- $this->assertEquals($result->name, $data['name']);
- $this->assertEquals($result->id, $budget->id);
- }
-
- /**
- * @covers FireflyIII\Repositories\Budget\BudgetRepository::updateLimitAmount
- */
- public function testUpdateLimitAmount()
- {
- $budget = FactoryMuffin::create('FireflyIII\Models\Budget');
-
- $result = $this->object->updateLimitAmount($budget, new Carbon, 100);
-
- $this->assertTrue($result instanceof BudgetLimit);
- $this->assertEquals($result->amount, 100);
- }
-
- /**
- * @covers FireflyIII\Repositories\Budget\BudgetRepository::updateLimitAmount
- */
- public function testUpdateLimitAmountExisting()
- {
- $budgetLimit = FactoryMuffin::create('FireflyIII\Models\BudgetLimit');
-
- $result = $this->object->updateLimitAmount($budgetLimit->budget, $budgetLimit->startdate, 100);
-
- $this->assertTrue($result instanceof BudgetLimit);
- $this->assertEquals($result->amount, 100);
- }
-
- /**
- * @covers FireflyIII\Repositories\Budget\BudgetRepository::updateLimitAmount
- */
- public function testUpdateLimitAmountZero()
- {
- $budgetLimit = FactoryMuffin::create('FireflyIII\Models\BudgetLimit');
-
- $result = $this->object->updateLimitAmount($budgetLimit->budget, $budgetLimit->startdate, 0);
-
- $this->assertTrue($result instanceof BudgetLimit);
- }
-}
diff --git a/tests/repositories/CategoryRepositoryTest.php b/tests/repositories/CategoryRepositoryTest.php
deleted file mode 100644
index 63ed85ee83..0000000000
--- a/tests/repositories/CategoryRepositoryTest.php
+++ /dev/null
@@ -1,290 +0,0 @@
-object = new CategoryRepository;
- parent::setUp();
- }
-
- /**
- * Tears down the fixture, for example, closes a network connection.
- * This method is called after a test is executed.
- */
- public function tearDown()
- {
- parent::tearDown();
- }
-
- /**
- * @covers FireflyIII\Repositories\Category\CategoryRepository::countJournals
- */
- public function testCountJournals()
- {
- $category = FactoryMuffin::create('FireflyIII\Models\Category');
- $result = $this->object->countJournals($category);
-
- $this->assertEquals(0, $result);
- }
-
- /**
- * @covers FireflyIII\Repositories\Category\CategoryRepository::destroy
- */
- public function testDestroy()
- {
- $category = FactoryMuffin::create('FireflyIII\Models\Category');
- $this->object->destroy($category);
-
- $count = Category::where('id', $category->id)->whereNull('deleted_at')->count();
- $this->assertEquals(0, $count);
- }
-
- /**
- * @covers FireflyIII\Repositories\Category\CategoryRepository::getCategories
- */
- public function testGetCategories()
- {
- $user = FactoryMuffin::create('FireflyIII\User');
- $cat1 = FactoryMuffin::create('FireflyIII\Models\Category');
- $cat2 = FactoryMuffin::create('FireflyIII\Models\Category');
- $cat1->name = 'BBBBB';
- $cat2->name = 'AAAAA';
- $cat1->user_id = $user->id;
- $cat2->user_id = $user->id;
- $cat1->save();
- $cat2->save();
- $this->be($user);
-
- $set = $this->object->getCategories();
- $this->assertEquals('AAAAA', $set->first()->name);
- $this->assertCount(2, $set);
- }
-
- /**
- * @covers FireflyIII\Repositories\Category\CategoryRepository::getCategoriesAndExpensesCorrected
- * @SuppressWarnings(PHPMD.ExcessiveMethodLength)
- */
- public function testGetCategoriesAndExpensesCorrected()
- {
- $user = FactoryMuffin::create('FireflyIII\User');
- $type = FactoryMuffin::create('FireflyIII\Models\TransactionType'); // withdrawal
- $currency = FactoryMuffin::create('FireflyIII\Models\TransactionCurrency'); // something
-
- // some dates:
- $start = new Carbon('2014-01-01');
- $end = new Carbon('2014-01-31');
- $inRange = new Carbon('2014-01-12');
-
- // generate three categories
- // with ten journals each:
- for ($i = 0; $i < 3; $i++) {
- // category:
- /** @var Category $category */
- $category = FactoryMuffin::create('FireflyIII\Models\Category');
- $category->user_id = $user->id;
- $category->save();
-
- for ($j = 0; $j < 10; $j++) {
- $journal = FactoryMuffin::create('FireflyIII\Models\TransactionJournal');
- $journal->user_id = $user->id;
- $journal->transaction_currency_id = $currency->id;
- $journal->transaction_type_id = $type->id; // make it a withdrawal
- $journal->date = $inRange;
- $journal->save();
- // connect to category:
- $category->transactionjournals()->save($journal);
- }
- }
-
- $this->be($user);
- $set = $this->object->getCategoriesAndExpensesCorrected($start, $end);
- $this->assertCount(3, $set);
- reset($set);
-
- // 10 journals of 100 each = 1000.
- $this->assertEquals('1000', current($set)['sum']);
- }
-
- /**
- * @covers FireflyIII\Repositories\Category\CategoryRepository::getFirstActivityDate
- */
- public function testGetFirstActivityDate()
- {
- $user = FactoryMuffin::create('FireflyIII\User');
- $journal = FactoryMuffin::create('FireflyIII\Models\TransactionJournal');
- /** @var Category $category */
- $category = FactoryMuffin::create('FireflyIII\Models\Category');
- $journal->user_id = $user->id;
- $journal->date = new Carbon('2015-02-11');
- $category->user_id = $user->id;
- $category->transactionjournals()->save($journal);
- $journal->save();
- $category->save();
-
- $this->be($user);
-
- $date = $this->object->getFirstActivityDate($category);
- $this->assertEquals('2015-02-11', $date->format('Y-m-d'));
- }
-
- /**
- * @covers FireflyIII\Repositories\Category\CategoryRepository::getFirstActivityDate
- */
- public function testGetFirstActivityDateNull()
- {
- /** @var Category $category */
- $category = FactoryMuffin::create('FireflyIII\Models\Category');
- $this->be($category->user);
-
- $date = $this->object->getFirstActivityDate($category);
- $this->assertEquals(Carbon::now()->format('Y-m-d'), $date->format('Y-m-d'));
- }
-
- /**
- * @covers FireflyIII\Repositories\Category\CategoryRepository::getJournals
- */
- public function testGetJournals()
- {
-
- /** @var Category $category */
- $category = FactoryMuffin::create('FireflyIII\Models\Category');
- $this->be($category->user);
- $set = $this->object->getJournals($category, 1);
-
- $this->assertEquals(0, $set->count());
- }
-
- /**
- * @covers FireflyIII\Repositories\Category\CategoryRepository::getLatestActivity
- */
- public function testGetLatestActivity()
- {
- $user = FactoryMuffin::create('FireflyIII\User');
- $journal = FactoryMuffin::create('FireflyIII\Models\TransactionJournal');
- /** @var Category $category */
- $category = FactoryMuffin::create('FireflyIII\Models\Category');
- $journal->user_id = $user->id;
- $journal->date = new Carbon('2015-02-11');
- $category->user_id = $user->id;
- $category->transactionjournals()->save($journal);
- $journal->save();
- $category->save();
-
- $this->be($user);
-
- $date = $this->object->getLatestActivity($category);
- $this->assertEquals('2015-02-11', $date->format('Y-m-d'));
- }
-
- /**
- * @covers FireflyIII\Repositories\Category\CategoryRepository::getWithoutCategory
- */
- public function testGetWithoutCategory()
- {
- $user = FactoryMuffin::create('FireflyIII\User');
- $this->be($user);
-
- $set = $this->object->getWithoutCategory(new Carbon, new Carbon);
- $this->assertCount(0, $set);
- }
-
- /**
- * @covers FireflyIII\Repositories\Category\CategoryRepository::spentInPeriodCorrected
- * @covers FireflyIII\Repositories\Shared\ComponentRepository::spentInPeriod
- */
- public function testSpentInPeriodSumCorrected()
- {
- $user = FactoryMuffin::create('FireflyIII\User');
- $this->be($user);
- $category = FactoryMuffin::create('FireflyIII\Models\Category');
- $sum = $this->object->spentInPeriodCorrected($category, new Carbon, new Carbon, false);
-
- $this->assertEquals(0, $sum);
-
-
- }
-
- /**
- * @covers FireflyIII\Repositories\Category\CategoryRepository::spentInPeriodCorrected
- * @covers FireflyIII\Repositories\Shared\ComponentRepository::spentInPeriod
- */
- public function testSpentInPeriodSumCorrectedShared()
- {
- $user = FactoryMuffin::create('FireflyIII\User');
- $this->be($user);
- $category = FactoryMuffin::create('FireflyIII\Models\Category');
- $sum = $this->object->spentInPeriodCorrected($category, new Carbon, new Carbon, true);
-
- $this->assertEquals(0, $sum);
-
-
- }
-
- /**
- * @covers FireflyIII\Repositories\Category\CategoryRepository::spentOnDaySumCorrected
- */
- public function testSpentOnDaySumCorrected()
- {
- $category = FactoryMuffin::create('FireflyIII\Models\Category');
- $sum = $this->object->spentOnDaySumCorrected($category, new Carbon);
-
- $this->assertEquals(0, $sum);
- }
-
- /**
- * @covers FireflyIII\Repositories\Category\CategoryRepository::store
- */
- public function testStore()
- {
- $user = FactoryMuffin::create('FireflyIII\User');
- $data = [
- 'name' => 'New category' . rand(1, 100),
- 'user' => $user->id
- ];
- $newCategory = $this->object->store($data);
-
- $this->assertEquals($data['name'], $newCategory->name);
- }
-
- /**
- * @covers FireflyIII\Repositories\Category\CategoryRepository::update
- */
- public function testUpdate()
- {
- $category = FactoryMuffin::create('FireflyIII\Models\Category');
- $data = [
- 'name' => 'New category' . rand(1, 100),
- ];
- $newCategory = $this->object->update($category, $data);
-
- $this->assertEquals($data['name'], $newCategory->name);
- }
-
- public function testgetLatestActivityNull()
- {
- /** @var Category $category */
- $category = FactoryMuffin::create('FireflyIII\Models\Category');
- $this->be($category->user);
-
- $date = $this->object->getLatestActivity($category);
- $this->assertNull($date);
- }
-}
diff --git a/tests/repositories/CurrencyRepositoryTest.php b/tests/repositories/CurrencyRepositoryTest.php
deleted file mode 100644
index a8d09b43f3..0000000000
--- a/tests/repositories/CurrencyRepositoryTest.php
+++ /dev/null
@@ -1,114 +0,0 @@
-object = new CurrencyRepository;
- parent::setUp();
- }
-
- /**
- * Tears down the fixture, for example, closes a network connection.
- * This method is called after a test is executed.
- */
- public function tearDown()
- {
- parent::tearDown();
- }
-
- /**
- * @covers FireflyIII\Repositories\Currency\CurrencyRepository::countJournals
- */
- public function testCountJournals()
- {
- $currency = FactoryMuffin::create('FireflyIII\Models\TransactionCurrency');
- $count = $this->object->countJournals($currency);
- $this->assertEquals(0, $count);
- }
-
- /**
- * @covers FireflyIII\Repositories\Currency\CurrencyRepository::get
- */
- public function testGet()
- {
- FactoryMuffin::create('FireflyIII\Models\TransactionCurrency');
- FactoryMuffin::create('FireflyIII\Models\TransactionCurrency');
-
- $set = $this->object->get();
- $this->assertCount(3, $set); // EUR is already present.
- }
-
- /**
- * @covers FireflyIII\Repositories\Currency\CurrencyRepository::getCurrencyByPreference
- */
- public function testGetCurrencyByPreference()
- {
- $currency = FactoryMuffin::create('FireflyIII\Models\TransactionCurrency');
- $preference = FactoryMuffin::create('FireflyIII\Models\Preference');
- $preference->data = $currency->code;
- $preference->save();
- $found = $this->object->getCurrencyByPreference($preference);
- $this->assertEquals($currency->id, $found->id);
- }
-
- /**
- * @covers FireflyIII\Repositories\Currency\CurrencyRepository::getCurrencyByPreference
- */
- public function testGetCurrencyByPreferenceNull()
- {
- FactoryMuffin::create('FireflyIII\Models\TransactionCurrency');
- $preference = FactoryMuffin::create('FireflyIII\Models\Preference');
- $preference->data = 'ABC';
- $preference->save();
- $found = $this->object->getCurrencyByPreference($preference);
- $this->assertEquals(1, $found->id); // EUR is first and will be set.
- }
-
- /**
- * @covers FireflyIII\Repositories\Currency\CurrencyRepository::store
- */
- public function testStore()
- {
- $data = [
- 'name' => 'Some Currency',
- 'code' => 'ABC',
- 'symbol' => 'S'
- ];
-
- $currency = $this->object->store($data);
- $this->assertEquals($data['name'], $currency->name);
- }
-
- /**
- * @covers FireflyIII\Repositories\Currency\CurrencyRepository::update
- */
- public function testUpdate()
- {
- $currency = FactoryMuffin::create('FireflyIII\Models\TransactionCurrency');
-
- $data = [
- 'name' => 'Some Currency',
- 'code' => 'ABC',
- 'symbol' => 'S'
- ];
-
- $newCurrency = $this->object->update($currency, $data);
- $this->assertEquals($data['name'], $newCurrency->name);
- $this->assertEquals($currency->id, $newCurrency->id);
- }
-}
diff --git a/tests/repositories/JournalRepositoryTest.php b/tests/repositories/JournalRepositoryTest.php
deleted file mode 100644
index 92dc3596f4..0000000000
--- a/tests/repositories/JournalRepositoryTest.php
+++ /dev/null
@@ -1,572 +0,0 @@
-object = new JournalRepository;
- parent::setUp();
- }
-
- /**
- * Tears down the fixture, for example, closes a network connection.
- * This method is called after a test is executed.
- */
- public function tearDown()
- {
- parent::tearDown();
- }
-
- /**
- * @covers FireflyIII\Repositories\Journal\JournalRepository::delete
- * @covers FireflyIII\Providers\EventServiceProvider::boot
- * @covers FireflyIII\Providers\EventServiceProvider::registerDeleteEvents
- */
- public function testDelete()
- {
- $journal = FactoryMuffin::create('FireflyIII\Models\TransactionJournal');
- $transaction = $journal->transactions[0];
- $this->object->delete($journal);
-
- $this->assertEquals(0, TransactionJournal::where('id', $journal->id)->whereNull('deleted_at')->count());
- $this->assertEquals(0, Transaction::where('id', $transaction->id)->whereNull('deleted_at')->count());
-
- }
-
- /**
- * @covers FireflyIII\Repositories\Journal\JournalRepository::first
- */
- public function testFirst()
- {
- $journal = FactoryMuffin::create('FireflyIII\Models\TransactionJournal');
- $this->be($journal->user);
-
- $first = $this->object->first();
-
- $this->assertEquals($journal->id, $first->id);
-
- }
-
- /**
- * @covers FireflyIII\Repositories\Journal\JournalRepository::getAmountBefore
- */
- public function testGetAmountBefore()
- {
- // create some accounts:
- $expense = FactoryMuffin::create('FireflyIII\Models\Account'); // expense
- FactoryMuffin::create('FireflyIII\Models\Account'); // revenue
- $asset = FactoryMuffin::create('FireflyIII\Models\Account'); // asset
-
- // transaction type
- $withdrawal = FactoryMuffin::create('FireflyIII\Models\TransactionType'); // withdrawal
-
- // create five journals with incrementing dates:
- $today = new Carbon('2015-01-01');
- $journal = null;
- for ($i = 0; $i < 5; $i++) {
- // create journal:
- $journal = FactoryMuffin::create('FireflyIII\Models\TransactionJournal');
- $journal->transaction_type_id = $withdrawal;
- $journal->date = $today;
- $journal->save();
-
- // update transactions:
- $journal->transactions[0]->amount = -100;
- $journal->transactions[0]->account_id = $asset->id;
- $journal->transactions[0]->save();
-
- $journal->transactions[1]->amount = 100;
- $journal->transactions[1]->account_id = $expense->id;
- $journal->transactions[1]->save();
-
- // connect to expense
- $today->addDay();
- }
-
-
- $before = $this->object->getAmountBefore($journal, $journal->transactions[1]);
- // five transactions, we check the last one, so amount should be 400.
- $this->assertEquals(400, $before);
- }
-
- /**
- * @covers FireflyIII\Repositories\Journal\JournalRepository::getJournalsOfType
- */
- public function testGetJournalsOfType()
- {
- $user = FactoryMuffin::create('FireflyIII\User');
- $type = FactoryMuffin::create('FireflyIII\Models\TransactionType');
- $this->be($user);
- $result = $this->object->getJournalsOfType($type);
- $this->assertCount(0, $result);
- }
-
- /**
- * @covers FireflyIII\Repositories\Journal\JournalRepository::getJournalsOfTypes
- */
- public function testGetJournalsOfTypes()
- {
- FactoryMuffin::create('FireflyIII\Models\TransactionType');
- FactoryMuffin::create('FireflyIII\Models\TransactionType');
- FactoryMuffin::create('FireflyIII\Models\TransactionType');
- $user = FactoryMuffin::create('FireflyIII\User');
- $this->be($user);
- $types = ['Withdrawal', 'Expense'];
- $set = $this->object->getJournalsOfTypes($types, 0, 1);
-
- $this->assertTrue($set instanceof LengthAwarePaginator);
- $this->assertEquals(1, $set->currentPage());
- }
-
- /**
- * @covers FireflyIII\Repositories\Journal\JournalRepository::getTransactionType
- */
- public function testGetTransactionType()
- {
- $type = FactoryMuffin::create('FireflyIII\Models\TransactionType');
- $otherType = $this->object->getTransactionType($type->type);
- $this->assertEquals($type->id, $otherType->id);
- }
-
- /**
- * @covers FireflyIII\Repositories\Journal\JournalRepository::getWithDate
- */
- public function testGetWithDate()
- {
- $journal = FactoryMuffin::create('FireflyIII\Models\TransactionJournal');
- $this->be($journal->user);
-
- $found = $this->object->getWithDate($journal->id, $journal->date);
-
- $this->assertEquals($journal->id, $found->id);
- }
-
- /**
- * @covers FireflyIII\Repositories\Journal\JournalRepository::saveTags
- */
- public function testSaveTags()
- {
- $journal = FactoryMuffin::create('FireflyIII\Models\TransactionJournal');
- $tags = ['one', 'two', 'three'];
- $this->be($journal->user);
-
- $this->object->saveTags($journal, $tags);
-
- $this->assertCount(3, $journal->tags()->get());
- }
-
- /**
- * @covers FireflyIII\Repositories\Journal\JournalRepository::store
- * @covers FireflyIII\Repositories\Journal\JournalRepository::storeAccounts
- * @covers FireflyIII\Repositories\Journal\JournalRepository::storeWithdrawalAccounts
- * @covers FireflyIII\Repositories\Journal\JournalRepository::storeDepositAccounts
- */
- public function testStore()
- {
- FactoryMuffin::create('FireflyIII\Models\TransactionType');
- $currency = FactoryMuffin::create('FireflyIII\Models\TransactionCurrency');
- $budget = FactoryMuffin::create('FireflyIII\Models\Budget');
- $account1 = FactoryMuffin::create('FireflyIII\Models\Account');
- $user = FactoryMuffin::create('FireflyIII\User');
- $data = [
- 'description' => 'Some journal ' . rand(1, 100),
- 'user' => $user->id,
- 'what' => 'withdrawal',
- 'amount_currency_id' => $currency->id,
- 'account_id' => $account1->id,
- 'expense_account' => 'Some expense account',
- 'date' => '2014-01-01',
- 'category' => 'Some category',
- 'budget_id' => $budget->id,
- 'amount' => 100,
- 'tags' => ['one', 'two', 'three']
-
-
- ];
-
- $journal = $this->object->store($data);
-
- $this->assertEquals($data['description'], $journal->description);
- }
-
- /**
- * @covers FireflyIII\Repositories\Journal\JournalRepository::store
- * @covers FireflyIII\Repositories\Journal\JournalRepository::storeAccounts
- * @covers FireflyIII\Repositories\Journal\JournalRepository::storeWithdrawalAccounts
- * @covers FireflyIII\Repositories\Journal\JournalRepository::storeDepositAccounts
- */
- public function testStoreDeposit()
- {
- for ($i = 0; $i < 4; $i++) {
- FactoryMuffin::create('FireflyIII\Models\AccountType');
- }
- FactoryMuffin::create('FireflyIII\Models\TransactionType');
- FactoryMuffin::create('FireflyIII\Models\TransactionType');
-
- $currency = FactoryMuffin::create('FireflyIII\Models\TransactionCurrency');
- $budget = FactoryMuffin::create('FireflyIII\Models\Budget');
- $account1 = FactoryMuffin::create('FireflyIII\Models\Account');
- $user = FactoryMuffin::create('FireflyIII\User');
- $data = [
- 'description' => 'Some journal ' . rand(1, 100),
- 'user' => $user->id,
- 'what' => 'deposit',
- 'amount_currency_id' => $currency->id,
- 'account_id' => $account1->id,
- 'revenue_account' => 'Some revenue account',
- 'date' => '2014-01-01',
- 'category' => 'Some category',
- 'budget_id' => $budget->id,
- 'amount' => 100,
- 'tags' => ['one', 'two', 'three']
-
-
- ];
-
- $journal = $this->object->store($data);
-
- $this->assertEquals($data['description'], $journal->description);
- }
-
- /**
- * @covers FireflyIII\Repositories\Journal\JournalRepository::store
- * @covers FireflyIII\Repositories\Journal\JournalRepository::storeAccounts
- * @covers FireflyIII\Repositories\Journal\JournalRepository::storeWithdrawalAccounts
- * @covers FireflyIII\Repositories\Journal\JournalRepository::storeDepositAccounts
- */
- public function testStoreExpenseWithCash()
- {
- for ($i = 0; $i < 4; $i++) {
- FactoryMuffin::create('FireflyIII\Models\AccountType');
- }
-
- FactoryMuffin::create('FireflyIII\Models\TransactionType');
- $currency = FactoryMuffin::create('FireflyIII\Models\TransactionCurrency');
- $budget = FactoryMuffin::create('FireflyIII\Models\Budget');
- $account1 = FactoryMuffin::create('FireflyIII\Models\Account');
- $user = FactoryMuffin::create('FireflyIII\User');
- $data = [
- 'description' => 'Some journal ' . rand(1, 100),
- 'user' => $user->id,
- 'what' => 'withdrawal',
- 'amount_currency_id' => $currency->id,
- 'account_id' => $account1->id,
- 'expense_account' => '',
- 'date' => '2014-01-01',
- 'category' => 'Some other category',
- 'budget_id' => $budget->id,
- 'amount' => 100,
- 'tags' => ['one', 'two', 'three']
-
-
- ];
-
- $journal = $this->object->store($data);
-
- $this->assertEquals($data['description'], $journal->description);
- }
-
- /**
- * @covers FireflyIII\Repositories\Journal\JournalRepository::store
- * @covers FireflyIII\Repositories\Journal\JournalRepository::storeAccounts
- * @covers FireflyIII\Repositories\Journal\JournalRepository::storeWithdrawalAccounts
- * @covers FireflyIII\Repositories\Journal\JournalRepository::storeDepositAccounts
- * @expectedException Symfony\Component\HttpKernel\Exception\HttpException
- */
- public function testStoreInvalidFromAccount()
- {
- for ($i = 0; $i < 4; $i++) {
- FactoryMuffin::create('FireflyIII\Models\AccountType');
- }
-
- FactoryMuffin::create('FireflyIII\Models\TransactionType');
- FactoryMuffin::create('FireflyIII\Models\TransactionType');
- FactoryMuffin::create('FireflyIII\Models\TransactionType');
- $currency = FactoryMuffin::create('FireflyIII\Models\TransactionCurrency');
- $budget = FactoryMuffin::create('FireflyIII\Models\Budget');
- $account1 = FactoryMuffin::create('FireflyIII\Models\Account');
- $user = FactoryMuffin::create('FireflyIII\User');
- $data = [
- 'description' => 'Some journal ' . rand(1, 100),
- 'user' => $user->id,
- 'what' => 'transfer',
- 'amount_currency_id' => $currency->id,
- 'account_from_id' => $account1->id,
- 'account_to_id' => 17,
- 'date' => '2014-01-01',
- 'category' => 'Some other category',
- 'budget_id' => $budget->id,
- 'amount' => 100,
- 'tags' => ['one', 'two', 'three']
-
-
- ];
-
- $journal = $this->object->store($data);
-
- $this->assertEquals($data['description'], $journal->description);
- }
-
- /**
- * @covers FireflyIII\Repositories\Journal\JournalRepository::store
- * @covers FireflyIII\Repositories\Journal\JournalRepository::storeAccounts
- * @covers FireflyIII\Repositories\Journal\JournalRepository::storeWithdrawalAccounts
- * @covers FireflyIII\Repositories\Journal\JournalRepository::storeDepositAccounts
- * @expectedException Symfony\Component\HttpKernel\Exception\HttpException
- */
- public function testStoreInvalidToAccount()
- {
- for ($i = 0; $i < 4; $i++) {
- FactoryMuffin::create('FireflyIII\Models\AccountType');
- }
-
- FactoryMuffin::create('FireflyIII\Models\TransactionType');
- FactoryMuffin::create('FireflyIII\Models\TransactionType');
- FactoryMuffin::create('FireflyIII\Models\TransactionType');
- $currency = FactoryMuffin::create('FireflyIII\Models\TransactionCurrency');
- $budget = FactoryMuffin::create('FireflyIII\Models\Budget');
- $account1 = FactoryMuffin::create('FireflyIII\Models\Account');
- $user = FactoryMuffin::create('FireflyIII\User');
- $data = [
- 'description' => 'Some journal ' . rand(1, 100),
- 'user' => $user->id,
- 'what' => 'transfer',
- 'amount_currency_id' => $currency->id,
- 'account_from_id' => 17,
- 'account_to_id' => $account1->id,
- 'date' => '2014-01-01',
- 'category' => 'Some other category',
- 'budget_id' => $budget->id,
- 'amount' => 100,
- 'tags' => ['one', 'two', 'three']
-
-
- ];
-
- $journal = $this->object->store($data);
-
- $this->assertEquals($data['description'], $journal->description);
- }
-
- /**
- * @covers FireflyIII\Repositories\Journal\JournalRepository::store
- * @covers FireflyIII\Repositories\Journal\JournalRepository::storeAccounts
- * @covers FireflyIII\Repositories\Journal\JournalRepository::storeWithdrawalAccounts
- * @covers FireflyIII\Repositories\Journal\JournalRepository::storeDepositAccounts
- */
- public function testStoreRevenueWithCash()
- {
- for ($i = 0; $i < 4; $i++) {
- FactoryMuffin::create('FireflyIII\Models\AccountType');
- }
-
- FactoryMuffin::create('FireflyIII\Models\TransactionType');
- FactoryMuffin::create('FireflyIII\Models\TransactionType');
- $currency = FactoryMuffin::create('FireflyIII\Models\TransactionCurrency');
- $budget = FactoryMuffin::create('FireflyIII\Models\Budget');
- $account1 = FactoryMuffin::create('FireflyIII\Models\Account');
- $user = FactoryMuffin::create('FireflyIII\User');
- $data = [
- 'description' => 'Some journal ' . rand(1, 100),
- 'user' => $user->id,
- 'what' => 'deposit',
- 'amount_currency_id' => $currency->id,
- 'account_id' => $account1->id,
- 'revenue_account' => '',
- 'date' => '2014-01-01',
- 'category' => 'Some other category',
- 'budget_id' => $budget->id,
- 'amount' => 100,
- 'tags' => ['one', 'two', 'three']
-
-
- ];
-
- $journal = $this->object->store($data);
-
- $this->assertEquals($data['description'], $journal->description);
- }
-
- /**
- * @covers FireflyIII\Repositories\Journal\JournalRepository::store
- * @covers FireflyIII\Repositories\Journal\JournalRepository::storeAccounts
- * @covers FireflyIII\Repositories\Journal\JournalRepository::storeWithdrawalAccounts
- * @covers FireflyIII\Repositories\Journal\JournalRepository::storeDepositAccounts
- */
- public function testStoreTransfer()
- {
- for ($i = 0; $i < 4; $i++) {
- FactoryMuffin::create('FireflyIII\Models\AccountType');
- }
-
- FactoryMuffin::create('FireflyIII\Models\TransactionType');
- FactoryMuffin::create('FireflyIII\Models\TransactionType');
- FactoryMuffin::create('FireflyIII\Models\TransactionType');
- $currency = FactoryMuffin::create('FireflyIII\Models\TransactionCurrency');
- $budget = FactoryMuffin::create('FireflyIII\Models\Budget');
- $account1 = FactoryMuffin::create('FireflyIII\Models\Account');
- $account2 = FactoryMuffin::create('FireflyIII\Models\Account');
- $user = FactoryMuffin::create('FireflyIII\User');
- $data = [
- 'description' => 'Some journal ' . rand(1, 100),
- 'user' => $user->id,
- 'what' => 'transfer',
- 'amount_currency_id' => $currency->id,
- 'account_from_id' => $account1->id,
- 'account_to_id' => $account2->id,
- 'date' => '2014-01-01',
- 'category' => 'Some other category',
- 'budget_id' => $budget->id,
- 'amount' => 100,
- 'tags' => ['one', 'two', 'three']
-
-
- ];
-
- $journal = $this->object->store($data);
-
- $this->assertEquals($data['description'], $journal->description);
- }
-
- /**
- * @covers FireflyIII\Repositories\Journal\JournalRepository::update
- * @covers FireflyIII\Repositories\Journal\JournalRepository::updateTags
- * @SuppressWarnings(PHPMD.ExcessiveMethodLength)
- */
- public function testUpdate()
- {
- $user = FactoryMuffin::create('FireflyIII\User');
- $this->be($user);
-
- for ($i = 0; $i < 4; $i++) {
- FactoryMuffin::create('FireflyIII\Models\AccountType');
- }
-
- FactoryMuffin::create('FireflyIII\Models\TransactionType');
- FactoryMuffin::create('FireflyIII\Models\TransactionType');
- $journal = FactoryMuffin::create('FireflyIII\Models\TransactionJournal');
- $currency = FactoryMuffin::create('FireflyIII\Models\TransactionCurrency');
- $budget = FactoryMuffin::create('FireflyIII\Models\Budget');
- $account1 = FactoryMuffin::create('FireflyIII\Models\Account');
- $account2 = FactoryMuffin::create('FireflyIII\Models\Account');
-
- // two transactions
- Transaction::create(
- [
- 'account_id' => $account1->id,
- 'transaction_journal_id' => $journal->id,
- 'amount' => 100,
- ]
- );
- Transaction::create(
- [
- 'account_id' => $account1->id,
- 'transaction_journal_id' => $journal->id,
- 'amount' => -100,
- ]
- );
-
-
- $data = [
- 'amount_currency_id' => $currency->id,
- 'description' => 'New description ' . rand(1, 100),
- 'date' => '2015-01-01',
- 'category' => 'SomenewCat',
- 'amount' => 50,
- 'user' => $journal->user_id,
- 'budget_id' => $budget->id,
- 'account_from_id' => $account1->id,
- 'account_to_id' => $account2->id,
- 'revenue_account' => 'Some revenue account',
- 'expense_account' => 'Some expense account',
- 'tags' => ['a', 'b', 'c']
-
- ];
-
- $result = $this->object->update($journal, $data);
-
- $this->assertEquals($result->description, $data['description']);
- $this->assertEquals($result->amount, 50);
- }
-
- /**
- * @covers FireflyIII\Repositories\Journal\JournalRepository::update
- * @covers FireflyIII\Repositories\Journal\JournalRepository::updateTags
- * @SuppressWarnings(PHPMD.ExcessiveMethodLength)
- */
- public function testUpdateNoTags()
- {
- $user = FactoryMuffin::create('FireflyIII\User');
- $this->be($user);
-
- for ($i = 0; $i < 4; $i++) {
- FactoryMuffin::create('FireflyIII\Models\AccountType');
- }
-
- FactoryMuffin::create('FireflyIII\Models\TransactionType');
- FactoryMuffin::create('FireflyIII\Models\TransactionType');
- $journal = FactoryMuffin::create('FireflyIII\Models\TransactionJournal');
- $currency = FactoryMuffin::create('FireflyIII\Models\TransactionCurrency');
- $budget = FactoryMuffin::create('FireflyIII\Models\Budget');
- $account1 = FactoryMuffin::create('FireflyIII\Models\Account');
- $account2 = FactoryMuffin::create('FireflyIII\Models\Account');
-
- // two transactions
- Transaction::create(
- [
- 'account_id' => $account1->id,
- 'transaction_journal_id' => $journal->id,
- 'amount' => 100,
- ]
- );
- Transaction::create(
- [
- 'account_id' => $account1->id,
- 'transaction_journal_id' => $journal->id,
- 'amount' => -100,
- ]
- );
-
-
- $data = [
- 'amount_currency_id' => $currency->id,
- 'description' => 'New description ' . rand(1, 100),
- 'date' => '2015-01-01',
- 'category' => 'SomenewCat',
- 'amount' => 50,
- 'user' => $journal->user_id,
- 'budget_id' => $budget->id,
- 'account_from_id' => $account1->id,
- 'account_to_id' => $account2->id,
- 'revenue_account' => 'Some revenue account',
- 'expense_account' => 'Some expense account',
- 'tags' => []
-
- ];
-
- $result = $this->object->update($journal, $data);
-
- $this->assertEquals($result->description, $data['description']);
- $this->assertEquals($result->amount, 50);
- }
-
-}
diff --git a/tests/repositories/PiggyBankRepositoryTest.php b/tests/repositories/PiggyBankRepositoryTest.php
deleted file mode 100644
index 79c9079c4e..0000000000
--- a/tests/repositories/PiggyBankRepositoryTest.php
+++ /dev/null
@@ -1,196 +0,0 @@
-object = new PiggyBankRepository;
- parent::setUp();
- }
-
- /**
- * Tears down the fixture, for example, closes a network connection.
- * This method is called after a test is executed.
- */
- public function tearDown()
- {
- parent::tearDown();
- }
-
- /**
- * @covers FireflyIII\Repositories\PiggyBank\PiggyBankRepository::createEvent
- */
- public function testCreateEvent()
- {
- $piggyBank = FactoryMuffin::create('FireflyIII\Models\PiggyBank');
- $this->object->createEvent($piggyBank, 100);
-
- $this->assertCount(1, $piggyBank->piggybankevents()->get());
- }
-
-
- /**
- * @covers FireflyIII\Repositories\PiggyBank\PiggyBankRepository::destroy
- * @covers FireflyIII\Providers\EventServiceProvider::boot
- * @covers FireflyIII\Providers\EventServiceProvider::registerDeleteEvents
- */
- public function testDestroy()
- {
- $piggyBank = FactoryMuffin::create('FireflyIII\Models\PiggyBank');
-
- $this->object->destroy($piggyBank);
-
- $this->assertCount(0, PiggyBank::where('id', $piggyBank->id)->whereNull('deleted_at')->get());
-
- }
-
- /**
- * @covers FireflyIII\Repositories\PiggyBank\PiggyBankRepository::getEventSummarySet
- */
- public function testGetEventSummarySet()
- {
- $piggyBank = FactoryMuffin::create('FireflyIII\Models\PiggyBank');
- $set = $this->object->getEventSummarySet($piggyBank);
-
- $this->assertCount(0, $set);
- }
-
- /**
- * @covers FireflyIII\Repositories\PiggyBank\PiggyBankRepository::getEvents
- */
- public function testGetEvents()
- {
- $piggyBank = FactoryMuffin::create('FireflyIII\Models\PiggyBank');
- $set = $this->object->getEvents($piggyBank);
-
- $this->assertCount(0, $set);
- }
-
- /**
- * @covers FireflyIII\Repositories\PiggyBank\PiggyBankRepository::getPiggyBanks
- */
- public function testGetPiggyBanks()
- {
- $piggyBank = FactoryMuffin::create('FireflyIII\Models\PiggyBank');
- $this->be($piggyBank->account->user);
- $set = $this->object->getPiggyBanks();
-
- $this->assertCount(1, $set);
- }
-
- /**
- * @covers FireflyIII\Repositories\PiggyBank\PiggyBankRepository::reset
- */
- public function testReset()
- {
- $piggyBank = FactoryMuffin::create('FireflyIII\Models\PiggyBank');
- $piggyBank->order = 4;
- $piggyBank->save();
- $this->be($piggyBank->account->user);
- $this->object->reset();
-
- $this->assertCount(1, PiggyBank::where('order', 0)->get());
- }
-
- /**
- * @covers FireflyIII\Repositories\PiggyBank\PiggyBankRepository::setOrder
- */
- public function testSetOrder()
- {
- $piggyBank = FactoryMuffin::create('FireflyIII\Models\PiggyBank');
- $piggyBank->order = 4;
- $this->be($piggyBank->account->user);
- $piggyBank->save();
-
- $this->object->setOrder($piggyBank->id, 3);
- $newPiggy = PiggyBank::find($piggyBank->id);
- $this->assertEquals(3, $newPiggy->order);
- }
-
- /**
- * @covers FireflyIII\Repositories\PiggyBank\PiggyBankRepository::store
- * @covers FireflyIII\Providers\EventServiceProvider::boot
- * @covers FireflyIII\Providers\EventServiceProvider::registerCreateEvents
- */
- public function testStore()
- {
- $account = FactoryMuffin::create('FireflyIII\Models\Account');
-
- $data = [
- 'account_id' => $account->id,
- 'name' => 'Some piggy',
- 'targetamount' => 100,
- 'order' => 1,
- 'remind_me' => false,
- 'reminder_skip' => 0,
-
- ];
-
- $piggyBank = $this->object->store($data);
-
- $this->assertEquals(1, $piggyBank->id);
- }
-
- /**
- * @covers FireflyIII\Repositories\PiggyBank\PiggyBankRepository::store
- * @covers FireflyIII\Providers\EventServiceProvider::boot
- * @covers FireflyIII\Providers\EventServiceProvider::registerCreateEvents
- */
- public function testStoreRedirect()
- {
- $account = FactoryMuffin::create('FireflyIII\Models\Account');
-
- $data = [
- 'account_id' => $account->id,
- 'name' => 'Some piggy',
- 'targetamount' => 100,
- 'create_another' => 1,
- 'order' => 1,
- 'remind_me' => false,
- 'reminder_skip' => 0,
-
- ];
-
- $piggyBank = $this->object->store($data);
-
- $this->assertEquals(1, $piggyBank->id);
- }
-
- /**
- * @covers FireflyIII\Repositories\PiggyBank\PiggyBankRepository::update
- */
- public function testUpdate()
- {
- $piggyBank = FactoryMuffin::create('FireflyIII\Models\PiggyBank');
-
- $data = [
- 'name' => 'Update piggy ' . rand(1, 100),
- 'account_id' => $piggyBank->account_id,
- 'targetamount' => 101,
- 'targetdate' => new Carbon,
- 'startdate' => new Carbon,
- ];
-
- $new = $this->object->update($piggyBank, $data);
-
- $this->assertEquals($data['name'], $new->name);
- $this->assertEquals($piggyBank->id, $new->id);
- }
-}
diff --git a/tests/repositories/TagRepositoryBasicTest.php b/tests/repositories/TagRepositoryBasicTest.php
deleted file mode 100644
index b49857ed34..0000000000
--- a/tests/repositories/TagRepositoryBasicTest.php
+++ /dev/null
@@ -1,182 +0,0 @@
-object = new TagRepository;
- parent::setUp();
- }
-
- /**
- * Tears down the fixture, for example, closes a network connection.
- * This method is called after a test is executed.
- */
- public function tearDown()
- {
- parent::tearDown();
- }
- /**
- * @covers FireflyIII\Repositories\Tag\TagRepository::update
- */
- public function testUpdate()
- {
- $tag = FactoryMuffin::create('FireflyIII\Models\Tag');
-
-
- $data = [
- 'tag' => 'Hello' . rand(1, 100),
- 'date' => '2012-01-01',
- 'description' => 'Some',
- 'latitude' => 12,
- 'longitude' => 13,
- 'zoomLevel' => 4,
- 'tagMode' => 'nothing'
- ];
- $this->be($tag->user);
-
- $newTag = $this->object->update($tag, $data);
- $this->assertEquals($data['tag'], $newTag->tag);
- $this->assertEquals($tag->id, $newTag->id);
- }
-
- /**
- * @covers FireflyIII\Repositories\Tag\TagRepository::store
- */
- public function testStore()
- {
- $user = FactoryMuffin::create('FireflyIII\User');
-
- $data = [
- 'tag' => 'Hello' . rand(1, 100),
- 'date' => '2012-01-01',
- 'description' => 'Some',
- 'latitude' => 12,
- 'longitude' => 13,
- 'zoomLevel' => 4,
- 'tagMode' => 'nothing'
- ];
- $this->be($user);
-
- $tag = $this->object->store($data);
- $this->assertEquals($data['tag'], $tag->tag);
- }
-
-
- /**
- * @covers FireflyIII\Repositories\Tag\TagRepository::destroy
- */
- public function testDestroy()
- {
- $tag = FactoryMuffin::create('FireflyIII\Models\Tag');
- $this->object->destroy($tag);
-
- $this->assertCount(0, Tag::where('id', $tag->id)->whereNull('deleted_at')->get());
-
- }
-
- /**
- * @covers FireflyIII\Repositories\Tag\TagRepository::get
- */
- public function testGet()
- {
- $user = FactoryMuffin::create('FireflyIII\User');
- $tag1 = FactoryMuffin::create('FireflyIII\Models\Tag');
- $tag2 = FactoryMuffin::create('FireflyIII\Models\Tag');
- $tag1->tag = 'BBB';
- $tag2->tag = 'AAA';
- $tag1->user_id = $user->id;
- $tag2->user_id = $user->id;
-
- $tag1->save();
- $tag2->save();
-
- $this->be($user);
-
- $set = $this->object->get();
-
- $this->assertCount(2, $set);
- $this->assertEquals('AAA', $set->first()->tag);
- }
-
-
- /**
- * @covers FireflyIII\Repositories\Tag\TagRepository::coveredByBalancingActs
- */
- public function testCoveredByBalancingActs()
- {
- // create a user:
- $user = FactoryMuffin::create('FireflyIII\User');
- $this->be($user);
-
- // create transaction and account types:
- FactoryMuffin::create('FireflyIII\Models\TransactionType'); // withdrawal
- FactoryMuffin::create('FireflyIII\Models\TransactionType'); // deposit
- $transfer = FactoryMuffin::create('FireflyIII\Models\TransactionType'); // transfer
- FactoryMuffin::create('FireflyIII\Models\AccountType'); // expense
- FactoryMuffin::create('FireflyIII\Models\AccountType'); // revenue
- $asset = FactoryMuffin::create('FireflyIII\Models\AccountType'); // asset
-
- // create two accounts:
- $fromAccount = FactoryMuffin::create('FireflyIII\Models\Account'); // asset
- $toAccount = FactoryMuffin::create('FireflyIII\Models\Account'); // asset
- $fromAccount->account_type_id = $asset->id;
- $toAccount->account_type_id = $asset->id;
- $fromAccount->save();
- $toAccount->save();
-
-
- // create a tag
- $tag = FactoryMuffin::create('FireflyIII\Models\Tag');
- $tag->tagMode = 'balancingAct';
- $tag->user_id = $user->id;
- $tag->save();
-
- // date
- $today = new Carbon('2014-01-12');
- $start = new Carbon('2014-01-01');
- $end = new Carbon('2014-01-31');
-
- // store five journals
- for ($i = 0; $i < 5; $i++) {
- $journal = FactoryMuffin::create('FireflyIII\Models\TransactionJournal'); // deposit!
- // set date:
- $journal->date = $today;
- $journal->user_id = $user->id;
- $journal->transaction_type_id = $transfer->id;
- $journal->tags()->save($tag);
- $journal->save();
-
- // update accounts:
- $journal->transactions[0]->account_id = $fromAccount->id;
- $journal->transactions[0]->amount = '-100';
- $journal->transactions[0]->save();
- $journal->transactions[1]->account_id = $toAccount->id;
- $journal->transactions[1]->amount = '100';
- $journal->transactions[1]->save();
-
- }
-
- $amount = $this->object->coveredByBalancingActs($toAccount, $start, $end);
- // five transactions, 100 each.
- $this->assertEquals('500', $amount);
- }
-
-}
diff --git a/tests/repositories/TagRepositoryTest.php b/tests/repositories/TagRepositoryTest.php
deleted file mode 100644
index bcd763cd00..0000000000
--- a/tests/repositories/TagRepositoryTest.php
+++ /dev/null
@@ -1,656 +0,0 @@
-object = new TagRepository;
- parent::setUp();
- }
-
- /**
- * Tears down the fixture, for example, closes a network connection.
- * This method is called after a test is executed.
- */
- public function tearDown()
- {
- parent::tearDown();
- }
-
- /**
- * Already connected tag and transaction journal returns FALSE.
- *
- * @covers FireflyIII\Repositories\Tag\TagRepository::connect
- */
- public function testConnectAlreadyConnected()
- {
- $journal = FactoryMuffin::create('FireflyIII\Models\TransactionJournal');
- $tag = FactoryMuffin::create('FireflyIII\Models\Tag');
- $journal->tags()->save($tag);
-
- $result = $this->object->connect($journal, $tag);
- $this->assertFalse($result);
-
- }
-
- /**
- * A deposit cannot be connected to a balancing act.
- *
- * @covers FireflyIII\Repositories\Tag\TagRepository::connect
- * @covers FireflyIII\Repositories\Tag\TagRepository::connectBalancingAct
- */
- public function testConnectBalancingOneDeposit()
- {
- FactoryMuffin::create('FireflyIII\Models\TransactionType');
- $deposit = FactoryMuffin::create('FireflyIII\Models\TransactionType');
- FactoryMuffin::create('FireflyIII\Models\TransactionType');
-
- $journal = FactoryMuffin::create('FireflyIII\Models\TransactionJournal');
- $tag = FactoryMuffin::create('FireflyIII\Models\Tag');
-
- $journal->transaction_type_id = $deposit->id;
- $tag->tagMode = 'balancingAct';
-
- $tag->save();
- $journal->save();
-
- $result = $this->object->connect($journal, $tag);
- $this->assertFalse($result);
-
- }
-
- /**
- * Connecting a single transfer to a balancing act is possible if there are no
- * other transfers already connected.
- *
- * @covers FireflyIII\Repositories\Tag\TagRepository::connect
- * @covers FireflyIII\Repositories\Tag\TagRepository::connectBalancingAct
- */
- public function testConnectBalancingOneTransfer()
- {
- FactoryMuffin::create('FireflyIII\Models\TransactionType');
- FactoryMuffin::create('FireflyIII\Models\TransactionType');
- $transfer = FactoryMuffin::create('FireflyIII\Models\TransactionType');
-
- $journal = FactoryMuffin::create('FireflyIII\Models\TransactionJournal');
- $tag = FactoryMuffin::create('FireflyIII\Models\Tag');
-
- $journal->transaction_type_id = $transfer->id;
- $tag->tagMode = 'balancingAct';
-
- $tag->save();
- $journal->save();
-
- $result = $this->object->connect($journal, $tag);
- $this->assertTrue($result);
-
- }
-
- /**
- * Connecting a single withdrawal to a balancing act is possible if there are
- * not other withdrawals already connected.
- *
- * @covers FireflyIII\Repositories\Tag\TagRepository::connect
- * @covers FireflyIII\Repositories\Tag\TagRepository::connectBalancingAct
- */
- public function testConnectBalancingOneWithdrawal()
- {
- $withdrawal = FactoryMuffin::create('FireflyIII\Models\TransactionType');
- FactoryMuffin::create('FireflyIII\Models\TransactionType');
- FactoryMuffin::create('FireflyIII\Models\TransactionType');
-
- $journal = FactoryMuffin::create('FireflyIII\Models\TransactionJournal');
- $tag = FactoryMuffin::create('FireflyIII\Models\Tag');
-
- $journal->transaction_type_id = $withdrawal->id;
- $tag->tagMode = 'balancingAct';
-
- $tag->save();
- $journal->save();
-
- $result = $this->object->connect($journal, $tag);
- $this->assertTrue($result);
-
- }
-
- /**
- * Default connection between a journal and a tag.
- *
- * @covers FireflyIII\Repositories\Tag\TagRepository::connect
- */
- public function testConnectDefault()
- {
- $journal = FactoryMuffin::create('FireflyIII\Models\TransactionJournal');
- $tag = FactoryMuffin::create('FireflyIII\Models\Tag');
- $tag->tagMode = 'nothing';
- $tag->save();
-
- $result = $this->object->connect($journal, $tag);
- $this->assertTrue($result);
-
- }
-
- /**
- * Fallback for connect then the tag mode is unknown
- *
- * @covers FireflyIII\Repositories\Tag\TagRepository::connect
- */
- public function testConnectInvalidType()
- {
- $journal = FactoryMuffin::create('FireflyIII\Models\TransactionJournal');
- $tag = FactoryMuffin::create('FireflyIII\Models\Tag');
- $tag->tagMode = 'Idontknow';
- $tag->save();
-
- $result = $this->object->connect($journal, $tag);
- $this->assertFalse($result);
-
- }
-
- /**
- * Once one or more journals have been accepted by the tag, others must match the asset account
- * id. For this to work, we must also create an asset account, and a transaction.
- *
- * Connecting a deposit to a tag that already has a withdrawal.
- *
- * @covers FireflyIII\Repositories\Tag\TagRepository::connect
- * @covers FireflyIII\Repositories\Tag\TagRepository::connectAdvancePayment
- * @covers FireflyIII\Repositories\Tag\TagRepository::matchAll
- */
- public function testConnectPaymentMultipleMatch()
- {
- $user = FactoryMuffin::create('FireflyIII\User');
- $this->be($user);
-
- $withdrawal = FactoryMuffin::create('FireflyIII\Models\TransactionType');
- $deposit = FactoryMuffin::create('FireflyIII\Models\TransactionType');
- FactoryMuffin::create('FireflyIII\Models\TransactionType');
-
- FactoryMuffin::create('FireflyIII\Models\AccountType');
- FactoryMuffin::create('FireflyIII\Models\AccountType');
- $asset = FactoryMuffin::create('FireflyIII\Models\AccountType');
-
- $account = FactoryMuffin::create('FireflyIII\Models\Account');
-
-
- $journal1 = FactoryMuffin::create('FireflyIII\Models\TransactionJournal');
- $journal2 = FactoryMuffin::create('FireflyIII\Models\TransactionJournal');
-
- // transactions for both:
- $journal1->transactions[0]->account_id = $account->id;
- $journal2->transactions[0]->account_id = $account->id;
- $journal1->transactions[1]->account_id = $account->id;
- $journal2->transactions[1]->account_id = $account->id;
- $journal1->transactions[0]->save();
- $journal2->transactions[0]->save();
- $journal1->transactions[1]->save();
- $journal2->transactions[1]->save();
-
- $tag = FactoryMuffin::create('FireflyIII\Models\Tag');
-
- $journal1->transaction_type_id = $withdrawal->id;
- $journal2->transaction_type_id = $deposit->id;
- $tag->tagMode = 'advancePayment';
- $account->account_type_id = $asset->id;
-
- $tag->save();
- $journal1->save();
- $journal2->save();
- $account->save();
- // connect journal1:
-
- $journal1->tags()->save($tag);
-
- $result = $this->object->connect($journal2, $tag);
-
- $this->assertTrue($result);
-
- }
-
- /**
- * Once one or more journals have been accepted by the tag, others must match the asset account
- * id. For this to work, we must also create an asset account, and a transaction.
- *
- * This covers the advance payment
- *
- * @SuppressWarnings(PHPMD.ExcessiveMethodLength)
- * @covers FireflyIII\Repositories\Tag\TagRepository::connect
- * @covers FireflyIII\Repositories\Tag\TagRepository::connectAdvancePayment
- * @covers FireflyIII\Repositories\Tag\TagRepository::matchAll
- */
- public function testConnectPaymentNoMatch()
- {
- $user = FactoryMuffin::create('FireflyIII\User');
- $this->be($user);
-
- $withdrawal = FactoryMuffin::create('FireflyIII\Models\TransactionType');
- $deposit = FactoryMuffin::create('FireflyIII\Models\TransactionType');
- FactoryMuffin::create('FireflyIII\Models\TransactionType');
-
- FactoryMuffin::create('FireflyIII\Models\AccountType');
- FactoryMuffin::create('FireflyIII\Models\AccountType');
- $asset = FactoryMuffin::create('FireflyIII\Models\AccountType');
-
- $account1 = FactoryMuffin::create('FireflyIII\Models\Account');
- $account2 = FactoryMuffin::create('FireflyIII\Models\Account');
-
-
- $journal1 = FactoryMuffin::create('FireflyIII\Models\TransactionJournal');
- $journal2 = FactoryMuffin::create('FireflyIII\Models\TransactionJournal');
-
- // transactions for both:
- $journal1->transactions[0]->account_id = $account1->id;
- $journal2->transactions[0]->account_id = $account2->id;
- $journal1->transactions[1]->account_id = $account1->id;
- $journal2->transactions[1]->account_id = $account2->id;
- $journal1->transactions[0]->save();
- $journal2->transactions[0]->save();
- $journal1->transactions[1]->save();
- $journal2->transactions[1]->save();
-
-
- $tag = FactoryMuffin::create('FireflyIII\Models\Tag');
-
- $journal1->transaction_type_id = $withdrawal->id;
- $journal2->transaction_type_id = $deposit->id;
- $tag->tagMode = 'advancePayment';
- $account1->account_type_id = $asset->id;
- $account2->account_type_id = $asset->id;
-
- $tag->save();
- $journal1->save();
- $journal2->save();
- $account1->save();
- $account2->save();
- // connect journal1:
- $journal1->tags()->save($tag);
-
- $result = $this->object->connect($journal2, $tag);
- // account1 and account2 are different, so false:
- $this->assertFalse($result);
-
- }
-
- /**
- * Once one or more journals have been accepted by the tag, others must match the asset account
- * id. For this to work, we must also create an asset account, and a transaction.
- *
- * This covers the advance payment
- *
- * @SuppressWarnings(PHPMD.ExcessiveMethodLength)
- * @covers FireflyIII\Repositories\Tag\TagRepository::connect
- * @covers FireflyIII\Repositories\Tag\TagRepository::connectAdvancePayment
- * @covers FireflyIII\Repositories\Tag\TagRepository::matchAll
- */
- public function testConnectPaymentNoMatchDeposit()
- {
- $user = FactoryMuffin::create('FireflyIII\User');
- $this->be($user);
-
- $withdrawal = FactoryMuffin::create('FireflyIII\Models\TransactionType');
- $deposit = FactoryMuffin::create('FireflyIII\Models\TransactionType');
- FactoryMuffin::create('FireflyIII\Models\TransactionType');
-
- FactoryMuffin::create('FireflyIII\Models\AccountType');
- FactoryMuffin::create('FireflyIII\Models\AccountType');
- $asset = FactoryMuffin::create('FireflyIII\Models\AccountType');
-
- $account1 = FactoryMuffin::create('FireflyIII\Models\Account');
- $account2 = FactoryMuffin::create('FireflyIII\Models\Account');
-
-
- $journal1 = FactoryMuffin::create('FireflyIII\Models\TransactionJournal');
- $journal2 = FactoryMuffin::create('FireflyIII\Models\TransactionJournal');
-
- // transactions for both:
- $journal1->transactions[0]->account_id = $account1->id;
- $journal2->transactions[0]->account_id = $account2->id;
- $journal1->transactions[1]->account_id = $account1->id;
- $journal2->transactions[1]->account_id = $account2->id;
- $journal1->transactions[0]->save();
- $journal2->transactions[0]->save();
- $journal1->transactions[1]->save();
- $journal2->transactions[1]->save();
-
-
- $tag = FactoryMuffin::create('FireflyIII\Models\Tag');
-
- $journal1->transaction_type_id = $withdrawal->id;
- $journal2->transaction_type_id = $deposit->id;
- $tag->tagMode = 'advancePayment';
- $account1->account_type_id = $asset->id;
- $account2->account_type_id = $asset->id;
-
- $tag->save();
- $journal1->save();
- $journal2->save();
- $account1->save();
- $account2->save();
- // connect journal1:
- $journal2->tags()->save($tag);
-
- $result = $this->object->connect($journal1, $tag);
- // account1 and account2 are different, so false:
- $this->assertFalse($result);
-
- }
-
- /**
- * An advance payment accepts no transfers.
- *
- * @covers FireflyIII\Repositories\Tag\TagRepository::connect
- * @covers FireflyIII\Repositories\Tag\TagRepository::connectAdvancePayment
- * @covers FireflyIII\Repositories\Tag\TagRepository::matchAll
- */
- public function testConnectPaymentOneTransfer()
- {
- $user = FactoryMuffin::create('FireflyIII\User');
- $this->be($user);
-
- FactoryMuffin::create('FireflyIII\Models\TransactionType');
- FactoryMuffin::create('FireflyIII\Models\TransactionType');
- $transfer = FactoryMuffin::create('FireflyIII\Models\TransactionType');
-
- $journal = FactoryMuffin::create('FireflyIII\Models\TransactionJournal');
- $tag = FactoryMuffin::create('FireflyIII\Models\Tag');
-
- $journal->transaction_type_id = $transfer->id;
- $tag->tagMode = 'advancePayment';
-
- $tag->save();
- $journal->save();
-
- $result = $this->object->connect($journal, $tag);
- $this->assertFalse($result);
-
- }
-
- /**
- * An advance payment accepts only one withdrawal, not two.
- *
- * @covers FireflyIII\Repositories\Tag\TagRepository::connect
- * @covers FireflyIII\Repositories\Tag\TagRepository::connectAdvancePayment
- * @covers FireflyIII\Repositories\Tag\TagRepository::matchAll
- */
- public function testConnectPaymentOneWithdrawal()
- {
- $user = FactoryMuffin::create('FireflyIII\User');
- $this->be($user);
-
- $withdrawal = FactoryMuffin::create('FireflyIII\Models\TransactionType');
- FactoryMuffin::create('FireflyIII\Models\TransactionType');
- FactoryMuffin::create('FireflyIII\Models\TransactionType');
-
- $journal = FactoryMuffin::create('FireflyIII\Models\TransactionJournal');
- $tag = FactoryMuffin::create('FireflyIII\Models\Tag');
-
- $journal->transaction_type_id = $withdrawal->id;
- $tag->tagMode = 'advancePayment';
-
- $tag->save();
- $journal->save();
-
- $result = $this->object->connect($journal, $tag);
- $this->assertTrue($result);
-
- }
-
- /**
- * An advance payment accepts only one withdrawal, not two.
- *
- * @covers FireflyIII\Repositories\Tag\TagRepository::connect
- * @covers FireflyIII\Repositories\Tag\TagRepository::connectAdvancePayment
- * @covers FireflyIII\Repositories\Tag\TagRepository::matchAll
- */
- public function testConnectPaymentTwoWithdrawals()
- {
- $user = FactoryMuffin::create('FireflyIII\User');
- $this->be($user);
-
- $withdrawal = FactoryMuffin::create('FireflyIII\Models\TransactionType');
- FactoryMuffin::create('FireflyIII\Models\TransactionType');
- FactoryMuffin::create('FireflyIII\Models\TransactionType');
-
- $journal = FactoryMuffin::create('FireflyIII\Models\TransactionJournal');
- $otherJournal = FactoryMuffin::create('FireflyIII\Models\TransactionJournal');
- $tag = FactoryMuffin::create('FireflyIII\Models\Tag');
-
- $journal->transaction_type_id = $withdrawal->id;
- $otherJournal->transaction_type_id = $withdrawal->id;
- $tag->tagMode = 'advancePayment';
-
- $tag->save();
- $journal->save();
- $otherJournal->save();
- $otherJournal->tags()->save($tag);
-
- $result = $this->object->connect($journal, $tag);
- $this->assertFalse($result);
-
- }
-
- /**
- * An advance payment accepts only one withdrawal, not two, even not
- * if the accounts are the same
- *
- * @covers FireflyIII\Repositories\Tag\TagRepository::connect
- * @covers FireflyIII\Repositories\Tag\TagRepository::connectAdvancePayment
- * @covers FireflyIII\Repositories\Tag\TagRepository::matchAll
- */
- public function testConnectPaymentTwoWithdrawalsSameAccounts()
- {
- $user = FactoryMuffin::create('FireflyIII\User');
- $this->be($user);
-
- $withdrawal = FactoryMuffin::create('FireflyIII\Models\TransactionType');
- FactoryMuffin::create('FireflyIII\Models\TransactionType');
- FactoryMuffin::create('FireflyIII\Models\TransactionType');
-
- $journal = FactoryMuffin::create('FireflyIII\Models\TransactionJournal');
- $otherJournal = FactoryMuffin::create('FireflyIII\Models\TransactionJournal');
- $tag = FactoryMuffin::create('FireflyIII\Models\Tag');
-
- $journal->transaction_type_id = $withdrawal->id;
- $otherJournal->transaction_type_id = $withdrawal->id;
-
- // match up accounts:
- $otherJournal->transactions[0]->account_id = $journal->transactions[0]->account_id;
- $otherJournal->transactions[1]->account_id = $journal->transactions[1]->account_id;
- $otherJournal->transactions[0]->save();
- $otherJournal->transactions[1]->save();
-
-
- $tag->tagMode = 'advancePayment';
-
- $tag->save();
- $journal->save();
- $otherJournal->save();
- $otherJournal->tags()->save($tag);
-
- $result = $this->object->connect($journal, $tag);
- $this->assertFalse($result);
- }
-
-
- /**
- * By default, any tag can become an advancePayment
- *
- * @covers FireflyIII\Repositories\Tag\TagRepository::tagAllowAdvance
- */
- public function testTagAllowAdvance()
- {
- // create a tag
- $user = FactoryMuffin::create('FireflyIII\User');
- $tag = FactoryMuffin::create('FireflyIII\Models\Tag');
- $tag->tagMode = 'nothing';
- $tag->user_id = $user->id;
- $tag->save();
-
- $result = $this->object->tagAllowAdvance($tag);
- $this->assertTrue($result);
- }
-
- /**
- * If the tag has one transfer, it can NOT become an advance payment.
- *
- * @covers FireflyIII\Repositories\Tag\TagRepository::tagAllowAdvance
- */
- public function testTagAllowAdvanceWithTransfer()
- {
- // create a tag
- $user = FactoryMuffin::create('FireflyIII\User');
- $tag = FactoryMuffin::create('FireflyIII\Models\Tag');
- FactoryMuffin::create('FireflyIII\Models\TransactionType'); // withdrawal
- FactoryMuffin::create('FireflyIII\Models\TransactionType'); // deposit
- $transfer = FactoryMuffin::create('FireflyIII\Models\TransactionType'); // transfer
- $tag->tagMode = 'nothing';
- $tag->user_id = $user->id;
- $tag->save();
-
- // create withdrawal:
- $journal = FactoryMuffin::create('FireflyIII\Models\TransactionJournal');
- $journal->transaction_type_id = $transfer->id;
- $journal->save();
- $journal->tags()->save($tag);
-
- $result = $this->object->tagAllowAdvance($tag);
- $this->assertFalse($result);
- }
-
- /**
- * If the tag has one withdrawal, it can still become an advance payment.
- *
- * @covers FireflyIII\Repositories\Tag\TagRepository::tagAllowAdvance
- */
- public function testTagAllowAdvanceWithWithdrawal()
- {
- // create a tag
- $user = FactoryMuffin::create('FireflyIII\User');
- $tag = FactoryMuffin::create('FireflyIII\Models\Tag');
- $tag->tagMode = 'nothing';
- $tag->user_id = $user->id;
- $tag->save();
-
- // create withdrawal:
- $journal = FactoryMuffin::create('FireflyIII\Models\TransactionJournal');
- $journal->tags()->save($tag);
-
- $result = $this->object->tagAllowAdvance($tag);
- $this->assertTrue($result);
- }
-
- /**
- * If the tag has two withdrawals, it CANNOT become an advance payment.
- *
- * @covers FireflyIII\Repositories\Tag\TagRepository::tagAllowAdvance
- */
- public function testTagAllowAdvanceWithWithdrawals()
- {
- // create a tag
- $user = FactoryMuffin::create('FireflyIII\User');
- $tag = FactoryMuffin::create('FireflyIII\Models\Tag');
- $withdrawal = FactoryMuffin::create('FireflyIII\Models\TransactionType');
- $tag->tagMode = 'nothing';
- $tag->user_id = $user->id;
- $tag->save();
-
- // create withdrawals
- for ($i = 0; $i < 2; $i++) {
- $journal = FactoryMuffin::create('FireflyIII\Models\TransactionJournal');
- $journal->transaction_type_id = $withdrawal->id;
- $journal->save();
- $journal->tags()->save($tag);
- }
-
- $result = $this->object->tagAllowAdvance($tag);
- $this->assertFalse($result);
- }
-
- /**
- * By default, an empty tag can become a balancing act.
- *
- * @covers FireflyIII\Repositories\Tag\TagRepository::tagAllowBalancing
- */
- public function testTagAllowBalancing()
- {
- // create a tag
- $user = FactoryMuffin::create('FireflyIII\User');
- $tag = FactoryMuffin::create('FireflyIII\Models\Tag');
- $tag->tagMode = 'nothing';
- $tag->user_id = $user->id;
- $tag->save();
-
- $result = $this->object->tagAllowBalancing($tag);
- $this->assertTrue($result);
- }
-
- /**
- * When the tag has one deposit, it can NOT become a balancing act.
- *
- * @covers FireflyIII\Repositories\Tag\TagRepository::tagAllowBalancing
- */
- public function testTagAllowBalancingDeposit()
- {
-
- // create a tag
- FactoryMuffin::create('FireflyIII\Models\TransactionType'); // withdrawal
- $deposit = FactoryMuffin::create('FireflyIII\Models\TransactionType'); // deposit
- $user = FactoryMuffin::create('FireflyIII\User');
- $tag = FactoryMuffin::create('FireflyIII\Models\Tag');
- $tag->tagMode = 'nothing';
- $tag->user_id = $user->id;
- $tag->save();
-
- // create three journals and connect them:
- for ($i = 0; $i < 1; $i++) {
- $journal = FactoryMuffin::create('FireflyIII\Models\TransactionJournal');
- $journal->transaction_type_id = $deposit->id;
- $journal->save();
- $journal->tags()->save($tag);
- }
-
- $result = $this->object->tagAllowBalancing($tag);
- $this->assertFalse($result);
- }
-
- /**
- * When the tag has more than 2 transactions connected to it, it cannot become abalancing act.
- *
- * @covers FireflyIII\Repositories\Tag\TagRepository::tagAllowBalancing
- */
- public function testTagAllowBalancingManyJournals()
- {
- // create a tag
- $user = FactoryMuffin::create('FireflyIII\User');
- $tag = FactoryMuffin::create('FireflyIII\Models\Tag');
- $tag->tagMode = 'nothing';
- $tag->user_id = $user->id;
- $tag->save();
-
- // create three journals and connect them:
- for ($i = 0; $i < 3; $i++) {
- $journal = FactoryMuffin::create('FireflyIII\Models\TransactionJournal');
- $journal->tags()->save($tag);
- }
-
- $result = $this->object->tagAllowBalancing($tag);
- $this->assertFalse($result);
- }
-}
diff --git a/tests/support/AmountSupportTest.php b/tests/support/AmountSupportTest.php
deleted file mode 100644
index 63631e0578..0000000000
--- a/tests/support/AmountSupportTest.php
+++ /dev/null
@@ -1,300 +0,0 @@
-object = new Amount;
- $user = FactoryMuffin::create('FireflyIII\User');
- $this->be($user);
-
-
- }
-
- /**
- * Tears down the fixture, for example, closes a network connection.
- * This method is called after a test is executed.
- */
- public function tearDown()
- {
- parent::tearDown();
- }
-
- /**
- * @covers FireflyIII\Support\Amount::format
- * @covers FireflyIII\Support\Amount::getCurrencySymbol
- */
- public function testFormat()
- {
- $amount = '123';
- $result = $this->object->format($amount, true);
- $this->assertTrue(str_contains($result, $amount));
- }
-
- /**
- * @covers FireflyIII\Support\Amount::formatJournal
- */
- public function testFormatJournalColouredTransfer()
- {
-
-
- FactoryMuffin::create('FireflyIII\Models\TransactionType'); // withdrawal
- FactoryMuffin::create('FireflyIII\Models\TransactionType'); // deposit
- /** @var \FireflyIII\Models\TransactionJournal $journal */
- $journal = FactoryMuffin::create('FireflyIII\Models\TransactionJournal');
- $symbol = $journal->transactionCurrency->symbol;
-
- $result = $this->object->formatJournal($journal, true);
-
- // transfer is blue:
- $this->assertTrue(str_contains($result, ''));
- // transfer contains currency code:
- $this->assertTrue(str_contains($result, $symbol));
- // all amounts are 100.
- $this->assertTrue(str_contains($result, '100'));
- }
-
- /**
- * @covers FireflyIII\Support\Amount::formatJournal
- */
- public function testFormatJournalUncolouredTransfer()
- {
- FactoryMuffin::create('FireflyIII\Models\TransactionType'); // withdrawal
- FactoryMuffin::create('FireflyIII\Models\TransactionType'); // deposit
- /** @var \FireflyIII\Models\TransactionJournal $journal */
- $journal = FactoryMuffin::create('FireflyIII\Models\TransactionJournal');
- $symbol = $journal->transactionCurrency->symbol;
-
- $result = $this->object->formatJournal($journal, false);
-
- // transfer is not blue:
- $this->assertFalse(str_contains($result, ''));
- // transfer contains currency code:
- $this->assertTrue(str_contains($result, $symbol));
- // all amounts are 100.
- $this->assertTrue(str_contains($result, '100'));
- }
-
- /**
- * @covers FireflyIII\Support\Amount::formatJournal
- */
- public function testFormatJournalWithSymbol()
- {
- FactoryMuffin::create('FireflyIII\Models\TransactionType'); // withdrawal
- /** @var \FireflyIII\Models\TransactionJournal $journal */
- $journal = FactoryMuffin::create('FireflyIII\Models\TransactionJournal');
- $symbol = $journal->transactionCurrency->symbol;
- $journal->symbol = $symbol;
-
- $result = $this->object->formatJournal($journal, true);
-
- // transfer is not blue:
- $this->assertFalse(str_contains($result, ''));
- // transfer contains currency code:
- $this->assertTrue(str_contains($result, $symbol));
- // all amounts are 100.
- $this->assertTrue(str_contains($result, '100'));
- }
-
- /**
- * @covers FireflyIII\Support\Amount::formatJournal
- */
- public function testFormatJournalWithdrawal()
- {
- /** @var \FireflyIII\Models\TransactionJournal $journal */
- $journal = FactoryMuffin::create('FireflyIII\Models\TransactionJournal');
- $symbol = $journal->transactionCurrency->symbol;
-
- $result = $this->object->formatJournal($journal, true);
-
- // transfer is not blue:
- $this->assertFalse(str_contains($result, ''));
- // transfer contains currency code:
- $this->assertTrue(str_contains($result, $symbol));
- // all amounts are 100.
- $this->assertTrue(str_contains($result, '100'));
- }
-
- /**
- * @covers FireflyIII\Support\Amount::formatTransaction
- */
- public function testFormatTransaction()
- {
- // is a withdrawal.
- $transaction = FactoryMuffin::create('FireflyIII\Models\Transaction');
- $transaction->amount = -100;
- $transaction->save();
- $result = $this->object->formatTransaction($transaction, true);
-
-
- // withdrawal is red:
- $this->assertTrue(str_contains($result, ''));
- // all amounts are 100.
- $this->assertTrue(str_contains($result, '100'));
- }
-
- /**
- * @covers FireflyIII\Support\Amount::formatWithSymbol
- */
- public function testFormatWithSymbolColouredAboveZero()
- {
- $amount = 123;
- $symbol = 'top';
- $coloured = true;
-
- $result = $this->object->formatWithSymbol($symbol, $amount, $coloured);
-
- // has colour:
- $this->assertTrue(str_contains($result, ''));
- // has symbol:
- $this->assertTrue(str_contains($result, $symbol));
- // has amount:
- $this->assertTrue(str_contains($result, '123'));
- }
-
- /**
- * @covers FireflyIII\Support\Amount::formatWithSymbol
- */
- public function testFormatWithSymbolColouredBelowZero()
- {
- $amount = -123;
- $symbol = 'top';
- $coloured = true;
-
- $result = $this->object->formatWithSymbol($symbol, $amount, $coloured);
-
- // has colour:
- $this->assertTrue(str_contains($result, ''));
- // has symbol:
- $this->assertTrue(str_contains($result, $symbol));
- // has amount:
- $this->assertTrue(str_contains($result, '123'));
- }
-
- /**
- * @covers FireflyIII\Support\Amount::formatWithSymbol
- */
- public function testFormatWithSymbolColouredZero()
- {
- $amount = 0.0;
- $symbol = 'top';
- $coloured = true;
-
- $result = $this->object->formatWithSymbol($symbol, $amount, $coloured);
-
- // has colour:
- $this->assertTrue(str_contains($result, '#999'));
- // has symbol:
- $this->assertTrue(str_contains($result, $symbol));
- // has amount:
- $this->assertTrue(str_contains($result, '0'));
- }
-
- /**
- * @covers FireflyIII\Support\Amount::formatWithSymbol
- */
- public function testFormatWithSymbolNotColoured()
- {
- $amount = 0;
- $symbol = 'top';
- $coloured = false;
-
- $result = $this->object->formatWithSymbol($symbol, $amount, $coloured);
-
- // has symbol:
- $this->assertTrue(str_contains($result, $symbol));
- // has amount:
- $this->assertTrue(str_contains($result, '0'));
- }
-
- /**
- * @covers FireflyIII\Support\Amount::getAllCurrencies
- */
- public function testGetAllCurrencies()
- {
- $size = TransactionCurrency::count();
- $list = $this->object->getAllCurrencies();
- $this->assertCount($size, $list);
- }
-
- /**
- * @covers FireflyIII\Support\Amount::getCurrencyCode
- */
- public function testGetCurrencyCode()
- {
- $code = $this->object->getCurrencyCode();
- $this->assertEquals('EUR', $code);
- }
-
- /**
- * @covers FireflyIII\Support\Amount::getCurrencyCode
- */
- public function testGetCurrencyCodeNoSuchCurrency()
- {
- $user = FactoryMuffin::create('FireflyIII\User');
- $this->be($user);
-
- // delete any currency preferences:
- Preference::where('user_id', $user->id)->delete();
-
- // delete transaction currencies:
- foreach (TransactionCurrency::get() as $c) {
- $c->delete();
- }
-
- $preference = FactoryMuffin::create('FireflyIII\Models\Preference');
- $preference->user_id = $user->id;
- $preference->name = 'currencyPreference';
- $preference->data = 'SOM';
- $preference->save();
-
- Preferences::shouldReceive('get')->withArgs(['currencyPreference', 'EUR'])->andReturn($preference);
-
- $code = $this->object->getCurrencyCode();
- $this->assertEquals('EUR', $code);
- }
-
- /**
- * @covers FireflyIII\Support\Amount::getCurrencySymbol
- */
- public function testGetCurrencySymbol()
- {
- // will the the euro:
- $eur = TransactionCurrency::whereCode('EUR')->first();
-
- $result = $this->object->getCurrencySymbol();
- $this->assertEquals($eur->symbol, $result);
- }
-
- /**
- * @covers FireflyIII\Support\Amount::getDefaultCurrency
- */
- public function testGetDefaultCurrency()
- {
- // will the the euro:
- $eur = TransactionCurrency::whereCode('EUR')->first();
-
- $result = $this->object->getDefaultCurrency();
- $this->assertEquals($eur->id, $result->id);
- }
-
-
-}
diff --git a/tests/support/ExpandedFormTest.php b/tests/support/ExpandedFormTest.php
deleted file mode 100644
index cd15532dd0..0000000000
--- a/tests/support/ExpandedFormTest.php
+++ /dev/null
@@ -1,202 +0,0 @@
-object = new ExpandedForm;
- $user = FactoryMuffin::create('FireflyIII\User');
- $this->be($user);
- }
-
- /**
- * @covers FireflyIII\Support\ExpandedForm::amount
- * @covers FireflyIII\Support\ExpandedForm::label
- * @covers FireflyIII\Support\ExpandedForm::expandOptionArray
- * @covers FireflyIII\Support\ExpandedForm::getHolderClasses
- * @covers FireflyIII\Support\ExpandedForm::fillFieldValue
- */
- public function testAmount()
- {
- $result = $this->object->amount('abcde', '12.23', ['label' => 'Some Label']);
-
- $this->assertTrue(str_contains($result, '23'));
- $this->assertTrue(str_contains($result, 'abcde_holder'));
- }
-
- /**
- * @covers FireflyIII\Support\ExpandedForm::balance
- * @covers FireflyIII\Support\ExpandedForm::label
- */
- public function testBalance()
- {
- $result = $this->object->balance('abcde', '12.23', []);
-
- $this->assertTrue(str_contains($result, '23'));
- $this->assertTrue(str_contains($result, 'abcde_holder'));
- }
-
- /**
- * @covers FireflyIII\Support\ExpandedForm::checkbox
- * @covers FireflyIII\Support\ExpandedForm::getHolderClasses
- */
- public function testCheckbox()
- {
- // add error to session for this thing:
- $errors = new MessageBag;
- $errors->add('abcde', 'Some error here.');
- $this->session(['errors' => $errors]);
-
- $result = $this->object->checkbox('abcde', 1, true);
-
-
- $this->assertTrue(str_contains($result, 'checked="checked"'));
- $this->assertTrue(str_contains($result, 'abcde_holder'));
- }
-
- /**
- * @covers FireflyIII\Support\ExpandedForm::date
- * @covers FireflyIII\Support\ExpandedForm::fillFieldValue
- */
- public function testDate()
- {
- $preFilled = [
- 'abcde' => '1998-01-01'
- ];
- $this->session(['preFilled' => $preFilled]);
-
- $result = $this->object->date('abcde');
-
- $this->assertTrue(str_contains($result, '1998'));
- $this->assertTrue(str_contains($result, 'type="date"'));
- $this->assertTrue(str_contains($result, 'abcde_holder'));
- }
-
- /**
- * @covers FireflyIII\Support\ExpandedForm::integer
- */
- public function testInteger()
- {
- $result = $this->object->integer('abcde', 12345);
-
- $this->assertTrue(str_contains($result, '12345'));
- $this->assertTrue(str_contains($result, 'type="number"'));
- $this->assertTrue(str_contains($result, 'step="1"'));
- $this->assertTrue(str_contains($result, 'abcde_holder'));
- }
-
- /**
- * @covers FireflyIII\Support\ExpandedForm::location
- */
- public function testLocation()
- {
- $result = $this->object->location('abcde');
-
- $this->assertTrue(str_contains($result, 'id="clearLocation"'));
- $this->assertTrue(str_contains($result, 'id="map-canvas"'));
- $this->assertTrue(str_contains($result, 'abcde_holder'));
- }
-
- /**
- * @covers FireflyIII\Support\ExpandedForm::makeSelectList
- */
- public function testMakeSelectList()
- {
- $collection = new Collection;
- for ($i = 0; $i < 5; $i++) {
- $collection->push(FactoryMuffin::create('FireflyIII\Models\Account'));
- }
- $result = $this->object->makeSelectList($collection, true);
-
- $this->assertCount(6, $result);
- }
-
- /**
- * @covers FireflyIII\Support\ExpandedForm::multiRadio
- */
- public function testMultiRadio()
- {
- $list = [
- 'some' => 'BlaBla',
- 'other' => 'ThisIsCool'
- ];
-
- $result = $this->object->multiRadio('abcde', $list);
-
- $this->assertTrue(str_contains($result, 'ThisIsCool'));
- $this->assertTrue(str_contains($result, 'other'));
- $this->assertTrue(str_contains($result, 'abcde_holder'));
- }
-
- /**
- * @covers FireflyIII\Support\ExpandedForm::optionsList
- */
- public function testOptionsList()
- {
- $result = $this->object->optionsList('update', 'MotorCycle');
- $this->assertTrue(str_contains($result, 'MotorCycle'));
- }
-
- /**
- * @covers FireflyIII\Support\ExpandedForm::select
- */
- public function testSelect()
- {
- $list = [
- 'some' => 'BlaBla',
- 'other' => 'ThisIsCool'
- ];
-
- $result = $this->object->select('abcde', $list);
- $this->assertTrue(str_contains($result, 'ThisIsCool'));
- $this->assertTrue(str_contains($result, 'abcde_holder'));
- }
-
- /**
- * @covers FireflyIII\Support\ExpandedForm::tags
- */
- public function testTags()
- {
- $result = $this->object->tags('abcde', 'some,tags');
- $this->assertTrue(str_contains($result, 'data-role="tagsinput"'));
- $this->assertTrue(str_contains($result, 'abcde_holder'));
- }
-
- /**
- * @covers FireflyIII\Support\ExpandedForm::text
- */
- public function testText()
- {
- $result = $this->object->text('abcde', 'MotorBike!');
- $this->assertTrue(str_contains($result, 'MotorBike!'));
- $this->assertTrue(str_contains($result, 'abcde_holder'));
- }
-
- /**
- * @covers FireflyIII\Support\ExpandedForm::textarea
- */
- public function testTextarea()
- {
- $result = $this->object->textarea('abcde', 'Pillow fight!');
- $this->assertTrue(str_contains($result, 'Pillow fight!'));
- $this->assertTrue(str_contains($result, 'abcde_holder'));
- }
-}
diff --git a/tests/support/NavigationTest.php b/tests/support/NavigationTest.php
deleted file mode 100644
index 7e93a09e69..0000000000
--- a/tests/support/NavigationTest.php
+++ /dev/null
@@ -1,287 +0,0 @@
-object = new Navigation;
- }
-
- /**
- * @covers FireflyIII\Support\Navigation::addPeriod
- */
- public function testAddPeriod()
- {
- $date = new Carbon('2015-01-01');
-
- $result = $this->object->addPeriod($date, 'quarter', 0);
- $this->assertEquals('2015-04-01', $result->format('Y-m-d'));
- }
-
- /**
- * @expectedException FireflyIII\Exceptions\FireflyException
- * @expectedExceptionMessage Cannot do addPeriod for $repeat_freq "something"
- * @covers FireflyIII\Support\Navigation::addPeriod
- */
- public function testAddPeriodError()
- {
- $date = new Carbon('2015-01-01');
-
- $this->object->addPeriod($date, 'something', 0);
-
- }
-
- /**
- * @covers FireflyIII\Support\Navigation::endOfPeriod
- */
- public function testEndOfPeriod()
- {
- $date = new Carbon('2015-01-01');
-
- $result = $this->object->endOfPeriod($date, '1D');
- $this->assertEquals('2015-01-02', $result->format('Y-m-d'));
- }
-
- /**
- * @covers FireflyIII\Support\Navigation::endOfPeriod
- */
- public function testEndOfPeriodModifier()
- {
- $date = new Carbon('2015-01-01');
-
- $result = $this->object->endOfPeriod($date, 'quarter');
- $this->assertEquals('2015-03-31', $result->format('Y-m-d'));
- }
-
- /**
- * @covers FireflyIII\Support\Navigation::endOfPeriod
- * @expectedException FireflyIII\Exceptions\FireflyException
- * @expectedExceptionMessage Cannot do endOfPeriod for $repeat_freq "something"
- */
- public function testEndOfPeriodModifierError()
- {
- $date = new Carbon('2015-01-01');
-
- $this->object->endOfPeriod($date, 'something');
- }
-
- /**
- * @covers FireflyIII\Support\Navigation::endOfX
- */
- public function testEndOfX()
- {
- $date = new Carbon('2015-01-01');
- $maxEnd = new Carbon('2016-01-01');
-
- $result = $this->object->endOfX($date, 'month', $maxEnd);
-
- $this->assertEquals('2015-01-31', $result->format('Y-m-d'));
- }
-
- /**
- * @covers FireflyIII\Support\Navigation::endOfX
- */
- public function testEndOfXBeyondMax()
- {
- $date = new Carbon('2015-01-01');
- $maxEnd = new Carbon('2015-01-15');
-
- $result = $this->object->endOfX($date, 'monthly', $maxEnd);
-
- $this->assertEquals('2015-01-15', $result->format('Y-m-d'));
- }
-
- /**
- * @covers FireflyIII\Support\Navigation::periodShow
- */
- public function testPeriodShow()
- {
- $date = new Carbon('2015-01-01');
- $result = $this->object->periodShow($date, 'month');
- $this->assertEquals('January 2015', $result);
- }
-
- /**
- * @covers FireflyIII\Support\Navigation::periodShow
- * @expectedException FireflyIII\Exceptions\FireflyException
- * @expectedExceptionMessage No date formats for frequency "something"
- */
- public function testPeriodShowError()
- {
- $date = new Carbon('2015-01-01');
- $this->object->periodShow($date, 'something');
- }
-
-
- /**
- * @covers FireflyIII\Support\Navigation::startOfPeriod
- */
- public function testStartOfPeriod()
- {
- $date = new Carbon('2015-01-15');
- $result = $this->object->startOfPeriod($date, 'month');
- $this->assertEquals('2015-01-01', $result->format('Y-m-d'));
- }
-
- /**
- * @covers FireflyIII\Support\Navigation::startOfPeriod
- * @expectedException FireflyIII\Exceptions\FireflyException
- * @expectedExceptionMessage Cannot do startOfPeriod for $repeat_freq "something"
- */
- public function testStartOfPeriodError()
- {
- $date = new Carbon('2015-08-15');
- $this->object->startOfPeriod($date, 'something');
- }
-
- /**
- * @covers FireflyIII\Support\Navigation::startOfPeriod
- */
- public function testStartOfPeriodHalfYear()
- {
- $date = new Carbon('2015-01-15');
- $result = $this->object->startOfPeriod($date, 'half-year');
- $this->assertEquals('2015-01-01', $result->format('Y-m-d'));
- }
-
- /**
- * @covers FireflyIII\Support\Navigation::startOfPeriod
- */
- public function testStartOfPeriodHalfYearSecondHalf()
- {
- $date = new Carbon('2015-08-15');
- $result = $this->object->startOfPeriod($date, 'half-year');
- $this->assertEquals('2015-07-01', $result->format('Y-m-d'));
- }
-
- /**
- * @covers FireflyIII\Support\Navigation::subtractPeriod
- */
- public function testSubtractPeriod()
- {
- $date = new Carbon('2015-01-01');
- $result = $this->object->subtractPeriod($date, 'month');
- $this->assertEquals('2014-12-01', $result->format('Y-m-d'));
- }
-
- /**
- * @covers FireflyIII\Support\Navigation::subtractPeriod
- * @expectedException FireflyIII\Exceptions\FireflyException
- * @expectedExceptionMessage Cannot do subtractPeriod for $repeat_freq "something"
- */
- public function testSubtractPeriodError()
- {
- $date = new Carbon('2015-01-01');
- $this->object->subtractPeriod($date, 'something');
- }
-
- /**
- * @covers FireflyIII\Support\Navigation::subtractPeriod
- */
- public function testSubtractPeriodQuarter()
- {
- $date = new Carbon('2015-01-01');
- $result = $this->object->subtractPeriod($date, 'quarter');
- $this->assertEquals('2014-10-01', $result->format('Y-m-d'));
- }
-
- /**
- * @covers FireflyIII\Support\Navigation::updateEndDate
- */
- public function testUpdateEndDate()
- {
- $date = new Carbon('2015-01-15');
- $result = $this->object->updateEndDate('1M', $date);
- $this->assertEquals('2015-01-31', $result->format('Y-m-d'));
- }
-
- /**
- * @covers FireflyIII\Support\Navigation::updateEndDate
- * @expectedException FireflyIII\Exceptions\FireflyException
- * @expectedExceptionMessage updateEndDate cannot handle $range "something"
- */
- public function testUpdateEndDateError()
- {
- $date = new Carbon('2015-01-15');
- $this->object->updateEndDate('something', $date);
- }
-
- /**
- * @covers FireflyIII\Support\Navigation::updateEndDate
- */
- public function testUpdateEndDateHalf()
- {
- $date = new Carbon('2015-01-15');
- $result = $this->object->updateEndDate('6M', $date);
- $this->assertEquals('2015-07-01', $result->format('Y-m-d'));
- }
-
- /**
- * @covers FireflyIII\Support\Navigation::updateEndDate
- */
- public function testUpdateEndDateSecondHalf()
- {
- $date = new Carbon('2015-08-15');
- $result = $this->object->updateEndDate('6M', $date);
- $this->assertEquals('2015-12-31', $result->format('Y-m-d'));
- }
-
- /**
- * @covers FireflyIII\Support\Navigation::updateStartDate
- */
- public function testUpdateStartDate()
- {
- $date = new Carbon('2015-01-15');
- $result = $this->object->updateStartDate('1M', $date);
- $this->assertEquals('2015-01-01', $result->format('Y-m-d'));
- }
-
- /**
- * @covers FireflyIII\Support\Navigation::updateStartDate
- */
- public function testUpdateStartDateHalf()
- {
- $date = new Carbon('2015-01-15');
- $result = $this->object->updateStartDate('6M', $date);
- $this->assertEquals('2015-01-01', $result->format('Y-m-d'));
- }
-
- /**
- * @covers FireflyIII\Support\Navigation::updateStartDate
- */
- public function testUpdateStartDateSecondHalf()
- {
- $date = new Carbon('2015-09-15');
- $result = $this->object->updateStartDate('6M', $date);
- $this->assertEquals('2015-07-01', $result->format('Y-m-d'));
- }
-
- /**
- * @covers FireflyIII\Support\Navigation::updateStartDate
- * @expectedException FireflyIII\Exceptions\FireflyException
- * @expectedExceptionMessage updateStartDate cannot handle $range "something"
- */
- public function testUpdateStartDateError()
- {
- $date = new Carbon('2015-09-15');
- $this->object->updateStartDate('something', $date);
- }
-
-
-}
\ No newline at end of file
diff --git a/tests/unit.suite.yml b/tests/unit.suite.yml
new file mode 100644
index 0000000000..bba650c30e
--- /dev/null
+++ b/tests/unit.suite.yml
@@ -0,0 +1,10 @@
+# Codeception Test Suite Configuration
+#
+# Suite for unit (internal) tests.
+
+class_name: UnitTester
+modules:
+ enabled:
+ - Laravel5
+ - Asserts
+ - \Helper\Unit
\ No newline at end of file
diff --git a/tests/unit/ExampleTest.php b/tests/unit/ExampleTest.php
new file mode 100644
index 0000000000..05b642ccaf
--- /dev/null
+++ b/tests/unit/ExampleTest.php
@@ -0,0 +1,20 @@
+ |