Changeset View
Changeset View
Standalone View
Standalone View
src/tests/Unit/TransactionTest.php
Show First 20 Lines • Show All 126 Lines • ▼ Show 20 Lines | public function testLabels(): void | ||||
"Bonus: A test award", | "Bonus: A test award", | ||||
$transactions[3]->shortDescription() | $transactions[3]->shortDescription() | ||||
); | ); | ||||
$ent = $transactions[4]->entitlement(); | $ent = $transactions[4]->entitlement(); | ||||
$this->assertSame(13, $transactions[4]->amount); | $this->assertSame(13, $transactions[4]->amount); | ||||
$this->assertSame(Transaction::ENTITLEMENT_CREATED, $transactions[4]->type); | $this->assertSame(Transaction::ENTITLEMENT_CREATED, $transactions[4]->type); | ||||
$this->assertSame( | $this->assertSame( | ||||
"test@test.com created mailbox for " . $ent->entitleableTitle(), | "test@test.com created mailbox for " . $ent->entitleable->toString(), | ||||
$transactions[4]->toString() | $transactions[4]->toString() | ||||
); | ); | ||||
$this->assertSame( | $this->assertSame( | ||||
"Added mailbox for " . $ent->entitleableTitle(), | "Added mailbox for " . $ent->entitleable->toString(), | ||||
$transactions[4]->shortDescription() | $transactions[4]->shortDescription() | ||||
); | ); | ||||
$ent = $transactions[5]->entitlement(); | $ent = $transactions[5]->entitlement(); | ||||
$this->assertSame(14, $transactions[5]->amount); | $this->assertSame(14, $transactions[5]->amount); | ||||
$this->assertSame(Transaction::ENTITLEMENT_BILLED, $transactions[5]->type); | $this->assertSame(Transaction::ENTITLEMENT_BILLED, $transactions[5]->type); | ||||
$this->assertSame( | $this->assertSame( | ||||
sprintf("%s for %s is billed at 0,14 CHF", $ent->sku->title, $ent->entitleableTitle()), | sprintf("%s for %s is billed at 0,14 CHF", $ent->sku->title, $ent->entitleable->toString()), | ||||
$transactions[5]->toString() | $transactions[5]->toString() | ||||
); | ); | ||||
$this->assertSame( | $this->assertSame( | ||||
sprintf("Billed %s for %s", $ent->sku->title, $ent->entitleableTitle()), | sprintf("Billed %s for %s", $ent->sku->title, $ent->entitleable->toString()), | ||||
$transactions[5]->shortDescription() | $transactions[5]->shortDescription() | ||||
); | ); | ||||
$ent = $transactions[6]->entitlement(); | $ent = $transactions[6]->entitlement(); | ||||
$this->assertSame(15, $transactions[6]->amount); | $this->assertSame(15, $transactions[6]->amount); | ||||
$this->assertSame(Transaction::ENTITLEMENT_DELETED, $transactions[6]->type); | $this->assertSame(Transaction::ENTITLEMENT_DELETED, $transactions[6]->type); | ||||
$this->assertSame( | $this->assertSame( | ||||
sprintf("test@test.com deleted %s for %s", $ent->sku->title, $ent->entitleableTitle()), | sprintf("test@test.com deleted %s for %s", $ent->sku->title, $ent->entitleable->toString()), | ||||
$transactions[6]->toString() | $transactions[6]->toString() | ||||
); | ); | ||||
$this->assertSame( | $this->assertSame( | ||||
sprintf("Deleted %s for %s", $ent->sku->title, $ent->entitleableTitle()), | sprintf("Deleted %s for %s", $ent->sku->title, $ent->entitleable->toString()), | ||||
$transactions[6]->shortDescription() | $transactions[6]->shortDescription() | ||||
); | ); | ||||
} | } | ||||
/** | /** | ||||
* Test that an exception is being thrown on invalid type | * Test that an exception is being thrown on invalid type | ||||
*/ | */ | ||||
public function testInvalidType(): void | public function testInvalidType(): void | ||||
Show All 34 Lines |