-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathTermsOfUseVersionTest.php
More file actions
40 lines (31 loc) · 1.02 KB
/
TermsOfUseVersionTest.php
File metadata and controls
40 lines (31 loc) · 1.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
<?php
namespace Tests\Models;
use App\TermsOfUseVersion;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Tests\TestCase;
class TermsOfUseVersionTest extends TestCase {
use RefreshDatabase;
public function testSavingActiveVersionDeactivatesOtherVersions(): void {
$first = TermsOfUseVersion::create([
'version' => '2024-01-01',
'active' => true,
]);
$second = TermsOfUseVersion::create([
'version' => '2025-01-01',
'active' => true,
]);
$this->assertFalse($first->fresh()->active);
$this->assertTrue($second->fresh()->active);
}
public function testSavingInactiveVersionDoesNotAffectExistingActiveVersion(): void {
$active = TermsOfUseVersion::create([
'version' => '2024-03-01',
'active' => true,
]);
TermsOfUseVersion::create([
'version' => '2024-04-01',
'active' => false,
]);
$this->assertTrue($active->fresh()->active);
}
}