MaterielsTableTest.php
4.13 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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
<?php
namespace App\Test\TestCase\Model\Table;
use App\Model\Table\MaterielsTable;
use Cake\ORM\TableRegistry;
use Cake\TestSuite\TestCase;
/**
* App\Model\Table\MaterielsTable Test Case
*/
class MaterielsTableTest extends TestCase
{
/**
* Test subject
*
* @var \App\Model\Table\MaterielsTable
*/
public $Materiels;
/**
* Fixtures
*
* @var array
*/
public $fixtures = [
'app.Materiels',
'app.SurCategories',
'app.Categories',
'app.SousCategories',
'app.GroupesThematiques',
'app.GroupesMetiers',
'app.Projets',
'app.Fakeldapusers',
'app.Users',
'app.Organismes',
'app.Sites',
'app.Documents',
'app.Suivis',
'app.Emprunts',
'app.Fournisseurs',
'app.Unites',
// 14/1/19 bake autogenerated:
'app.TypeSuivis',
'app.TypeDocuments',
'app.Fichemetrologiques',
//'app.mesures',
];
/**
* setUp method
*
* @return void
*/
public function setUp()
{
parent::setUp();
// 14/1/19 bake autogenerated:
//$config = TableRegistry::exists('Materiels') ? [] : ['className' => 'App\Model\Table\MaterielsTable'];
//$config = TableRegistry::exists('Materiels') ? [] : ['className' => MaterielsTable::class];
$config = TableRegistry::getTableLocator()->exists('Materiels') ? [] : ['className' => MaterielsTable::class];
//$this->Materiels = TableRegistry::get('Materiels', $config);
$this->Materiels = TableRegistry::getTableLocator()->get('Materiels', $config);
}
/**
* tearDown method
*
* @return void
*/
public function tearDown()
{
unset($this->Materiels);
parent::tearDown();
}
/**
* Test initialize method
*
* @return void
public function testInitialize()
{
$this->markTestIncomplete('Not implemented yet.');
}
*/
/**
* Test validationDefault method
*
* @return void
public function testValidationDefault()
{
$this->markTestIncomplete('Not implemented yet.');
}
*/
/**
* Test buildRules method
*
* @return void
public function testBuildRules()
{
$this->markTestIncomplete('Not implemented yet.');
}
*/
/**
* Test beforeSave method
*
* @return void
public function testBeforeSave()
{
$this->markTestIncomplete('Not implemented yet.');
}
*/
/**
* Test check_string method
*
* @return void
*/
public function testCheck_string()
{
$result = $this->Materiels->check_string("& materiel");
$this->assertTextEquals(false, $result);
$result = $this->Materiels->check_string("materiel");
$this->assertTextEquals(true, $result);
}
/**
* Test check_string_with_some_special_cars method
*
* @return void
*/
public function testCheck_string_with_some_special_cars()
{
$result = $this->Materiels->check_string_with_some_special_cars("$$ materiel");
$this->assertTextEquals(false, $result);
$result = $this->Materiels->check_string_with_some_special_cars("& materiel");
$this->assertTextEquals(true, $result);
}
/**
* Test checkStatus method
*
* @return void
*/
public function testCheckStatus()
{
$result = $this->Materiels->checkStatus("pas un status");
$this->assertTextEquals(false, $result);
$result = $this->Materiels->checkStatus("CREATE");
$this->assertTextEquals(false, $result);
$result = $this->Materiels->checkStatus("CREATED");
$this->assertTextEquals(true, $result);
$result = $this->Materiels->checkStatus("VALIDATED");
$this->assertTextEquals(true, $result);
$result = $this->Materiels->checkStatus("TOBEARCHIVED");
$this->assertTextEquals(true, $result);
$result = $this->Materiels->checkStatus("ARCHIVED");
$this->assertTextEquals(true, $result);
}
}