Skip to content

Commit

Permalink
Set testNow to start of minute to (hopefully?) prevent random off-by-…
Browse files Browse the repository at this point in the history
…milliseconds failures on ci
  • Loading branch information
jasonvarga committed Jul 31, 2020
1 parent 1f1de81 commit 22399b4
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 4 additions & 1 deletion tests/Licensing/LicenseManagerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace Tests\Licensing;

use Illuminate\Contracts\Support\MessageBag;
use Illuminate\Support\Carbon;
use Illuminate\Support\Collection;
use Statamic\Licensing\AddonLicense;
use Statamic\Licensing\LicenseManager;
Expand Down Expand Up @@ -133,6 +134,8 @@ public function it_gets_the_addon_licenses()
/** @test */
public function it_checks_for_request_failures()
{
Carbon::setTestNow(now()->startOfMinute());

tap($this->managerWithResponse(['error' => 500]), function ($licenses) {
$this->assertTrue($licenses->requestFailed());
$this->assertEquals(500, $licenses->requestErrorCode());
Expand Down Expand Up @@ -161,7 +164,7 @@ public function it_checks_for_request_failures()
$this->assertTrue($licenses->requestFailed());
$this->assertEquals(429, $licenses->requestErrorCode());
$this->assertTrue($licenses->requestRateLimited());
$this->assertEquals(9, $licenses->failedRequestRetrySeconds());
$this->assertEquals(10, $licenses->failedRequestRetrySeconds());
$this->assertInstanceOf(MessageBag::class, $licenses->requestValidationErrors());
$this->assertEquals([], $licenses->requestValidationErrors()->all());
});
Expand Down
2 changes: 1 addition & 1 deletion tests/Licensing/OutpostTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class OutpostTest extends TestCase
public function setUp(): void
{
parent::setUp();
Carbon::setTestNow();
Carbon::setTestNow(now()->startOfMinute());
}

/** @test */
Expand Down

0 comments on commit 22399b4

Please sign in to comment.