Changeset View
Changeset View
Standalone View
Standalone View
src/tests/Feature/Controller/WalletsTest.php
Show First 20 Lines • Show All 74 Lines • ▼ Show 20 Lines | public function testGetWalletNotice(): void | ||||
$this->assertRegExp('/\((1 month|4 weeks)\)/', $notice); | $this->assertRegExp('/\((1 month|4 weeks)\)/', $notice); | ||||
// test "2 months" | // test "2 months" | ||||
$wallet->balance = 999 * 2.6; | $wallet->balance = 999 * 2.6; | ||||
$notice = $method->invoke($controller, $wallet); | $notice = $method->invoke($controller, $wallet); | ||||
$this->assertRegExp('/\(2 months 2 weeks\)/', $notice); | $this->assertRegExp('/\(2 months 2 weeks\)/', $notice); | ||||
// Change locale to make sure the text is localized by Carbon | |||||
\app()->setLocale('de'); | |||||
// test "almost 2 years" | // test "almost 2 years" | ||||
$wallet->balance = 999 * 23.5; | $wallet->balance = 999 * 23.5; | ||||
$notice = $method->invoke($controller, $wallet); | $notice = $method->invoke($controller, $wallet); | ||||
$this->assertRegExp('/\(1 year 11 months\)/', $notice); | $this->assertRegExp('/\(1 Jahr 11 Monate\)/', $notice); | ||||
// Old entitlements, 100% discount | // Old entitlements, 100% discount | ||||
$this->backdateEntitlements($wallet->entitlements, Carbon::now()->subDays(40)); | $this->backdateEntitlements($wallet->entitlements, Carbon::now()->subDays(40)); | ||||
$discount = \App\Discount::where('discount', 100)->first(); | $discount = \App\Discount::where('discount', 100)->first(); | ||||
$wallet->discount()->associate($discount); | $wallet->discount()->associate($discount); | ||||
$notice = $method->invoke($controller, $wallet->refresh()); | $notice = $method->invoke($controller, $wallet->refresh()); | ||||
▲ Show 20 Lines • Show All 258 Lines • Show Last 20 Lines |