Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F2528821
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
View Options
diff --git a/src/tests/Feature/Console/Wallet/UntilTest.php b/src/tests/Feature/Console/Wallet/UntilTest.php
index b948d3fc..dc4e3a1e 100644
--- a/src/tests/Feature/Console/Wallet/UntilTest.php
+++ b/src/tests/Feature/Console/Wallet/UntilTest.php
@@ -1,68 +1,70 @@
<?php
namespace Tests\Feature\Console\Wallet;
use Illuminate\Support\Facades\Queue;
use Tests\TestCase;
class UntilTest extends TestCase
{
/**
* {@inheritDoc}
*/
public function setUp(): void
{
parent::setUp();
$this->deleteTestUser('wallets-controller@kolabnow.com');
}
/**
* {@inheritDoc}
*/
public function tearDown(): void
{
$this->deleteTestUser('wallets-controller@kolabnow.com');
parent::tearDown();
}
/**
* Test command run for a specified wallet
*/
public function testHandle(): void
{
Queue::fake();
$user = $this->getTestUser('wallets-controller@kolabnow.com');
$wallet = $user->wallets()->first();
// Non-existing wallet
$code = \Artisan::call("wallet:until 123");
$output = trim(\Artisan::output());
$this->assertSame(1, $code);
$this->assertSame("Wallet not found.", $output);
// Existing wallet
$code = \Artisan::call("wallet:until {$wallet->id}");
$output = trim(\Artisan::output());
$this->assertSame(0, $code);
$this->assertSame("Lasts until: unknown", $output);
$package = \App\Package::withObjectTenantContext($user)->where('title', 'kolab')->first();
$user->assignPackage($package);
$wallet->balance = 1000;
$wallet->save();
- $expected = \now()->addMonths(2)->toDateString();
-
// Existing wallet
$code = \Artisan::call("wallet:until {$wallet->id}");
$output = trim(\Artisan::output());
$this->assertSame(0, $code);
- $this->assertSame("Lasts until: $expected", $output);
+
+ // Depending on a month it could last a day less
+ $expected1 = \now()->addMonths(2)->toDateString();
+ $expected2 = \now()->addMonths(2)->subDay()->toDateString();
+ $this->assertTrue("Lasts until: $expected1" == $output || "Lasts until: $expected2" == $output);
}
}
File Metadata
Details
Attached
Mime Type
text/x-diff
Expires
Sun, Feb 1, 10:31 PM (1 d, 16 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
426789
Default Alt Text
(2 KB)
Attached To
Mode
R2 kolab
Attached
Detach File
Event Timeline
Log In to Comment