forked from ProcessMaker/processmaker
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathHasVersioningTest.php
More file actions
50 lines (39 loc) · 1.33 KB
/
HasVersioningTest.php
File metadata and controls
50 lines (39 loc) · 1.33 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
41
42
43
44
45
46
47
48
49
50
<?php
namespace Tests\Traits;
use Illuminate\Support\Carbon;
use ProcessMaker\Models\ProcessRequest;
use ProcessMaker\Models\ProcessRequestToken;
use ProcessMaker\Models\Screen;
use Tests\TestCase;
class HasVersioningTest extends TestCase
{
public function testVersionFor()
{
$this->markTestSkipped('Skip version locking for now');
$date = Carbon::now();
$screen = Screen::factory()->create([
'description' => 'first version',
]);
Carbon::setTestNow($date->addDays(1));
$screen->description = 'second version';
$screen->save();
Carbon::setTestNow($date->addDays(2));
$processRequest = ProcessRequest::factory()->create();
Carbon::setTestNow($date->addDays(3));
$screen->description = 'third version';
$screen->save();
Carbon::setTestNow($date->addDays(4));
ProcessRequestToken::factory()->create([
'process_request_id' => $processRequest->id,
]);
Carbon::setTestNow($date->addDays(5));
$screen->description = 'fourth version';
$screen->save();
$screenVersion = $screen->versionFor($processRequest);
$this->assertEquals('second version', $screenVersion->description);
}
public function tearDownCarbon()
{
Carbon::setTestNow(); // reset
}
}