mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2024-11-26 10:51:12 -06:00
Fix and expand tests for #2723
This commit is contained in:
parent
c23f16739c
commit
fc8400cdf9
@ -74,14 +74,14 @@ final class FromAccountNumberContains extends AbstractTrigger implements Trigger
|
||||
/** @var JournalRepositoryInterface $repository */
|
||||
$repository = app(JournalRepositoryInterface::class);
|
||||
$source = $repository->getSourceAccount($journal);
|
||||
$strpos1 = stripos($source->iban, $this->triggerValue);
|
||||
$strpos1 = stripos((string)$source->iban, $this->triggerValue);
|
||||
$strpos2 = stripos($source->account_number, $this->triggerValue);
|
||||
|
||||
if (!(false === $strpos1) || !(false === $strpos2)) {
|
||||
Log::debug(
|
||||
sprintf(
|
||||
'RuleTrigger %s for journal #%d: "%s" or "%s" contains "%s", return true.',
|
||||
get_class($this), $journal->id, $source->iban, $source->account_number, $this->triggerValue
|
||||
get_class($this), $journal->id, (string)$source->iban, $source->account_number, $this->triggerValue
|
||||
)
|
||||
);
|
||||
|
||||
@ -91,7 +91,7 @@ final class FromAccountNumberContains extends AbstractTrigger implements Trigger
|
||||
Log::debug(
|
||||
sprintf(
|
||||
'RuleTrigger %s for journal #%d: "%s" and "%s" does not contain "%s", return false.',
|
||||
get_class($this), $journal->id, $source->iban, $source->account_number, $this->triggerValue
|
||||
get_class($this), $journal->id, (string)$source->iban, $source->account_number, $this->triggerValue
|
||||
)
|
||||
);
|
||||
|
||||
|
@ -77,7 +77,7 @@ final class FromAccountNumberEnds extends AbstractTrigger implements TriggerInte
|
||||
$search = strtolower($this->triggerValue);
|
||||
$searchLength = strlen($search);
|
||||
|
||||
$part1 = substr($source->iban, $searchLength * -1);
|
||||
$part1 = substr((string)$source->iban, $searchLength * -1);
|
||||
$part2 = substr($source->account_number, $searchLength * -1);
|
||||
|
||||
if (strtolower($part1) === $search
|
||||
|
@ -76,11 +76,11 @@ final class FromAccountNumberIs extends AbstractTrigger implements TriggerInterf
|
||||
$source = $repository->getSourceAccount($journal);
|
||||
$search = strtolower($this->triggerValue);
|
||||
|
||||
if (strtolower($source->iban) === $search || strtolower($source->account_number) === $search) {
|
||||
if (strtolower((string)$source->iban) === $search || strtolower($source->account_number) === $search) {
|
||||
Log::debug(
|
||||
sprintf(
|
||||
'RuleTrigger %s for journal #%d: "%s" or "%s" is "%s", return true.', $journal->id,
|
||||
get_class($this), $source->iban, $source->account_number, $search
|
||||
get_class($this), (string)$source->iban, $source->account_number, $search
|
||||
)
|
||||
);
|
||||
|
||||
@ -90,7 +90,7 @@ final class FromAccountNumberIs extends AbstractTrigger implements TriggerInterf
|
||||
Log::debug(
|
||||
sprintf(
|
||||
'RuleTrigger %s for journal #%d: "%s" and "%s" are NOT "%s", return false.',
|
||||
get_class($this), $journal->id, $source->iban, $source->account_number, $search
|
||||
get_class($this), $journal->id, (string)$source->iban, $source->account_number, $search
|
||||
)
|
||||
);
|
||||
|
||||
|
@ -75,7 +75,7 @@ final class FromAccountNumberStarts extends AbstractTrigger implements TriggerIn
|
||||
$repository = app(JournalRepositoryInterface::class);
|
||||
$source = $repository->getSourceAccount($journal);
|
||||
$search = strtolower($this->triggerValue);
|
||||
$part1 = strtolower(substr($source->iban, 0, strlen($search)));
|
||||
$part1 = strtolower(substr((string)$source->iban, 0, strlen($search)));
|
||||
$part2 = strtolower(substr($source->account_number, 0, strlen($search)));
|
||||
|
||||
if ($part1 === $search || $part2 === $search) {
|
||||
|
@ -75,7 +75,7 @@ final class FromAccountStarts extends AbstractTrigger implements TriggerInterfac
|
||||
$repository = app(JournalRepositoryInterface::class);
|
||||
$source = $repository->getSourceAccount($journal);
|
||||
$search = strtolower($this->triggerValue);
|
||||
$part = substr($source->name, 0, strlen($search));
|
||||
$part = strtolower(substr($source->name, 0, strlen($search)));
|
||||
|
||||
if ($part === $search) {
|
||||
Log::debug(
|
||||
|
@ -74,14 +74,14 @@ final class ToAccountNumberContains extends AbstractTrigger implements TriggerIn
|
||||
/** @var JournalRepositoryInterface $repository */
|
||||
$repository = app(JournalRepositoryInterface::class);
|
||||
$dest = $repository->getDestinationAccount($journal);
|
||||
$strpos1 = stripos($dest->iban, $this->triggerValue);
|
||||
$strpos1 = stripos((string)$dest->iban, $this->triggerValue);
|
||||
$strpos2 = stripos($dest->account_number, $this->triggerValue);
|
||||
|
||||
if (!(false === $strpos1) || !(false === $strpos2)) {
|
||||
Log::debug(
|
||||
sprintf(
|
||||
'RuleTrigger %s for journal #%d: "%s" or "%s" contains "%s", return true.',
|
||||
get_class($this), $journal->id, $dest->iban, $dest->account_number, $this->triggerValue
|
||||
get_class($this), $journal->id, (string)$dest->iban, $dest->account_number, $this->triggerValue
|
||||
)
|
||||
);
|
||||
|
||||
@ -91,7 +91,7 @@ final class ToAccountNumberContains extends AbstractTrigger implements TriggerIn
|
||||
Log::debug(
|
||||
sprintf(
|
||||
'RuleTrigger %s for journal #%d: "%s" and "%s" does not contain "%s", return false.',
|
||||
get_class($this), $journal->id, $dest->iban, $dest->account_number, $this->triggerValue
|
||||
get_class($this), $journal->id, (string)$dest->iban, $dest->account_number, $this->triggerValue
|
||||
)
|
||||
);
|
||||
|
||||
|
@ -77,7 +77,7 @@ final class ToAccountNumberEnds extends AbstractTrigger implements TriggerInterf
|
||||
$search = strtolower($this->triggerValue);
|
||||
$searchLength = strlen($search);
|
||||
|
||||
$part1 = substr($dest->iban, $searchLength * -1);
|
||||
$part1 = substr((string)$dest->iban, $searchLength * -1);
|
||||
$part2 = substr($dest->account_number, $searchLength * -1);
|
||||
|
||||
if (strtolower($part1) === $search
|
||||
|
@ -76,11 +76,11 @@ final class ToAccountNumberIs extends AbstractTrigger implements TriggerInterfac
|
||||
$dest = $repository->getDestinationAccount($journal);
|
||||
$search = strtolower($this->triggerValue);
|
||||
|
||||
if (strtolower($dest->iban) === $search || strtolower($dest->account_number) === $search) {
|
||||
if (strtolower((string)$dest->iban) === $search || strtolower($dest->account_number) === $search) {
|
||||
Log::debug(
|
||||
sprintf(
|
||||
'RuleTrigger %s for journal #%d: "%s" or "%s" is "%s", return true.', $journal->id,
|
||||
get_class($this), $dest->iban, $dest->account_number, $search
|
||||
get_class($this), (string)$dest->iban, $dest->account_number, $search
|
||||
)
|
||||
);
|
||||
|
||||
@ -90,7 +90,7 @@ final class ToAccountNumberIs extends AbstractTrigger implements TriggerInterfac
|
||||
Log::debug(
|
||||
sprintf(
|
||||
'RuleTrigger %s for journal #%d: "%s" and "%s" are NOT "%s", return false.',
|
||||
get_class($this), $journal->id, $dest->iban, $dest->account_number, $search
|
||||
get_class($this), $journal->id, (string)$dest->iban, $dest->account_number, $search
|
||||
)
|
||||
);
|
||||
|
||||
|
@ -75,7 +75,7 @@ final class ToAccountNumberStarts extends AbstractTrigger implements TriggerInte
|
||||
$repository = app(JournalRepositoryInterface::class);
|
||||
$dest = $repository->getDestinationAccount($journal);
|
||||
$search = strtolower($this->triggerValue);
|
||||
$part1 = strtolower(substr($dest->iban, 0, strlen($search)));
|
||||
$part1 = strtolower(substr((string)$dest->iban, 0, strlen($search)));
|
||||
$part2 = strtolower(substr($dest->account_number, 0, strlen($search)));
|
||||
|
||||
if ($part1 === $search || $part2 === $search) {
|
||||
|
@ -76,7 +76,7 @@ final class ToAccountStarts extends AbstractTrigger implements TriggerInterface
|
||||
$repository = app(JournalRepositoryInterface::class);
|
||||
$dest = $repository->getDestinationAccount($journal);
|
||||
$search = strtolower($this->triggerValue);
|
||||
$part = substr($dest->name, 0, strlen($search));
|
||||
$part = strtolower(substr($dest->name, 0, strlen($search)));
|
||||
|
||||
if ($part === $search) {
|
||||
Log::debug(
|
||||
|
@ -73,7 +73,7 @@ class NavigationTest extends TestCase
|
||||
['1M', 0, '2019-01-30', '2019-02-28'], // jump to end of next month.
|
||||
['1M', 0, '2019-01-31', '2019-02-28'], // jump to end of next month.
|
||||
['1M', 0, '2019-02-01', '2019-03-01'],
|
||||
['1M', 1, '2019-02-01', '2019-03-31'], // weird but OK.
|
||||
['1M', 1, '2019-02-01', '2019-04-01'], // fixed
|
||||
['1M', 2, '2019-01-01', '2019-04-01'],
|
||||
|
||||
['quarter', 0, '2019-01-01', '2019-04-01'],
|
||||
|
@ -46,8 +46,7 @@ class FromAccountContainsTest extends TestCase
|
||||
/** @var TransactionJournal $journal */
|
||||
$journal = $this->user()->transactionJournals()->inRandomOrder()->first();
|
||||
$account = $this->user()->accounts()->inRandomOrder()->first();
|
||||
$collection = new Collection([$account]);
|
||||
$repository->shouldReceive('getJournalSourceAccounts')->once()->andReturn($collection);
|
||||
$repository->shouldReceive('getSourceAccount')->once()->andReturn($account);
|
||||
|
||||
$trigger = FromAccountContains::makeFromStrings($account->name, false);
|
||||
$result = $trigger->triggered($journal);
|
||||
@ -64,8 +63,7 @@ class FromAccountContainsTest extends TestCase
|
||||
/** @var TransactionJournal $journal */
|
||||
$journal = $this->user()->transactionJournals()->inRandomOrder()->first();
|
||||
$account = $this->user()->accounts()->inRandomOrder()->first();
|
||||
$collection = new Collection([$account]);
|
||||
$repository->shouldReceive('getJournalSourceAccounts')->once()->andReturn($collection);
|
||||
$repository->shouldReceive('getSourceAccount')->once()->andReturn($account);
|
||||
|
||||
$trigger = FromAccountContains::makeFromStrings('some name' . random_int(1, 234), false);
|
||||
$result = $trigger->triggered($journal);
|
||||
|
@ -45,8 +45,7 @@ class FromAccountEndsTest extends TestCase
|
||||
/** @var TransactionJournal $journal */
|
||||
$journal = $this->user()->transactionJournals()->inRandomOrder()->first();
|
||||
$account = $this->user()->accounts()->inRandomOrder()->first();
|
||||
$collection = new Collection([$account]);
|
||||
$repository->shouldReceive('getJournalSourceAccounts')->once()->andReturn($collection);
|
||||
$repository->shouldReceive('getSourceAccount')->once()->andReturn($account);
|
||||
|
||||
$trigger = FromAccountEnds::makeFromStrings(substr($account->name, -3), false);
|
||||
$result = $trigger->triggered($journal);
|
||||
@ -63,8 +62,7 @@ class FromAccountEndsTest extends TestCase
|
||||
/** @var TransactionJournal $journal */
|
||||
$journal = $this->user()->transactionJournals()->inRandomOrder()->first();
|
||||
$account = $this->user()->accounts()->inRandomOrder()->first();
|
||||
$collection = new Collection([$account]);
|
||||
$repository->shouldReceive('getJournalSourceAccounts')->once()->andReturn($collection);
|
||||
$repository->shouldReceive('getSourceAccount')->once()->andReturn($account);
|
||||
|
||||
$trigger = FromAccountEnds::makeFromStrings('bla-bla-bla' . $account->name, false);
|
||||
$result = $trigger->triggered($journal);
|
||||
@ -81,8 +79,7 @@ class FromAccountEndsTest extends TestCase
|
||||
/** @var TransactionJournal $journal */
|
||||
$journal = $this->user()->transactionJournals()->inRandomOrder()->first();
|
||||
$account = $this->user()->accounts()->inRandomOrder()->first();
|
||||
$collection = new Collection([$account]);
|
||||
$repository->shouldReceive('getJournalSourceAccounts')->once()->andReturn($collection);
|
||||
$repository->shouldReceive('getSourceAccount')->once()->andReturn($account);
|
||||
|
||||
$trigger = FromAccountEnds::makeFromStrings('some name' . random_int(1, 234), false);
|
||||
$result = $trigger->triggered($journal);
|
||||
|
@ -46,8 +46,7 @@ class FromAccountIsTest extends TestCase
|
||||
/** @var TransactionJournal $journal */
|
||||
$journal = $this->user()->transactionJournals()->inRandomOrder()->first();
|
||||
$account = $this->user()->accounts()->inRandomOrder()->first();
|
||||
$collection = new Collection([$account]);
|
||||
$repository->shouldReceive('getJournalSourceAccounts')->once()->andReturn($collection);
|
||||
$repository->shouldReceive('getSourceAccount')->once()->andReturn($account);
|
||||
|
||||
|
||||
$trigger = FromAccountIs::makeFromStrings($account->name, false);
|
||||
@ -65,8 +64,7 @@ class FromAccountIsTest extends TestCase
|
||||
/** @var TransactionJournal $journal */
|
||||
$journal = $this->user()->transactionJournals()->inRandomOrder()->first();
|
||||
$account = $this->user()->accounts()->inRandomOrder()->first();
|
||||
$collection = new Collection([$account]);
|
||||
$repository->shouldReceive('getJournalSourceAccounts')->once()->andReturn($collection);
|
||||
$repository->shouldReceive('getSourceAccount')->once()->andReturn($account);
|
||||
|
||||
$trigger = FromAccountIs::makeFromStrings('some name' . random_int(1, 234), false);
|
||||
$result = $trigger->triggered($journal);
|
||||
|
@ -0,0 +1,161 @@
|
||||
<?php
|
||||
/**
|
||||
* FromAccountNumberContainsTest.php
|
||||
* Copyright (c) 2019 thegrumpydictator@gmail.com
|
||||
*
|
||||
* This file is part of Firefly III (https://github.com/firefly-iii).
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Tests\Unit\TransactionRules\Triggers;
|
||||
|
||||
use FireflyIII\Models\AccountMeta;
|
||||
use FireflyIII\Models\TransactionJournal;
|
||||
use FireflyIII\Repositories\Journal\JournalRepositoryInterface;
|
||||
use FireflyIII\TransactionRules\Triggers\FromAccountNumberContains;
|
||||
use Tests\TestCase;
|
||||
|
||||
/**
|
||||
* Class FromAccountNumberContainsTest
|
||||
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
|
||||
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
|
||||
* @SuppressWarnings(PHPMD.TooManyPublicMethods)
|
||||
*/
|
||||
class FromAccountNumberContainsTest extends TestCase
|
||||
{
|
||||
/**
|
||||
* @covers \FireflyIII\TransactionRules\Triggers\FromAccountContains
|
||||
*/
|
||||
public function testTriggeredBoth(): void
|
||||
{
|
||||
$repository = $this->mock(JournalRepositoryInterface::class);
|
||||
|
||||
/** @var TransactionJournal $journal */
|
||||
$journal = $this->user()->transactionJournals()->inRandomOrder()->first();
|
||||
$account = $this->user()->accounts()->inRandomOrder()->first();
|
||||
|
||||
$account->iban = 'FR7620041010053537027625181';
|
||||
$account->save();
|
||||
$meta = new AccountMeta;
|
||||
$meta->account_id = $account->id;
|
||||
$meta->name = 'account_number';
|
||||
$meta->data= '7027625181';
|
||||
$meta->save();
|
||||
|
||||
$repository->shouldReceive('getSourceAccount')->once()->andReturn($account);
|
||||
|
||||
$trigger = FromAccountNumberContains::makeFromStrings('7027', false);
|
||||
$result = $trigger->triggered($journal);
|
||||
$this->assertTrue($result);
|
||||
|
||||
$meta->forceDelete();
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\TransactionRules\Triggers\FromAccountContains
|
||||
*/
|
||||
public function testTriggeredIban(): void
|
||||
{
|
||||
$repository = $this->mock(JournalRepositoryInterface::class);
|
||||
|
||||
/** @var TransactionJournal $journal */
|
||||
$journal = $this->user()->transactionJournals()->inRandomOrder()->first();
|
||||
$account = $this->user()->accounts()->inRandomOrder()->first();
|
||||
$account->iban = 'FR7620041010053537027625181';
|
||||
$account->save();
|
||||
$repository->shouldReceive('getSourceAccount')->once()->andReturn($account);
|
||||
|
||||
$trigger = FromAccountNumberContains::makeFromStrings('7027', false);
|
||||
$result = $trigger->triggered($journal);
|
||||
$this->assertTrue($result);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\TransactionRules\Triggers\FromAccountContains
|
||||
*/
|
||||
public function testTriggeredNot(): void
|
||||
{
|
||||
$repository = $this->mock(JournalRepositoryInterface::class);
|
||||
|
||||
/** @var TransactionJournal $journal */
|
||||
$journal = $this->user()->transactionJournals()->inRandomOrder()->first();
|
||||
$account = $this->user()->accounts()->inRandomOrder()->first();
|
||||
$repository->shouldReceive('getSourceAccount')->once()->andReturn($account);
|
||||
|
||||
$trigger = FromAccountContains::makeFromStrings('some name' . random_int(1, 234), false);
|
||||
$result = $trigger->triggered($journal);
|
||||
$this->assertFalse($result);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\TransactionRules\Triggers\FromAccountContains
|
||||
*/
|
||||
public function testTriggeredNumber(): void
|
||||
{
|
||||
$repository = $this->mock(JournalRepositoryInterface::class);
|
||||
|
||||
/** @var TransactionJournal $journal */
|
||||
$journal = $this->user()->transactionJournals()->inRandomOrder()->first();
|
||||
$account = $this->user()->accounts()->inRandomOrder()->first();
|
||||
$repository->shouldReceive('getSourceAccount')->once()->andReturn($account);
|
||||
|
||||
$meta = new AccountMeta;
|
||||
$meta->account_id = $account->id;
|
||||
$meta->name = 'account_number';
|
||||
$meta->data= '7027625181';
|
||||
$meta->save();
|
||||
|
||||
$trigger = FromAccountNumberContains::makeFromStrings('276251', false);
|
||||
$result = $trigger->triggered($journal);
|
||||
$this->assertTrue($result);
|
||||
$meta->forceDelete();
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\TransactionRules\Triggers\FromAccountContains
|
||||
*/
|
||||
public function testWillMatchEverythingEmpty(): void
|
||||
{
|
||||
$repository = $this->mock(JournalRepositoryInterface::class);
|
||||
$value = '';
|
||||
$result = FromAccountContains::willMatchEverything($value);
|
||||
$this->assertTrue($result);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\TransactionRules\Triggers\FromAccountContains
|
||||
*/
|
||||
public function testWillMatchEverythingNotNull(): void
|
||||
{
|
||||
$repository = $this->mock(JournalRepositoryInterface::class);
|
||||
$value = 'x';
|
||||
$result = FromAccountContains::willMatchEverything($value);
|
||||
$this->assertFalse($result);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\TransactionRules\Triggers\FromAccountContains
|
||||
*/
|
||||
public function testWillMatchEverythingNull(): void
|
||||
{
|
||||
$repository = $this->mock(JournalRepositoryInterface::class);
|
||||
$value = null;
|
||||
$result = FromAccountContains::willMatchEverything($value);
|
||||
$this->assertTrue($result);
|
||||
}
|
||||
}
|
@ -57,8 +57,7 @@ class FromAccountStartsTest extends TestCase
|
||||
/** @var TransactionJournal $journal */
|
||||
$journal = $this->user()->transactionJournals()->inRandomOrder()->first();
|
||||
$account = $this->user()->accounts()->inRandomOrder()->first();
|
||||
$collection = new Collection([$account]);
|
||||
$repository->shouldReceive('getJournalSourceAccounts')->once()->andReturn($collection);
|
||||
$repository->shouldReceive('getSourceAccount')->once()->andReturn($account);
|
||||
|
||||
$trigger = FromAccountStarts::makeFromStrings(substr($account->name, 0, -3), false);
|
||||
$result = $trigger->triggered($journal);
|
||||
@ -76,8 +75,7 @@ class FromAccountStartsTest extends TestCase
|
||||
/** @var TransactionJournal $journal */
|
||||
$journal = $this->user()->transactionJournals()->inRandomOrder()->first();
|
||||
$account = $this->user()->accounts()->inRandomOrder()->first();
|
||||
$collection = new Collection([$account]);
|
||||
$repository->shouldReceive('getJournalSourceAccounts')->once()->andReturn($collection);
|
||||
$repository->shouldReceive('getSourceAccount')->once()->andReturn($account);
|
||||
|
||||
$trigger = FromAccountStarts::makeFromStrings('bla-bla-bla' . $account->name, false);
|
||||
$result = $trigger->triggered($journal);
|
||||
@ -95,8 +93,7 @@ class FromAccountStartsTest extends TestCase
|
||||
/** @var TransactionJournal $journal */
|
||||
$journal = $this->user()->transactionJournals()->inRandomOrder()->first();
|
||||
$account = $this->user()->accounts()->inRandomOrder()->first();
|
||||
$collection = new Collection([$account]);
|
||||
$repository->shouldReceive('getJournalSourceAccounts')->once()->andReturn($collection);
|
||||
$repository->shouldReceive('getSourceAccount')->once()->andReturn($account);
|
||||
|
||||
$trigger = FromAccountStarts::makeFromStrings('some name' . random_int(1, 234), false);
|
||||
$result = $trigger->triggered($journal);
|
||||
|
@ -46,8 +46,7 @@ class ToAccountContainsTest extends TestCase
|
||||
/** @var TransactionJournal $journal */
|
||||
$journal = $this->user()->transactionJournals()->inRandomOrder()->first();
|
||||
$account = $this->user()->accounts()->inRandomOrder()->first();
|
||||
$collection = new Collection([$account]);
|
||||
$repository->shouldReceive('getJournalDestinationAccounts')->once()->andReturn($collection);
|
||||
$repository->shouldReceive('getDestinationAccount')->once()->andReturn($account);
|
||||
|
||||
|
||||
$trigger = ToAccountContains::makeFromStrings($account->name, false);
|
||||
@ -65,8 +64,7 @@ class ToAccountContainsTest extends TestCase
|
||||
/** @var TransactionJournal $journal */
|
||||
$journal = $this->user()->transactionJournals()->inRandomOrder()->first();
|
||||
$account = $this->user()->accounts()->inRandomOrder()->first();
|
||||
$collection = new Collection([$account]);
|
||||
$repository->shouldReceive('getJournalDestinationAccounts')->once()->andReturn($collection);
|
||||
$repository->shouldReceive('getDestinationAccount')->once()->andReturn($account);
|
||||
|
||||
|
||||
$trigger = ToAccountContains::makeFromStrings('some name' . random_int(1, 234), false);
|
||||
|
@ -46,8 +46,7 @@ class ToAccountEndsTest extends TestCase
|
||||
/** @var TransactionJournal $journal */
|
||||
$journal = $this->user()->transactionJournals()->inRandomOrder()->first();
|
||||
$account = $this->user()->accounts()->inRandomOrder()->first();
|
||||
$collection = new Collection([$account]);
|
||||
$repository->shouldReceive('getJournalDestinationAccounts')->once()->andReturn($collection);
|
||||
$repository->shouldReceive('getDestinationAccount')->once()->andReturn($account);
|
||||
|
||||
$trigger = ToAccountEnds::makeFromStrings(substr($account->name, -3), false);
|
||||
$result = $trigger->triggered($journal);
|
||||
@ -64,8 +63,7 @@ class ToAccountEndsTest extends TestCase
|
||||
/** @var TransactionJournal $journal */
|
||||
$journal = $this->user()->transactionJournals()->inRandomOrder()->first();
|
||||
$account = $this->user()->accounts()->inRandomOrder()->first();
|
||||
$collection = new Collection([$account]);
|
||||
$repository->shouldReceive('getJournalDestinationAccounts')->once()->andReturn($collection);
|
||||
$repository->shouldReceive('getDestinationAccount')->once()->andReturn($account);
|
||||
|
||||
$trigger = ToAccountEnds::makeFromStrings('bla-bla-bla' . $account->name, false);
|
||||
$result = $trigger->triggered($journal);
|
||||
@ -82,8 +80,7 @@ class ToAccountEndsTest extends TestCase
|
||||
/** @var TransactionJournal $journal */
|
||||
$journal = $this->user()->transactionJournals()->inRandomOrder()->first();
|
||||
$account = $this->user()->accounts()->inRandomOrder()->first();
|
||||
$collection = new Collection([$account]);
|
||||
$repository->shouldReceive('getJournalDestinationAccounts')->once()->andReturn($collection);
|
||||
$repository->shouldReceive('getDestinationAccount')->once()->andReturn($account);
|
||||
|
||||
$trigger = ToAccountEnds::makeFromStrings((string)$this->randomInt(), false);
|
||||
$result = $trigger->triggered($journal);
|
||||
|
@ -46,8 +46,7 @@ class ToAccountIsTest extends TestCase
|
||||
/** @var TransactionJournal $journal */
|
||||
$journal = $this->user()->transactionJournals()->inRandomOrder()->first();
|
||||
$account = $this->user()->accounts()->inRandomOrder()->first();
|
||||
$collection = new Collection([$account]);
|
||||
$repository->shouldReceive('getJournalDestinationAccounts')->once()->andReturn($collection);
|
||||
$repository->shouldReceive('getDestinationAccount')->once()->andReturn($account);
|
||||
|
||||
|
||||
$trigger = ToAccountIs::makeFromStrings($account->name, false);
|
||||
@ -65,8 +64,7 @@ class ToAccountIsTest extends TestCase
|
||||
/** @var TransactionJournal $journal */
|
||||
$journal = $this->user()->transactionJournals()->inRandomOrder()->first();
|
||||
$account = $this->user()->accounts()->inRandomOrder()->first();
|
||||
$collection = new Collection([$account]);
|
||||
$repository->shouldReceive('getJournalDestinationAccounts')->once()->andReturn($collection);
|
||||
$repository->shouldReceive('getDestinationAccount')->once()->andReturn($account);
|
||||
|
||||
$trigger = ToAccountIs::makeFromStrings('some name' . random_int(1, 234), false);
|
||||
$result = $trigger->triggered($journal);
|
||||
|
@ -46,8 +46,7 @@ class ToAccountStartsTest extends TestCase
|
||||
/** @var TransactionJournal $journal */
|
||||
$journal = $this->user()->transactionJournals()->inRandomOrder()->first();
|
||||
$account = $this->user()->accounts()->inRandomOrder()->first();
|
||||
$collection = new Collection([$account]);
|
||||
$repository->shouldReceive('getJournalDestinationAccounts')->once()->andReturn($collection);
|
||||
$repository->shouldReceive('getDestinationAccount')->once()->andReturn($account);
|
||||
|
||||
|
||||
$trigger = ToAccountStarts::makeFromStrings(substr($account->name, 0, -3), false);
|
||||
@ -65,8 +64,7 @@ class ToAccountStartsTest extends TestCase
|
||||
/** @var TransactionJournal $journal */
|
||||
$journal = $this->user()->transactionJournals()->inRandomOrder()->first();
|
||||
$account = $this->user()->accounts()->inRandomOrder()->first();
|
||||
$collection = new Collection([$account]);
|
||||
$repository->shouldReceive('getJournalDestinationAccounts')->once()->andReturn($collection);
|
||||
$repository->shouldReceive('getDestinationAccount')->once()->andReturn($account);
|
||||
|
||||
$trigger = ToAccountStarts::makeFromStrings('bla-bla-bla' . $account->name, false);
|
||||
$result = $trigger->triggered($journal);
|
||||
@ -83,8 +81,7 @@ class ToAccountStartsTest extends TestCase
|
||||
/** @var TransactionJournal $journal */
|
||||
$journal = $this->user()->transactionJournals()->inRandomOrder()->first();
|
||||
$account = $this->user()->accounts()->inRandomOrder()->first();
|
||||
$collection = new Collection([$account]);
|
||||
$repository->shouldReceive('getJournalDestinationAccounts')->once()->andReturn($collection);
|
||||
$repository->shouldReceive('getDestinationAccount')->once()->andReturn($account);
|
||||
|
||||
$trigger = ToAccountStarts::makeFromStrings('some name' . random_int(1, 234), false);
|
||||
$result = $trigger->triggered($journal);
|
||||
|
Loading…
Reference in New Issue
Block a user