-
Notifications
You must be signed in to change notification settings - Fork 244
Expand file tree
/
Copy pathCssOverrideTest.php
More file actions
117 lines (100 loc) · 3.27 KB
/
Copy pathCssOverrideTest.php
File metadata and controls
117 lines (100 loc) · 3.27 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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
<?php
namespace Tests\Feature\Api;
use Carbon\Carbon;
use Faker\Factory as Faker;
use Illuminate\Support\Facades\Hash;
use ProcessMaker\Models\Group;
use ProcessMaker\Models\Setting;
use ProcessMaker\Models\User;
use Tests\Feature\Shared\RequestHelper;
use Tests\TestCase;
class CssOverrideTest extends TestCase
{
use RequestHelper;
private $testColor = '#1f1f1f';
private $originalColors = '';
private $originalAppCss = '';
private $originalSidebarCss = '';
private $originalQueueCss = '';
/**
* Verifies that the bootstrap styles are validated
*/
public function testEmptyParameters()
{
$response = $this->actingAs($this->user, 'api')->call('POST', '/api/1.0/customize-ui', []);
$response->assertStatus(422);
}
/**
* Verifies that the bootstrap styles are validated
*/
public function testWrongKeys()
{
$response = $this->actingAs($this->user, 'api')->call('POST', '/api/1.0/customize-ui', ['wrongkey' => 'key']);
$response->assertStatus(422);
}
/**
* Verifies that the reset css works
*/
public function testResetCss()
{
$this->markTestSkipped('FOUR-6653');
// Create some css override setting with custom logos
$data = $this->cssValues();
$response = $this->actingAs($this->user, 'api')->call('POST', '/api/1.0/customize-ui', $data);
$response->assertStatus(201);
// Assert the setting for css-override was created
$this->assertDatabaseHas('settings', ['key' => 'css-override']);
// Reset the values
$data['reset'] = true;
$response = $this->actingAs($this->user, 'api')->call('POST', '/api/1.0/customize-ui', $data);
// Reset values should delete the css-override setting
$this->assertDatabaseMissing('settings', ['key' => 'css-override']);
$response->assertStatus(200);
}
private function cssValues()
{
return [
'key' => 'css-override',
'fileLoginName' => 'loginLogo.png',
'fileLogoName' => 'logo.png',
'fileIconName' => 'icon.png',
'variables' => json_encode([
[
'id' => '$primary',
'value' => '#3397e1',
'title' => 'Primary',
],
[
'id' => '$secondary',
'value' => '#788793',
'title' => 'Secondary',
],
[
'id' => '$success',
'value' => '#00bf9c',
'title' => 'Success',
],
[
'id' => '$info',
'value' => '#17a2b8',
'title' => 'Info',
],
[
'id' => '$warning',
'value' => '#fbbe02',
'title' => 'Warning',
],
[
'id' => '$danger',
'value' => '#ed4757',
'title' => 'Danger',
],
[
'id' => '$light',
'value' => '#ffffff',
'title' => 'Light',
],
]),
];
}
}