Changeset View
Changeset View
Standalone View
Standalone View
src/tests/Unit/TransactionTest.php
- This file was added.
<?php | |||||
namespace Tests\Unit; | |||||
use Tests\TestCase; | |||||
class TransactionTest extends TestCase | |||||
{ | |||||
public function setUp(): void | |||||
{ | |||||
parent::setUp(); | |||||
} | |||||
public function tearDown(): void | |||||
{ | |||||
parent::tearDown(); | |||||
} | |||||
public function testLabel() | |||||
{ | |||||
$transactions = \App\Transaction::all(); | |||||
foreach ($transactions as $transaction) { | |||||
$this->assertNotNull($transaction->toString()); | |||||
} | |||||
} | |||||
public function testWalletPenalty() | |||||
{ | |||||
$user = $this->getTestUser('jane@kolabnow.com'); | |||||
$wallet = $user->wallets()->first(); | |||||
$transaction = \App\Transaction::create( | |||||
[ | |||||
'object_id' => $wallet->id, | |||||
'object_type' => \App\Wallet::class, | |||||
'type' => \App\Transaction::WALLET_PENALTY, | |||||
'amount' => 9 | |||||
] | |||||
); | |||||
$this->assertEquals($transaction->{'type'}, 'penalty'); | |||||
} | |||||
machniak: This test does not make much sense to me. | |||||
Done Inline ActionsIt only added the single line coverage that was missing. vanmeeuwen: It only added the single line coverage that was missing. | |||||
public function testInvalidType() | |||||
{ | |||||
$user = $this->getTestUser('jane@kolabnow.com'); | |||||
$wallet = $user->wallets()->first(); | |||||
$this->expectException(\Exception::class); | |||||
$transaction = \App\Transaction::create( | |||||
[ | |||||
'object_id' => $wallet->id, | |||||
'object_type' => \App\Wallet::class, | |||||
'type' => 'invalid', | |||||
'amount' => 9 | |||||
] | |||||
); | |||||
} | |||||
} |
This test does not make much sense to me.