Update tests.

This commit is contained in:
James Cole
2017-09-12 19:47:29 +02:00
parent ce205ab413
commit 6e80b2f4c8
9 changed files with 16 additions and 18 deletions

View File

@@ -85,7 +85,7 @@ class ConvertController extends Controller
// cannot convert split.
if ($journal->transactions()->count() > 2) {
Session::flash('error', trans('firefly.cannot_convert_split_journl'));
Session::flash('error', trans('firefly.cannot_convert_split_journal'));
return redirect(route('transactions.show', [$journal->id]));
}
@@ -134,7 +134,7 @@ class ConvertController extends Controller
}
if ($journal->transactions()->count() > 2) {
Session::flash('error', trans('firefly.cannot_convert_split_journl'));
Session::flash('error', trans('firefly.cannot_convert_split_journal'));
return redirect(route('transactions.show', [$journal->id]));
}
@@ -185,7 +185,7 @@ class ConvertController extends Controller
case TransactionType::DEPOSIT . '-' . TransactionType::WITHDRAWAL:
case TransactionType::TRANSFER . '-' . TransactionType::WITHDRAWAL:
// three and five
if ($data['destination_account_expense'] === '') {
if ($data['destination_account_expense'] === '' || is_null($data['destination_account_expense'])) {
// destination is a cash account.
$destination = $accountRepository->getCashAccount();
@@ -232,7 +232,7 @@ class ConvertController extends Controller
case TransactionType::WITHDRAWAL . '-' . TransactionType::DEPOSIT:
case TransactionType::TRANSFER . '-' . TransactionType::DEPOSIT:
if ($data['source_account_revenue'] === '') {
if ($data['source_account_revenue'] === '' || is_null($data['source_account_revenue'])) {
// destination is a cash account.
$destination = $accountRepository->getCashAccount();

View File

@@ -49,9 +49,9 @@ class AttachmentFormRequest extends Request
{
return [
'title' => 'between:1,255',
'description' => 'between:1,65536',
'notes' => 'between:1,65536',
'title' => 'between:1,255|nullable',
'description' => 'between:1,65536|nullable',
'notes' => 'between:1,65536|nullable',
];
}
}

View File

@@ -108,9 +108,9 @@ class JournalFormRequest extends Request
'piggy_bank_id' => 'between:1,255',
// foreign currency amounts
'native_amount' => 'numeric|more:0',
'source_amount' => 'numeric|more:0',
'destination_amount' => 'numeric',
'native_amount' => 'numeric|more:0|nullable',
'source_amount' => 'numeric|more:0|nullable',
'destination_amount' => 'numeric|more:0|nullable',
];
// some rules get an upgrade depending on the type of data:

View File

@@ -57,7 +57,7 @@ class RuleGroupFormRequest extends Request
return [
'title' => $titleRule,
'description' => 'between:1,5000',
'description' => 'between:1,5000|nullable',
];
}
}

View File

@@ -942,6 +942,7 @@ return [
'cannot_edit_multiple_dest' => 'You cannot edit splitted transaction #:id with description ":description" because it contains multiple destination accounts.',
'cannot_edit_opening_balance' => 'You cannot edit the opening balance of an account.',
'no_edit_multiple_left' => 'You have selected no valid transactions to edit.',
'cannot_convert_split_journl' => 'Cannot convert a split transaction',
// import bread crumbs and titles:
'import' => 'Import',

View File

@@ -138,8 +138,8 @@ class AttachmentControllerTest extends TestCase
$this->session(['attachments.edit.uri' => 'http://localhost']);
$data = [
'title' => 'Some updated title ' . rand(1000, 9999),
'notes' => '',
'description' => '',
'notes' => 'A',
'description' => 'B',
];
$this->be($this->user());

View File

@@ -24,7 +24,6 @@ use FireflyIII\Models\Transaction;
use FireflyIII\Models\TransactionType;
use FireflyIII\Repositories\Budget\BudgetRepositoryInterface;
use Illuminate\Support\Collection;
use Log;
use Tests\TestCase;
/**
@@ -104,8 +103,6 @@ class BudgetReportControllerTest extends TestCase
$transaction->amount = '-100';
$transaction->opposing_account_id = 8;
Log::debug('Transaction', $transaction->toArray());
$budgetRepos->shouldReceive('getAllBudgetLimits')->andReturn(new Collection([$one, $two]))->once();

View File

@@ -176,7 +176,7 @@ class RuleGroupControllerTest extends TestCase
$repository->shouldReceive('find')->andReturn(new RuleGroup);
$data = [
'title' => 'A',
'description' => '',
'description' => 'No description',
];

View File

@@ -14,7 +14,7 @@ class ExampleTest extends TestCase
*/
public function testBasicTest()
{
$response = $this->get('/');
$response = $this->get('/login');
$response->assertStatus(200);
}