mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-12 23:45:10 +00:00
Update tests so repositories are not called. Saves on DB calls, speeds up tests.
This commit is contained in:
@@ -23,6 +23,7 @@ declare(strict_types=1);
|
||||
namespace Tests\Unit\TransactionRules\Triggers;
|
||||
|
||||
use FireflyIII\Models\TransactionJournal;
|
||||
use FireflyIII\Repositories\Account\AccountRepositoryInterface;
|
||||
use FireflyIII\Repositories\Journal\JournalRepositoryInterface;
|
||||
use FireflyIII\TransactionRules\Triggers\FromAccountStarts;
|
||||
use Illuminate\Support\Collection;
|
||||
@@ -49,7 +50,7 @@ class FromAccountStartsTest extends TestCase
|
||||
public function testTriggered(): void
|
||||
{
|
||||
$repository = $this->mock(JournalRepositoryInterface::class);
|
||||
|
||||
$accountRepos = $this->mock(AccountRepositoryInterface::class);
|
||||
/** @var TransactionJournal $journal */
|
||||
$journal = $this->user()->transactionJournals()->inRandomOrder()->first();
|
||||
$account = $this->user()->accounts()->inRandomOrder()->first();
|
||||
@@ -67,6 +68,7 @@ class FromAccountStartsTest extends TestCase
|
||||
public function testTriggeredLonger(): void
|
||||
{
|
||||
$repository = $this->mock(JournalRepositoryInterface::class);
|
||||
$accountRepos = $this->mock(AccountRepositoryInterface::class);
|
||||
|
||||
/** @var TransactionJournal $journal */
|
||||
$journal = $this->user()->transactionJournals()->inRandomOrder()->first();
|
||||
@@ -85,6 +87,7 @@ class FromAccountStartsTest extends TestCase
|
||||
public function testTriggeredNot(): void
|
||||
{
|
||||
$repository = $this->mock(JournalRepositoryInterface::class);
|
||||
$accountRepos = $this->mock(AccountRepositoryInterface::class);
|
||||
|
||||
/** @var TransactionJournal $journal */
|
||||
$journal = $this->user()->transactionJournals()->inRandomOrder()->first();
|
||||
@@ -103,6 +106,8 @@ class FromAccountStartsTest extends TestCase
|
||||
public function testWillMatchEverythingEmpty(): void
|
||||
{
|
||||
$repository = $this->mock(JournalRepositoryInterface::class);
|
||||
$accountRepos = $this->mock(AccountRepositoryInterface::class);
|
||||
|
||||
$value = '';
|
||||
$result = FromAccountStarts::willMatchEverything($value);
|
||||
$this->assertTrue($result);
|
||||
@@ -114,6 +119,8 @@ class FromAccountStartsTest extends TestCase
|
||||
public function testWillMatchEverythingNotNull(): void
|
||||
{
|
||||
$repository = $this->mock(JournalRepositoryInterface::class);
|
||||
$accountRepos = $this->mock(AccountRepositoryInterface::class);
|
||||
|
||||
$value = 'x';
|
||||
$result = FromAccountStarts::willMatchEverything($value);
|
||||
$this->assertFalse($result);
|
||||
@@ -125,6 +132,8 @@ class FromAccountStartsTest extends TestCase
|
||||
public function testWillMatchEverythingNull(): void
|
||||
{
|
||||
$repository = $this->mock(JournalRepositoryInterface::class);
|
||||
$accountRepos = $this->mock(AccountRepositoryInterface::class);
|
||||
|
||||
$value = null;
|
||||
$result = FromAccountStarts::willMatchEverything($value);
|
||||
$this->assertTrue($result);
|
||||
|
Reference in New Issue
Block a user