mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-11-17 07:08:19 +00:00
Code cleanup.
This commit is contained in:
@@ -44,7 +44,7 @@ class AppendNotesTest extends TestCase
|
||||
$note = $journal->notes()->first();
|
||||
$start = 'Default note text';
|
||||
$toAppend = 'This is appended';
|
||||
if (is_null($note)) {
|
||||
if (null === $note) {
|
||||
$note = new Note();
|
||||
$note->noteable()->associate($journal);
|
||||
}
|
||||
@@ -71,7 +71,7 @@ class AppendNotesTest extends TestCase
|
||||
// give journal some notes.
|
||||
$journal = TransactionJournal::find(4);
|
||||
$note = $journal->notes()->first();
|
||||
if (!is_null($note)) {
|
||||
if (null !== $note) {
|
||||
$note->forceDelete();
|
||||
}
|
||||
$toAppend = 'This is appended';
|
||||
|
||||
@@ -42,7 +42,7 @@ class ClearNotesTest extends TestCase
|
||||
// give journal a note:
|
||||
$journal = TransactionJournal::inRandomOrder()->whereNull('deleted_at')->first();
|
||||
$note = $journal->notes()->first();
|
||||
if (is_null($note)) {
|
||||
if (null === $note) {
|
||||
$note = new Note;
|
||||
$note->noteable()->associate($journal);
|
||||
}
|
||||
|
||||
@@ -44,7 +44,7 @@ class PrependNotesTest extends TestCase
|
||||
$note = $journal->notes()->first();
|
||||
$start = 'Default note text';
|
||||
$toPrepend = 'This is prepended';
|
||||
if (is_null($note)) {
|
||||
if (null === $note) {
|
||||
$note = new Note();
|
||||
$note->noteable()->associate($journal);
|
||||
}
|
||||
@@ -71,7 +71,7 @@ class PrependNotesTest extends TestCase
|
||||
// give journal some notes.
|
||||
$journal = TransactionJournal::inRandomOrder()->whereNull('deleted_at')->first();
|
||||
$note = $journal->notes()->first();
|
||||
if (!is_null($note)) {
|
||||
if (null !== $note) {
|
||||
$note->forceDelete();
|
||||
}
|
||||
$toPrepend = 'This is appended';
|
||||
|
||||
@@ -41,7 +41,7 @@ class RemoveAllTagsTest extends TestCase
|
||||
{
|
||||
// find journal with at least one tag
|
||||
$journalIds = DB::table('tag_transaction_journal')->get(['transaction_journal_id'])->pluck('transaction_journal_id')->toArray();
|
||||
$journalId = intval($journalIds[0]);
|
||||
$journalId = (int)$journalIds[0];
|
||||
/** @var TransactionJournal $journal */
|
||||
$journal = TransactionJournal::find($journalId);
|
||||
|
||||
|
||||
@@ -42,7 +42,7 @@ class RemoveTagTest extends TestCase
|
||||
|
||||
// find journal with at least one tag
|
||||
$journalIds = DB::table('tag_transaction_journal')->get(['transaction_journal_id'])->pluck('transaction_journal_id')->toArray();
|
||||
$journalId = intval($journalIds[0]);
|
||||
$journalId = (int)$journalIds[0];
|
||||
/** @var TransactionJournal $journal */
|
||||
$journal = TransactionJournal::find($journalId);
|
||||
$originalCount = $journal->tags()->count();
|
||||
|
||||
@@ -42,7 +42,7 @@ class SetNotesTest extends TestCase
|
||||
// give journal a note:
|
||||
$journal = TransactionJournal::inRandomOrder()->whereNull('deleted_at')->first();
|
||||
$note = $journal->notes()->first();
|
||||
if (is_null($note)) {
|
||||
if (null === $note) {
|
||||
$note = new Note;
|
||||
$note->noteable()->associate($journal);
|
||||
}
|
||||
|
||||
@@ -36,9 +36,12 @@ class FromAccountStartsTest extends TestCase
|
||||
*/
|
||||
public function testTriggered()
|
||||
{
|
||||
$journal = TransactionJournal::inRandomOrder()->whereNull('deleted_at')->first();
|
||||
$transaction = $journal->transactions()->where('amount', '<', 0)->first();
|
||||
$account = $transaction->account;
|
||||
$transaction = null;
|
||||
do {
|
||||
$journal = TransactionJournal::inRandomOrder()->whereNull('deleted_at')->first();
|
||||
$transaction = $journal->transactions()->where('amount', '<', 0)->first();
|
||||
} while (null === $transaction);
|
||||
$account = $transaction->account;
|
||||
|
||||
$trigger = FromAccountStarts::makeFromStrings(substr($account->name, 0, -3), false);
|
||||
$result = $trigger->triggered($journal);
|
||||
@@ -50,8 +53,12 @@ class FromAccountStartsTest extends TestCase
|
||||
*/
|
||||
public function testTriggeredLonger()
|
||||
{
|
||||
$journal = TransactionJournal::inRandomOrder()->whereNull('deleted_at')->first();
|
||||
$transaction = $journal->transactions()->where('amount', '<', 0)->first();
|
||||
$transaction = null;
|
||||
do {
|
||||
$journal = TransactionJournal::inRandomOrder()->whereNull('deleted_at')->first();
|
||||
$transaction = $journal->transactions()->where('amount', '<', 0)->first();
|
||||
} while (null === $transaction);
|
||||
|
||||
$account = $transaction->account;
|
||||
|
||||
$trigger = FromAccountStarts::makeFromStrings('bla-bla-bla' . $account->name, false);
|
||||
|
||||
@@ -74,7 +74,7 @@ class ToAccountEndsTest extends TestCase
|
||||
{
|
||||
$journal = TransactionJournal::inRandomOrder()->whereNull('deleted_at')->first();
|
||||
|
||||
$trigger = ToAccountEnds::makeFromStrings(strval(random_int(1, 234)), false);
|
||||
$trigger = ToAccountEnds::makeFromStrings((string)random_int(1, 234), false);
|
||||
$result = $trigger->triggered($journal);
|
||||
$this->assertFalse($result);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user