| 1 |
<?php |
| 2 |
|
| 3 |
namespace SyncBasalam\Tests\Services; |
| 4 |
|
| 5 |
use PHPUnit\Framework\TestCase; |
| 6 |
use SyncBasalam\Services\ForceUpdateGate; |
| 7 |
|
| 8 |
class ForceUpdateGateTest extends TestCase |
| 9 |
{ |
| 10 |
public function testDoesNotBlockWhenForceUpdateIsDisabled(): void |
| 11 |
{ |
| 12 |
self::assertFalse(ForceUpdateGate::shouldBlock(false, '1.10.15', '1.10.15')); |
| 13 |
} |
| 14 |
|
| 15 |
public function testBlocksTheVersionThatReceivedTheForceUpdateFlag(): void |
| 16 |
{ |
| 17 |
self::assertTrue(ForceUpdateGate::shouldBlock(true, '1.10.15', '1.10.15')); |
| 18 |
} |
| 19 |
|
| 20 |
public function testAllowsANewerPackageToRecoverFromTheStoredFlag(): void |
| 21 |
{ |
| 22 |
self::assertFalse(ForceUpdateGate::shouldBlock(true, '1.10.15', '1.10.16')); |
| 23 |
} |
| 24 |
|
| 25 |
public function testIgnoresUnknownHotfixVersionReportedAsForcedByTheApi(): void |
| 26 |
{ |
| 27 |
self::assertFalse(ForceUpdateGate::shouldHonorRemoteFlag(true, '1.10.16', '1.10.14')); |
| 28 |
} |
| 29 |
|
| 30 |
public function testHonorsForceUpdateForAnOutdatedPublishedVersion(): void |
| 31 |
{ |
| 32 |
self::assertTrue(ForceUpdateGate::shouldHonorRemoteFlag(true, '1.10.13', '1.10.14')); |
| 33 |
} |
| 34 |
} |
| 35 |
|