mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-12 15:35:15 +00:00
Update test code.
This commit is contained in:
@@ -37,7 +37,7 @@ class AddTagTest extends TestCase
|
||||
* @covers \FireflyIII\TransactionRules\Actions\AddTag::__construct
|
||||
* @covers \FireflyIII\TransactionRules\Actions\AddTag::act()
|
||||
*/
|
||||
public function testActExistingTag()
|
||||
public function testActExistingTag(): void
|
||||
{
|
||||
$tag = Tag::inRandomOrder()->whereNull('deleted_at')->first();
|
||||
$journal = TransactionJournal::inRandomOrder()->whereNull('deleted_at')->first();
|
||||
@@ -55,7 +55,7 @@ class AddTagTest extends TestCase
|
||||
/**
|
||||
* @covers \FireflyIII\TransactionRules\Actions\AddTag::act()
|
||||
*/
|
||||
public function testActNoTag()
|
||||
public function testActNoTag(): void
|
||||
{
|
||||
$journal = TransactionJournal::inRandomOrder()->whereNull('deleted_at')->first();
|
||||
$ruleAction = new RuleAction;
|
||||
|
@@ -36,7 +36,7 @@ class AppendDescriptionTest extends TestCase
|
||||
* @covers \FireflyIII\TransactionRules\Actions\AppendDescription::__construct
|
||||
* @covers \FireflyIII\TransactionRules\Actions\AppendDescription::act()
|
||||
*/
|
||||
public function testActExistingTag()
|
||||
public function testActExistingTag(): void
|
||||
{
|
||||
$ruleAction = new RuleAction;
|
||||
$ruleAction->action_value = 'APPEND';
|
||||
|
@@ -37,7 +37,7 @@ class AppendNotesTest extends TestCase
|
||||
* @covers \FireflyIII\TransactionRules\Actions\AppendNotes::__construct()
|
||||
* @covers \FireflyIII\TransactionRules\Actions\AppendNotes::act()
|
||||
*/
|
||||
public function testAct()
|
||||
public function testAct(): void
|
||||
{
|
||||
// give journal some notes.
|
||||
$journal = TransactionJournal::find(3);
|
||||
@@ -66,7 +66,7 @@ class AppendNotesTest extends TestCase
|
||||
* @covers \FireflyIII\TransactionRules\Actions\AppendNotes::__construct()
|
||||
* @covers \FireflyIII\TransactionRules\Actions\AppendNotes::act()
|
||||
*/
|
||||
public function testActNewNote()
|
||||
public function testActNewNote(): void
|
||||
{
|
||||
// give journal some notes.
|
||||
$journal = TransactionJournal::find(4);
|
||||
|
@@ -37,7 +37,7 @@ class ClearBudgetTest extends TestCase
|
||||
* @covers \FireflyIII\TransactionRules\Actions\ClearBudget::__construct()
|
||||
* @covers \FireflyIII\TransactionRules\Actions\ClearBudget::act()
|
||||
*/
|
||||
public function testAct()
|
||||
public function testAct(): void
|
||||
{
|
||||
// associate budget with journal:
|
||||
$journal = TransactionJournal::inRandomOrder()->whereNull('deleted_at')->first();
|
||||
|
@@ -37,7 +37,7 @@ class ClearCategoryTest extends TestCase
|
||||
* @covers \FireflyIII\TransactionRules\Actions\ClearCategory::__construct()
|
||||
* @covers \FireflyIII\TransactionRules\Actions\ClearCategory::act()
|
||||
*/
|
||||
public function testAct()
|
||||
public function testAct(): void
|
||||
{
|
||||
// associate budget with journal:
|
||||
$journal = TransactionJournal::inRandomOrder()->whereNull('deleted_at')->first();
|
||||
|
@@ -22,6 +22,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace Tests\Unit\TransactionRules\Actions;
|
||||
|
||||
use Exception;
|
||||
use FireflyIII\Models\Note;
|
||||
use FireflyIII\Models\RuleAction;
|
||||
use FireflyIII\Models\TransactionJournal;
|
||||
@@ -37,7 +38,7 @@ class ClearNotesTest extends TestCase
|
||||
* @covers \FireflyIII\TransactionRules\Actions\ClearNotes::__construct()
|
||||
* @covers \FireflyIII\TransactionRules\Actions\ClearNotes::act()
|
||||
*/
|
||||
public function testAct()
|
||||
public function testAct(): void
|
||||
{
|
||||
// give journal a note:
|
||||
$journal = TransactionJournal::inRandomOrder()->whereNull('deleted_at')->first();
|
||||
@@ -54,7 +55,11 @@ class ClearNotesTest extends TestCase
|
||||
$ruleAction = new RuleAction;
|
||||
$ruleAction->action_value = null;
|
||||
$action = new ClearNotes($ruleAction);
|
||||
$result = $action->act($journal);
|
||||
try {
|
||||
$result = $action->act($journal);
|
||||
} catch (Exception $e) {
|
||||
$this->assertTrue(false, $e->getMessage());
|
||||
}
|
||||
$this->assertTrue($result);
|
||||
|
||||
// assert result
|
||||
|
@@ -36,7 +36,7 @@ class PrependDescriptionTest extends TestCase
|
||||
* @covers \FireflyIII\TransactionRules\Actions\PrependDescription::__construct()
|
||||
* @covers \FireflyIII\TransactionRules\Actions\PrependDescription::act()
|
||||
*/
|
||||
public function testAct()
|
||||
public function testAct(): void
|
||||
{
|
||||
// get journal, give fixed description
|
||||
$description = 'text' . random_int(1, 1000);
|
||||
|
@@ -37,7 +37,7 @@ class PrependNotesTest extends TestCase
|
||||
* @covers \FireflyIII\TransactionRules\Actions\PrependNotes::__construct()
|
||||
* @covers \FireflyIII\TransactionRules\Actions\PrependNotes::act()
|
||||
*/
|
||||
public function testAct()
|
||||
public function testAct(): void
|
||||
{
|
||||
// give journal some notes.
|
||||
$journal = TransactionJournal::inRandomOrder()->whereNull('deleted_at')->first();
|
||||
@@ -66,7 +66,7 @@ class PrependNotesTest extends TestCase
|
||||
* @covers \FireflyIII\TransactionRules\Actions\PrependNotes::__construct()
|
||||
* @covers \FireflyIII\TransactionRules\Actions\PrependNotes::act()
|
||||
*/
|
||||
public function testActNewNote()
|
||||
public function testActNewNote(): void
|
||||
{
|
||||
// give journal some notes.
|
||||
$journal = TransactionJournal::inRandomOrder()->whereNull('deleted_at')->first();
|
||||
|
@@ -37,7 +37,7 @@ class RemoveAllTagsTest extends TestCase
|
||||
* @covers \FireflyIII\TransactionRules\Actions\RemoveAllTags::__construct()
|
||||
* @covers \FireflyIII\TransactionRules\Actions\RemoveAllTags::act()
|
||||
*/
|
||||
public function testAct()
|
||||
public function testAct(): void
|
||||
{
|
||||
// find journal with at least one tag
|
||||
$journalIds = DB::table('tag_transaction_journal')->get(['transaction_journal_id'])->pluck('transaction_journal_id')->toArray();
|
||||
|
@@ -37,7 +37,7 @@ class RemoveTagTest extends TestCase
|
||||
* @covers \FireflyIII\TransactionRules\Actions\RemoveTag::__construct()
|
||||
* @covers \FireflyIII\TransactionRules\Actions\RemoveTag::act()
|
||||
*/
|
||||
public function testAct()
|
||||
public function testAct(): void
|
||||
{
|
||||
|
||||
// find journal with at least one tag
|
||||
@@ -64,7 +64,7 @@ class RemoveTagTest extends TestCase
|
||||
* @covers \FireflyIII\TransactionRules\Actions\RemoveTag::__construct()
|
||||
* @covers \FireflyIII\TransactionRules\Actions\RemoveTag::act()
|
||||
*/
|
||||
public function testActNoTag()
|
||||
public function testActNoTag(): void
|
||||
{
|
||||
// get journal, link al tags:
|
||||
/** @var TransactionJournal $journal */
|
||||
|
@@ -39,7 +39,7 @@ class SetBudgetTest extends TestCase
|
||||
* @covers \FireflyIII\TransactionRules\Actions\SetBudget::__construct()
|
||||
* @covers \FireflyIII\TransactionRules\Actions\SetBudget::act()
|
||||
*/
|
||||
public function testAct()
|
||||
public function testAct(): void
|
||||
{
|
||||
// get journal, remove all budgets
|
||||
$journal = TransactionJournal::inRandomOrder()->where('transaction_type_id', 1)->whereNull('deleted_at')->first();
|
||||
|
@@ -37,7 +37,7 @@ class SetCategoryTest extends TestCase
|
||||
* @covers \FireflyIII\TransactionRules\Actions\SetCategory::__construct()
|
||||
* @covers \FireflyIII\TransactionRules\Actions\SetCategory::act()
|
||||
*/
|
||||
public function testAct()
|
||||
public function testAct(): void
|
||||
{
|
||||
// get journal, remove all budgets
|
||||
$journal = TransactionJournal::inRandomOrder()->whereNull('deleted_at')->first();
|
||||
|
@@ -36,7 +36,7 @@ class SetDescriptionTest extends TestCase
|
||||
* @covers \FireflyIII\TransactionRules\Actions\SetDescription::__construct()
|
||||
* @covers \FireflyIII\TransactionRules\Actions\SetDescription::act()
|
||||
*/
|
||||
public function testAct()
|
||||
public function testAct(): void
|
||||
{
|
||||
// get journal, give fixed description
|
||||
$description = 'text' . random_int(1, 1000);
|
||||
|
@@ -44,7 +44,7 @@ class SetDestinationAccountTest extends TestCase
|
||||
*
|
||||
* @covers \FireflyIII\TransactionRules\Actions\SetDestinationAccount
|
||||
*/
|
||||
public function testActDepositExisting()
|
||||
public function testActDepositExisting(): void
|
||||
{
|
||||
$accountRepos = $this->mock(AccountRepositoryInterface::class);
|
||||
$type = TransactionType::whereType(TransactionType::DEPOSIT)->first();
|
||||
@@ -86,7 +86,7 @@ class SetDestinationAccountTest extends TestCase
|
||||
*
|
||||
* @covers \FireflyIII\TransactionRules\Actions\SetDestinationAccount
|
||||
*/
|
||||
public function testActDepositNotExisting()
|
||||
public function testActDepositNotExisting(): void
|
||||
{
|
||||
$accountRepos = $this->mock(AccountRepositoryInterface::class);
|
||||
$type = TransactionType::whereType(TransactionType::DEPOSIT)->first();
|
||||
@@ -114,7 +114,7 @@ class SetDestinationAccountTest extends TestCase
|
||||
*
|
||||
* @covers \FireflyIII\TransactionRules\Actions\SetDestinationAccount
|
||||
*/
|
||||
public function testActWithDrawalNotExisting()
|
||||
public function testActWithDrawalNotExisting(): void
|
||||
{
|
||||
$accountRepos = $this->mock(AccountRepositoryInterface::class);
|
||||
$type = TransactionType::whereType(TransactionType::WITHDRAWAL)->first();
|
||||
@@ -146,7 +146,7 @@ class SetDestinationAccountTest extends TestCase
|
||||
*
|
||||
* @covers \FireflyIII\TransactionRules\Actions\SetDestinationAccount
|
||||
*/
|
||||
public function testActWithdrawalExisting()
|
||||
public function testActWithdrawalExisting(): void
|
||||
{
|
||||
$accountRepos = $this->mock(AccountRepositoryInterface::class);
|
||||
$type = TransactionType::whereType(TransactionType::WITHDRAWAL)->first();
|
||||
@@ -189,7 +189,7 @@ class SetDestinationAccountTest extends TestCase
|
||||
*
|
||||
* @covers \FireflyIII\TransactionRules\Actions\SetDestinationAccount
|
||||
*/
|
||||
public function testSplitJournal()
|
||||
public function testSplitJournal(): void
|
||||
{
|
||||
$accountRepos = $this->mock(AccountRepositoryInterface::class);
|
||||
$transaction = Transaction::orderBy('count', 'DESC')->groupBy('transaction_journal_id')
|
||||
|
@@ -37,7 +37,7 @@ class SetNotesTest extends TestCase
|
||||
* @covers \FireflyIII\TransactionRules\Actions\SetNotes::__construct()
|
||||
* @covers \FireflyIII\TransactionRules\Actions\SetNotes::act()
|
||||
*/
|
||||
public function testAct()
|
||||
public function testAct(): void
|
||||
{
|
||||
// give journal a note:
|
||||
$journal = TransactionJournal::inRandomOrder()->whereNull('deleted_at')->first();
|
||||
@@ -66,7 +66,7 @@ class SetNotesTest extends TestCase
|
||||
* @covers \FireflyIII\TransactionRules\Actions\SetNotes::__construct()
|
||||
* @covers \FireflyIII\TransactionRules\Actions\SetNotes::act()
|
||||
*/
|
||||
public function testActNoNotes()
|
||||
public function testActNoNotes(): void
|
||||
{
|
||||
// give journal a note:
|
||||
$journal = TransactionJournal::inRandomOrder()->whereNull('deleted_at')->first();
|
||||
|
@@ -42,7 +42,7 @@ class SetSourceAccountTest extends TestCase
|
||||
*
|
||||
* @covers \FireflyIII\TransactionRules\Actions\SetSourceAccount
|
||||
*/
|
||||
public function testActDepositExistingUpdated()
|
||||
public function testActDepositExistingUpdated(): void
|
||||
{
|
||||
$accountRepos = $this->mock(AccountRepositoryInterface::class);
|
||||
|
||||
@@ -86,7 +86,7 @@ class SetSourceAccountTest extends TestCase
|
||||
*
|
||||
* @covers \FireflyIII\TransactionRules\Actions\SetSourceAccount
|
||||
*/
|
||||
public function testActDepositRevenue()
|
||||
public function testActDepositRevenue(): void
|
||||
{
|
||||
$accountRepos = $this->mock(AccountRepositoryInterface::class);
|
||||
$type = TransactionType::whereType(TransactionType::DEPOSIT)->first();
|
||||
@@ -115,7 +115,7 @@ class SetSourceAccountTest extends TestCase
|
||||
*
|
||||
* @covers \FireflyIII\TransactionRules\Actions\SetSourceAccount
|
||||
*/
|
||||
public function testActWithdrawalExistingUpdated()
|
||||
public function testActWithdrawalExistingUpdated(): void
|
||||
{
|
||||
$accountRepos = $this->mock(AccountRepositoryInterface::class);
|
||||
$type = TransactionType::whereType(TransactionType::WITHDRAWAL)->first();
|
||||
@@ -157,7 +157,7 @@ class SetSourceAccountTest extends TestCase
|
||||
*
|
||||
* @covers \FireflyIII\TransactionRules\Actions\SetSourceAccount
|
||||
*/
|
||||
public function testActWithdrawalNotExisting()
|
||||
public function testActWithdrawalNotExisting(): void
|
||||
{
|
||||
$accountRepos = $this->mock(AccountRepositoryInterface::class);
|
||||
$type = TransactionType::whereType(TransactionType::WITHDRAWAL)->first();
|
||||
@@ -184,7 +184,7 @@ class SetSourceAccountTest extends TestCase
|
||||
*
|
||||
* @covers \FireflyIII\TransactionRules\Actions\SetSourceAccount
|
||||
*/
|
||||
public function testSplitJournal()
|
||||
public function testSplitJournal(): void
|
||||
{
|
||||
$accountRepos = $this->mock(AccountRepositoryInterface::class);
|
||||
$transaction = Transaction::orderBy('count', 'DESC')->groupBy('transaction_journal_id')
|
||||
|
Reference in New Issue
Block a user