mirror of
				https://github.com/firefly-iii/firefly-iii.git
				synced 2025-10-31 10:47:00 +00:00 
			
		
		
		
	Update test code.
This commit is contained in:
		| @@ -24,6 +24,7 @@ declare(strict_types=1); | ||||
| namespace Tests\Unit\Transformers; | ||||
|  | ||||
|  | ||||
| use FireflyIII\Exceptions\FireflyException; | ||||
| use FireflyIII\Helpers\Collector\JournalCollector; | ||||
| use FireflyIII\Helpers\Filter\NegativeAmountFilter; | ||||
| use FireflyIII\Helpers\Filter\PositiveAmountFilter; | ||||
| @@ -48,9 +49,8 @@ class TransactionTransformerTest extends TestCase | ||||
|      * Basic journal (withdrawal) | ||||
|      * | ||||
|      * @covers \FireflyIII\Transformers\TransactionTransformer::transform | ||||
|      * throws \FireflyIII\Exceptions\FireflyException | ||||
|      */ | ||||
|     public function testBasic() | ||||
|     public function testBasic(): void | ||||
|     { | ||||
|         // make new asset account: | ||||
|         $asset = Account::create( | ||||
| @@ -103,7 +103,11 @@ class TransactionTransformerTest extends TestCase | ||||
|         // use collector to get it: | ||||
|         $transaction = $this->getTransaction($journal); | ||||
|         $transformer = new TransactionTransformer(new ParameterBag); | ||||
|         $result      = $transformer->transform($transaction); | ||||
|         try { | ||||
|             $result = $transformer->transform($transaction); | ||||
|         } catch (FireflyException $e) { | ||||
|             $this->assertTrue(false, $e->getMessage()); | ||||
|         } | ||||
|         // basic fields: | ||||
|         $this->assertEquals($journal->id, $result['journal_id']); | ||||
|         $this->assertEquals('Withdrawal', $result['type']); | ||||
| @@ -134,7 +138,7 @@ class TransactionTransformerTest extends TestCase | ||||
|      * @covers \FireflyIII\Transformers\TransactionTransformer::transform | ||||
|      * throws \FireflyIII\Exceptions\FireflyException | ||||
|      */ | ||||
|     public function testDeposit() | ||||
|     public function testDeposit(): void | ||||
|     { | ||||
|         // make new asset account: | ||||
|         $asset = Account::create( | ||||
| @@ -187,7 +191,11 @@ class TransactionTransformerTest extends TestCase | ||||
|         // use collector to get it: | ||||
|         $transaction = $this->getTransaction($journal); | ||||
|         $transformer = new TransactionTransformer(new ParameterBag); | ||||
|         $result      = $transformer->transform($transaction); | ||||
|         try { | ||||
|             $result = $transformer->transform($transaction); | ||||
|         } catch (FireflyException $e) { | ||||
|             $this->assertTrue(false, $e->getMessage()); | ||||
|         } | ||||
|         // basic fields: | ||||
|         $this->assertEquals($journal->id, $result['journal_id']); | ||||
|         $this->assertEquals('Deposit', $result['type']); | ||||
| @@ -218,7 +226,7 @@ class TransactionTransformerTest extends TestCase | ||||
|      * @covers \FireflyIII\Transformers\TransactionTransformer::transform | ||||
|      * throws \FireflyIII\Exceptions\FireflyException | ||||
|      */ | ||||
|     public function testDepositBudget() | ||||
|     public function testDepositBudget(): void | ||||
|     { | ||||
|         // make new asset account: | ||||
|         $asset = Account::create( | ||||
| @@ -281,7 +289,11 @@ class TransactionTransformerTest extends TestCase | ||||
|         // use collector to get it: | ||||
|         $transaction = $this->getTransaction($journal); | ||||
|         $transformer = new TransactionTransformer(new ParameterBag); | ||||
|         $result      = $transformer->transform($transaction); | ||||
|         try { | ||||
|             $result = $transformer->transform($transaction); | ||||
|         } catch (FireflyException $e) { | ||||
|             $this->assertTrue(false, $e->getMessage()); | ||||
|         } | ||||
|         // basic fields: | ||||
|         $this->assertEquals($journal->id, $result['journal_id']); | ||||
|         $this->assertEquals('Deposit', $result['type']); | ||||
| @@ -311,7 +323,7 @@ class TransactionTransformerTest extends TestCase | ||||
|      * @covers \FireflyIII\Transformers\TransactionTransformer::transform | ||||
|      * throws \FireflyIII\Exceptions\FireflyException | ||||
|      */ | ||||
|     public function testForeignAmount() | ||||
|     public function testForeignAmount(): void | ||||
|     { | ||||
|         // make new asset account: | ||||
|         $asset = Account::create( | ||||
| @@ -368,7 +380,11 @@ class TransactionTransformerTest extends TestCase | ||||
|         // use collector to get it: | ||||
|         $transaction = $this->getTransaction($journal); | ||||
|         $transformer = new TransactionTransformer(new ParameterBag); | ||||
|         $result      = $transformer->transform($transaction); | ||||
|         try { | ||||
|             $result = $transformer->transform($transaction); | ||||
|         } catch (FireflyException $e) { | ||||
|             $this->assertTrue(false, $e->getMessage()); | ||||
|         } | ||||
|         // basic fields: | ||||
|         $this->assertEquals($journal->id, $result['journal_id']); | ||||
|         $this->assertEquals('Withdrawal', $result['type']); | ||||
| @@ -403,7 +419,7 @@ class TransactionTransformerTest extends TestCase | ||||
|      * @covers \FireflyIII\Transformers\TransactionTransformer::transform | ||||
|      * throws \FireflyIII\Exceptions\FireflyException | ||||
|      */ | ||||
|     public function testJournalBudget() | ||||
|     public function testJournalBudget(): void | ||||
|     { | ||||
|         // make new asset account: | ||||
|         $asset = Account::create( | ||||
| @@ -467,7 +483,11 @@ class TransactionTransformerTest extends TestCase | ||||
|         // use collector to get it: | ||||
|         $transaction = $this->getTransaction($journal); | ||||
|         $transformer = new TransactionTransformer(new ParameterBag); | ||||
|         $result      = $transformer->transform($transaction); | ||||
|         try { | ||||
|             $result = $transformer->transform($transaction); | ||||
|         } catch (FireflyException $e) { | ||||
|             $this->assertTrue(false, $e->getMessage()); | ||||
|         } | ||||
|         // basic fields: | ||||
|         $this->assertEquals($journal->id, $result['journal_id']); | ||||
|         $this->assertEquals('Withdrawal', $result['type']); | ||||
| @@ -501,7 +521,7 @@ class TransactionTransformerTest extends TestCase | ||||
|      * @covers \FireflyIII\Transformers\TransactionTransformer::transform | ||||
|      * throws \FireflyIII\Exceptions\FireflyException | ||||
|      */ | ||||
|     public function testJournalCategory() | ||||
|     public function testJournalCategory(): void | ||||
|     { | ||||
|         // make new asset account: | ||||
|         $asset = Account::create( | ||||
| @@ -565,7 +585,11 @@ class TransactionTransformerTest extends TestCase | ||||
|         // use collector to get it: | ||||
|         $transaction = $this->getTransaction($journal); | ||||
|         $transformer = new TransactionTransformer(new ParameterBag); | ||||
|         $result      = $transformer->transform($transaction); | ||||
|         try { | ||||
|             $result = $transformer->transform($transaction); | ||||
|         } catch (FireflyException $e) { | ||||
|             $this->assertTrue(false, $e->getMessage()); | ||||
|         } | ||||
|         // basic fields: | ||||
|         $this->assertEquals($journal->id, $result['journal_id']); | ||||
|         $this->assertEquals('Withdrawal', $result['type']); | ||||
| @@ -599,7 +623,7 @@ class TransactionTransformerTest extends TestCase | ||||
|      * @covers \FireflyIII\Transformers\TransactionTransformer::transform | ||||
|      * throws \FireflyIII\Exceptions\FireflyException | ||||
|      */ | ||||
|     public function testOpeningBalanceNeg() | ||||
|     public function testOpeningBalanceNeg(): void | ||||
|     { | ||||
|         // make new asset account: | ||||
|         $asset = Account::create( | ||||
| @@ -652,7 +676,11 @@ class TransactionTransformerTest extends TestCase | ||||
|         // use collector to get it: | ||||
|         $transaction = $this->getTransaction($journal); | ||||
|         $transformer = new TransactionTransformer(new ParameterBag); | ||||
|         $result      = $transformer->transform($transaction); | ||||
|         try { | ||||
|             $result = $transformer->transform($transaction); | ||||
|         } catch (FireflyException $e) { | ||||
|             $this->assertTrue(false, $e->getMessage()); | ||||
|         } | ||||
|         // basic fields: | ||||
|         $this->assertEquals($journal->id, $result['journal_id']); | ||||
|         $this->assertEquals('Opening balance', $result['type']); | ||||
| @@ -684,7 +712,7 @@ class TransactionTransformerTest extends TestCase | ||||
|      * @covers \FireflyIII\Transformers\TransactionTransformer::transform | ||||
|      * throws \FireflyIII\Exceptions\FireflyException | ||||
|      */ | ||||
|     public function testOpeningBalancePos() | ||||
|     public function testOpeningBalancePos(): void | ||||
|     { | ||||
|         // make new asset account: | ||||
|         $asset = Account::create( | ||||
| @@ -738,7 +766,11 @@ class TransactionTransformerTest extends TestCase | ||||
|         // use collector to get it: | ||||
|         $transaction = $this->getTransaction($journal); | ||||
|         $transformer = new TransactionTransformer(new ParameterBag); | ||||
|         $result      = $transformer->transform($transaction); | ||||
|         try { | ||||
|             $result = $transformer->transform($transaction); | ||||
|         } catch (FireflyException $e) { | ||||
|             $this->assertTrue(false, $e->getMessage()); | ||||
|         } | ||||
|         // basic fields: | ||||
|         $this->assertEquals($journal->id, $result['journal_id']); | ||||
|         $this->assertEquals('Opening balance', $result['type']); | ||||
| @@ -769,7 +801,7 @@ class TransactionTransformerTest extends TestCase | ||||
|      * @covers \FireflyIII\Transformers\TransactionTransformer::transform | ||||
|      * throws \FireflyIII\Exceptions\FireflyException | ||||
|      */ | ||||
|     public function testReconciliationNeg() | ||||
|     public function testReconciliationNeg(): void | ||||
|     { | ||||
|         // make new asset account: | ||||
|         $asset = Account::create( | ||||
| @@ -823,7 +855,11 @@ class TransactionTransformerTest extends TestCase | ||||
|         // use collector to get it: | ||||
|         $transaction = $this->getTransaction($journal); | ||||
|         $transformer = new TransactionTransformer(new ParameterBag); | ||||
|         $result      = $transformer->transform($transaction); | ||||
|         try { | ||||
|             $result = $transformer->transform($transaction); | ||||
|         } catch (FireflyException $e) { | ||||
|             $this->assertTrue(false, $e->getMessage()); | ||||
|         } | ||||
|         // basic fields: | ||||
|         $this->assertEquals($journal->id, $result['journal_id']); | ||||
|         $this->assertEquals('Reconciliation', $result['type']); | ||||
| @@ -854,7 +890,7 @@ class TransactionTransformerTest extends TestCase | ||||
|      * @covers \FireflyIII\Transformers\TransactionTransformer::transform | ||||
|      * throws \FireflyIII\Exceptions\FireflyException | ||||
|      */ | ||||
|     public function testReconciliationPos() | ||||
|     public function testReconciliationPos(): void | ||||
|     { | ||||
|         // make new asset account: | ||||
|         $asset = Account::create( | ||||
| @@ -908,7 +944,11 @@ class TransactionTransformerTest extends TestCase | ||||
|         // use collector to get it: | ||||
|         $transaction = $this->getTransaction($journal); | ||||
|         $transformer = new TransactionTransformer(new ParameterBag); | ||||
|         $result      = $transformer->transform($transaction); | ||||
|         try { | ||||
|             $result = $transformer->transform($transaction); | ||||
|         } catch (FireflyException $e) { | ||||
|             $this->assertTrue(false, $e->getMessage()); | ||||
|         } | ||||
|         // basic fields: | ||||
|         $this->assertEquals($journal->id, $result['journal_id']); | ||||
|         $this->assertEquals('Reconciliation', $result['type']); | ||||
| @@ -939,7 +979,7 @@ class TransactionTransformerTest extends TestCase | ||||
|      * @covers \FireflyIII\Transformers\TransactionTransformer::transform | ||||
|      * throws \FireflyIII\Exceptions\FireflyException | ||||
|      */ | ||||
|     public function testTransactionBudget() | ||||
|     public function testTransactionBudget(): void | ||||
|     { | ||||
|         // make new asset account: | ||||
|         $asset = Account::create( | ||||
| @@ -1005,7 +1045,11 @@ class TransactionTransformerTest extends TestCase | ||||
|         // use collector to get it: | ||||
|         $transaction = $this->getTransaction($journal); | ||||
|         $transformer = new TransactionTransformer(new ParameterBag); | ||||
|         $result      = $transformer->transform($transaction); | ||||
|         try { | ||||
|             $result = $transformer->transform($transaction); | ||||
|         } catch (FireflyException $e) { | ||||
|             $this->assertTrue(false, $e->getMessage()); | ||||
|         } | ||||
|         // basic fields: | ||||
|         $this->assertEquals($journal->id, $result['journal_id']); | ||||
|         $this->assertEquals('Withdrawal', $result['type']); | ||||
| @@ -1039,7 +1083,7 @@ class TransactionTransformerTest extends TestCase | ||||
|      * @covers \FireflyIII\Transformers\TransactionTransformer::transform | ||||
|      * throws \FireflyIII\Exceptions\FireflyException | ||||
|      */ | ||||
|     public function testTransactionCategory() | ||||
|     public function testTransactionCategory(): void | ||||
|     { | ||||
|         // make new asset account: | ||||
|         $asset = Account::create( | ||||
| @@ -1104,7 +1148,11 @@ class TransactionTransformerTest extends TestCase | ||||
|         // use collector to get it: | ||||
|         $transaction = $this->getTransaction($journal); | ||||
|         $transformer = new TransactionTransformer(new ParameterBag); | ||||
|         $result      = $transformer->transform($transaction); | ||||
|         try { | ||||
|             $result = $transformer->transform($transaction); | ||||
|         } catch (FireflyException $e) { | ||||
|             $this->assertTrue(false, $e->getMessage()); | ||||
|         } | ||||
|         // basic fields: | ||||
|         $this->assertEquals($journal->id, $result['journal_id']); | ||||
|         $this->assertEquals('Withdrawal', $result['type']); | ||||
| @@ -1138,7 +1186,7 @@ class TransactionTransformerTest extends TestCase | ||||
|      * @covers \FireflyIII\Transformers\TransactionTransformer::transform | ||||
|      * throws \FireflyIII\Exceptions\FireflyException | ||||
|      */ | ||||
|     public function testTransactionDescription() | ||||
|     public function testTransactionDescription(): void | ||||
|     { | ||||
|         // make new asset account: | ||||
|         $asset = Account::create( | ||||
| @@ -1191,7 +1239,11 @@ class TransactionTransformerTest extends TestCase | ||||
|         // use collector to get it: | ||||
|         $transaction = $this->getTransaction($journal); | ||||
|         $transformer = new TransactionTransformer(new ParameterBag); | ||||
|         $result      = $transformer->transform($transaction); | ||||
|         try { | ||||
|             $result = $transformer->transform($transaction); | ||||
|         } catch (FireflyException $e) { | ||||
|             $this->assertTrue(false, $e->getMessage()); | ||||
|         } | ||||
|         // basic fields: | ||||
|         $this->assertEquals($journal->id, $result['journal_id']); | ||||
|         $this->assertEquals('Withdrawal', $result['type']); | ||||
| @@ -1222,7 +1274,7 @@ class TransactionTransformerTest extends TestCase | ||||
|      * @covers \FireflyIII\Transformers\TransactionTransformer::transform | ||||
|      * throws \FireflyIII\Exceptions\FireflyException | ||||
|      */ | ||||
|     public function testTransferOne() | ||||
|     public function testTransferOne(): void | ||||
|     { | ||||
|         // make new asset account: | ||||
|         $left = Account::create( | ||||
| @@ -1275,7 +1327,11 @@ class TransactionTransformerTest extends TestCase | ||||
|         // use collector to get it: | ||||
|         $transaction = $this->getTransaction($journal); | ||||
|         $transformer = new TransactionTransformer(new ParameterBag); | ||||
|         $result      = $transformer->transform($transaction); | ||||
|         try { | ||||
|             $result = $transformer->transform($transaction); | ||||
|         } catch (FireflyException $e) { | ||||
|             $this->assertTrue(false, $e->getMessage()); | ||||
|         } | ||||
|         // basic fields: | ||||
|         $this->assertEquals($journal->id, $result['journal_id']); | ||||
|         $this->assertEquals('Transfer', $result['type']); | ||||
| @@ -1306,7 +1362,7 @@ class TransactionTransformerTest extends TestCase | ||||
|      * @covers \FireflyIII\Transformers\TransactionTransformer::transform | ||||
|      * throws \FireflyIII\Exceptions\FireflyException | ||||
|      */ | ||||
|     public function testTransferTwo() | ||||
|     public function testTransferTwo(): void | ||||
|     { | ||||
|         // make new asset account: | ||||
|         $left = Account::create( | ||||
| @@ -1361,7 +1417,11 @@ class TransactionTransformerTest extends TestCase | ||||
|         // use collector to get it: | ||||
|         $transaction = $this->getTransaction($journal); | ||||
|         $transformer = new TransactionTransformer(new ParameterBag); | ||||
|         $result      = $transformer->transform($transaction); | ||||
|         try { | ||||
|             $result = $transformer->transform($transaction); | ||||
|         } catch (FireflyException $e) { | ||||
|             $this->assertTrue(false, $e->getMessage()); | ||||
|         } | ||||
|         // basic fields: | ||||
|         $this->assertEquals($journal->id, $result['journal_id']); | ||||
|         $this->assertEquals('Transfer', $result['type']); | ||||
|   | ||||
		Reference in New Issue
	
	Block a user