Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
0.00% covered (danger)
0.00%
0 / 246
0.00% covered (danger)
0.00%
0 / 9
CRAP
0.00% covered (danger)
0.00%
0 / 1
User_test
0.00% covered (danger)
0.00%
0 / 246
0.00% covered (danger)
0.00%
0 / 9
110
0.00% covered (danger)
0.00%
0 / 1
 __construct
n/a
0 / 0
n/a
0 / 0
1
 test_USR01_เข้าหน้าแรกต้องสำเร็จ
0.00% covered (danger)
0.00%
0 / 7
0.00% covered (danger)
0.00%
0 / 1
2
 test_USR02_เข้าหน้าหลักต้องสำเร็จ
0.00% covered (danger)
0.00%
0 / 7
0.00% covered (danger)
0.00%
0 / 1
2
 test_USR03_โหลดข้อมูลมาแสดงเป็นตารางต้องสำเร็จ
0.00% covered (danger)
0.00%
0 / 13
0.00% covered (danger)
0.00%
0 / 1
2
 test_USR04_นำเข้าข้อมูล_1_รายการ_ต้องสำเร็จ
0.00% covered (danger)
0.00%
0 / 45
0.00% covered (danger)
0.00%
0 / 1
2
 test_USR05_ลบข้อมูลที่นำเข้า_1_รายการ_ต้องสำเร็จ
0.00% covered (danger)
0.00%
0 / 12
0.00% covered (danger)
0.00%
0 / 1
2
 test_USR06_นำเข้าข้อมูล_2_รายการ_ต้องสำเร็จ
0.00% covered (danger)
0.00%
0 / 59
0.00% covered (danger)
0.00%
0 / 1
2
 test_USR07_ลบข้อมูลที่นำเข้าหลายรายการ_ต้องสำเร็จ
0.00% covered (danger)
0.00%
0 / 18
0.00% covered (danger)
0.00%
0 / 1
2
 test_USR08_นำเข้าข้อมูล_3_รายการ_ต้องสำเร็จ
0.00% covered (danger)
0.00%
0 / 73
0.00% covered (danger)
0.00%
0 / 1
2
 test_USR09_ยืนยันการนำเข้าข้อมูล_ต้องสำเร็จ
0.00% covered (danger)
0.00%
0 / 12
0.00% covered (danger)
0.00%
0 / 1
2
1<?php
2/**
3 * Part of ci-phpunit-test
4 *
5 * @author     Kenji Suzuki <https://github.com/kenjis>
6 * @license    MIT License
7 * @copyright  2015 Kenji Suzuki
8 * @link       https://github.com/kenjis/ci-phpunit-test
9 */
10
11class User_test extends TestCase
12{
13     /** 
14     *@codeCoverageIgnore
15    */
16    public function __construct() {
17        parent::__construct();
18        $ci = &get_instance();
19        $ci->load->database();
20        $ci->load->helper('validator_helper');
21        $this->code = substr(md5(uniqid(mt_rand(), true)), 0, 5);
22        $_SESSION =array (
23            '__ci_last_regenerate' => 1674475513,
24            'lang' => 'th',
25            'tLangID' => 1,
26            'tSesUserLogin' => '009',
27            'tSesUsrRoleCodeMulti' => '\'00002\'',
28            'nSesUsrRoleLevel' => 99,
29            'tSesUsrAgnCode' => NULL,
30            'tSesUsrAgnName' => NULL,
31            'tSesUsrMerCode' => NULL,
32            'tSesUsrMerName' => NULL,
33            'tSesUsrBchCodeDefault' => '00001',
34            'tSesUsrBchNameDefault' => 'AdaSoft00001',
35            'tSesUsrBchCodeMulti' => '\'00001\'',
36            'tSesUsrBchNameMulti' => '\'AdaSoft00001\'',
37            'nSesUsrBchCount' => 0,
38            'tSesUsrShpCodeDefault' => '00014',
39            'tSesUsrShpNameDefault' => 'รันไทม์ช็อป',
40            'tSesUsrShpCodeMulti' => '\'00014\'',
41            'tSesUsrShpNameMulti' => '\'รันไทม์ช็อป\'',
42            'nSesUsrShpCount' => 0,
43            'tSesUsrWahCode' => '00001',
44            'tSesUsrWahName' => 'คลังขาย',
45            'tSesUsrLoginLevel' => 'HQ',
46            'tSesUsrLoginAgency' => 0,
47            'bSesLogIn' => 1,
48            'tSesUserCode' => '00002',
49            'tSesUsername' => '00002',
50            'tSesUsrDptName' => NULL,
51            'tSesUsrDptCode' => NULL,
52            'tSesUsrUsername' => 'Adasoft',
53            'tSesUsrImagePerson' => NULL,
54            'tSesUsrInfo' => 
55            array (
56              'FTUsrStaActive' => 1,
57              'FTUsrLogType' => 1,
58              'FTStaError' => 0,
59              'FTUsrCode' => '00002',
60              'FTUsrName' => 'Adasoft',
61              'FTDptCode' => NULL,
62              'FTDptName' => NULL,
63              'FTImgObj' => NULL,
64            ),
65            'tSesUsrGroup' => 
66            array (
67              0 => 
68              array (
69                'FTUsrCode' => '00002',
70                'FTAgnCode' => NULL,
71                'FTAgnName' => NULL,
72                'FTBchCode' => NULL,
73                'FTBchName' => NULL,
74                'FTShpCode' => NULL,
75                'FTShpName' => NULL,
76                'FTMerCode' => NULL,
77                'FTMerName' => NULL,
78                'FTWahCode' => NULL,
79                'FTWahName' => NULL,
80                'FTLoginLevel' => 'HQ',
81                'FTStaLoginAgn' => 0,
82              ),
83            ),
84            'tSesSessionID' => '0000220230123185822',
85            'tSesSessionDate' => '2023-01-23 18:58:22',
86            'tLangEdit' => 1,
87            'bIsHaveAgn' => NULL,
88            'tSesUsrLevel' => 'HQ',
89            'tSesUsrRoleSpcCodeMulti' => '\'00002\',\'00003\',\'00004\',\'00005\',\'00006\',\'00007\',\'00008\',\'00009\',\'00010\',\'00011\',\'00012\',\'00013\',\'00014\',\'00016\',\'00017\',\'00018\',\'00019\',\'00020\',\'00021\',\'00022\',\'00023\',\'00024\',\'00025\',\'00026\',\'00027\',\'00028\',\'00029\',\'00030\',\'00031\',\'00032\',\'00033\',\'00034\',\'00035\',\'00036\',\'00037\',\'00038\'',
90            'bShpEnabled' => 1,
91            'bAgnEnabled' => 1,
92            'bLockerEnabled' => NULL,
93            'bPdtFasionEnabled' => NULL,
94            'tSesHQBchCode' => '00001',
95            'bSesRegStaLicense' => 1,
96            'tSesCstKey' => '52a8a4705e6c',
97            'bSesRegStaBuyPackage' => 1,
98        );
99
100
101    }
102    //user/0/0
103    //21-03-2023 Papitchaya
104    public function test_USR01_เข้าหน้าแรกต้องสำเร็จ(){
105        print ' test_USR01_เข้าหน้าแรกต้องสำเร็จ';
106        $oOutput = $this->request(
107            'POST',
108            'authen/user/cUser/index/0/0'
109        );
110        $this->assertStringContainsString('oetUsrStaBrowse', $oOutput);
111        $this->assertResponseCode(200);
112    }
113
114    //userList
115    //21-03-2023 Papitchaya
116    public function test_USR02_เข้าหน้าหลักต้องสำเร็จ(){
117        print ' test_USR02_เข้าหน้าหลักต้องสำเร็จ';
118        $oOutput = $this->request(
119            'POST',
120            'authen/user/cUser/FSvUSRListPage'
121        );
122        $this->assertStringContainsString('ostSearchUser', $oOutput);
123        $this->assertResponseCode(200);
124    }
125
126    //userDataTable
127    //21-03-2023 Papitchaya
128    public function test_USR03_โหลดข้อมูลมาแสดงเป็นตารางต้องสำเร็จ(){
129        print ' test_USR03_โหลดข้อมูลมาแสดงเป็นตารางต้องสำเร็จ';
130        $aParam = array(
131            'tSearchAll'    => '',
132            'nPageCurrent'  => '1',
133        );
134        $oOutput = $this->request(
135            'POST',
136            'authen/user/cUser/FSvUSRDataList',
137            $aParam
138        );
139        ob_end_flush();
140        $this->assertStringContainsString('otbUserDataList', $oOutput);
141        $this->assertResponseCode(200);
142    }
143
144    //ImportFileExcel
145    //21-03-2023 Papitchaya
146    public function test_USR04_นำเข้าข้อมูล_1_รายการ_ต้องสำเร็จ(){
147        print ' test_USR04_นำเข้าข้อมูล_1_รายการ_ต้องสำเร็จ';
148        $aParam = array(
149            'aPackdata' => array(
150                '0' => array(
151                    '0' => '*User Code [Text 20] (ห้ามซ้ำ)',
152                    '1' => '*Name [Text 100]',
153                    '2' => 'Branch Code (Plant) : Text[5]',
154                    '3' => 'Role (SKC Blank) : Text[5]',
155                    '4' => 'Agency Code (AD/SaleOrg) : Text[10]',
156                    '5' => 'Merchant (SKC Blank) Text[10]',
157                    '6' => 'Shop  (SKC Blank) Text[5]',
158                    '7' => 'Depart Code [Text 5]',
159                    '8' => 'Telephone [50]',
160                    '9' => 'Email [100]',
161                ),
162                '1' => array(
163                    '0' => '080',
164                    '1' => '080_จัดซื้อ',
165                    '2' => '00001',
166                    '3' => '00005',
167                    '4' => '00001',
168                    '5' => '',
169                    '6' => '',
170                    '7' => '',
171                    '8' => '',
172                    '9' => '',
173                    '10' => '1',
174                    '11' => '',
175                ),
176            ),
177            'tNameModule' => 'user',
178            'tTypeModule' => 'master',
179            'tFlagClearTmp' => '',
180            'tImportDocumentNo' => '',
181            'tImportFrmBchCode' => '',
182            'tImportSplVatRate' => '',
183            'tImportSplVatCode' => '',
184          );
185        $oOutput = $this->request(
186            'POST',
187            'common/cHome/FSxImpImportFileExcel',
188            $aParam
189        );
190        $this->assertStringContainsString('aInsPackdata', $oOutput);
191        $this->assertResponseCode(200);
192    }
193
194    //userEventImportDelete
195    //21-03-2023 Papitchaya
196    public function test_USR05_ลบข้อมูลที่นำเข้า_1_รายการ_ต้องสำเร็จ(){
197        print ' test_USR05_ลบข้อมูลที่นำเข้า_1_รายการ_ต้องสำเร็จ';
198        $aParam = array(
199            'FTUsrCode' => '080',
200            'FNTmpSeq' => '1',
201          );
202        $oOutput = $this->request(
203            'POST',
204            'authen/user/cUser/FSaCUSRImportDelete',
205            $aParam
206        );
207        $this->assertStringContainsString('Delete Complete.', $oOutput);
208        $this->assertResponseCode(200);
209    }
210
211    // ImportFileExcel
212    // 21-03-2023 Papitchaya
213    public function test_USR06_นำเข้าข้อมูล_2_รายการ_ต้องสำเร็จ(){
214        print ' test_USR06_นำเข้าข้อมูล_2_รายการ_ต้องสำเร็จ';
215        $aParam = array(
216            'aPackdata' => array(
217                '0' => array(
218                    '0' => '*User Code [Text 20] (ห้ามซ้ำ)',
219                    '1' => '*Name [Text 100]',
220                    '2' => 'Branch Code (Plant) : Text[5]',
221                    '3' => 'Role (SKC Blank) : Text[5]',
222                    '4' => 'Agency Code (AD/SaleOrg) : Text[10]',
223                    '5' => 'Merchant (SKC Blank) Text[10]',
224                    '6' => 'Shop  (SKC Blank) Text[5]',
225                    '7' => 'Depart Code [Text 5]',
226                    '8' => 'Telephone [50]',
227                    '9' => 'Email [100]',
228                ),
229                '1' => array(
230                    '0' => '081',
231                    '1' => '081_จัดซื้อ',
232                    '2' => '00001',
233                    '3' => '00005',
234                    '4' => '00001',
235                    '5' => '',
236                    '6' => '',
237                    '7' => '',
238                    '8' => '',
239                    '9' => '',
240                    '10' => '1',
241                    '11' => '',
242                ),
243                '2' => array(
244                    '0' => '082',
245                    '1' => '082_จัดซื้อ',
246                    '2' => '00001',
247                    '3' => '00005',
248                    '4' => '00001',
249                    '5' => '',
250                    '6' => '',
251                    '7' => '',
252                    '8' => '',
253                    '9' => '',
254                    '10' => '1',
255                    '11' => '',
256                ),
257            ),
258            'tNameModule' => 'user',
259            'tTypeModule' => 'master',
260            'tFlagClearTmp' => '',
261            'tImportDocumentNo' => '',
262            'tImportFrmBchCode' => '',
263            'tImportSplVatRate' => '',
264            'tImportSplVatCode' => '',
265          );
266        $oOutput = $this->request(
267            'POST',
268            'common/cHome/FSxImpImportFileExcel',
269            $aParam
270        );
271        $this->assertStringContainsString('aInsPackdata', $oOutput);
272        $this->assertResponseCode(200);
273    }
274
275    //userEventImportDelete
276    //21-03-2023 Papitchaya
277    public function test_USR07_ลบข้อมูลที่นำเข้าหลายรายการ_ต้องสำเร็จ(){
278        print ' test_USR07_ลบข้อมูลที่นำเข้าหลายรายการ_ต้องสำเร็จ';
279        $aParam = array(
280            'FTUsrCode' => array(
281              '0' => '081',
282              '1' => '082',
283            ),
284            'FNTmpSeq' => array(
285              '0' => '1',
286              '1' => '2',
287            ),
288        );
289        $oOutput = $this->request(
290            'POST',
291            'authen/user/cUser/FSaCUSRImportDelete',
292            $aParam
293        );
294        $this->assertStringContainsString('Delete Complete.', $oOutput);
295        $this->assertResponseCode(200);
296    }
297
298    // ImportFileExcel
299    // 21-03-2023 Papitchaya
300    public function test_USR08_นำเข้าข้อมูล_3_รายการ_ต้องสำเร็จ(){
301        print ' test_USR08_นำเข้าข้อมูล_3_รายการ_ต้องสำเร็จ';
302        $aParam = array(
303            'aPackdata' => array(
304                '0' => array(
305                    '0' => '*User Code [Text 20] (ห้ามซ้ำ)',
306                    '1' => '*Name [Text 100]',
307                    '2' => 'Branch Code (Plant) : Text[5]',
308                    '3' => 'Role (SKC Blank) : Text[5]',
309                    '4' => 'Agency Code (AD/SaleOrg) : Text[10]',
310                    '5' => 'Merchant (SKC Blank) Text[10]',
311                    '6' => 'Shop  (SKC Blank) Text[5]',
312                    '7' => 'Depart Code [Text 5]',
313                    '8' => 'Telephone [50]',
314                    '9' => 'Email [100]',
315                ),
316                '1' => array(
317                    '0' => '081',
318                    '1' => '081_จัดซื้อ',
319                    '2' => '00001',
320                    '3' => '00005',
321                    '4' => '00001',
322                    '5' => '',
323                    '6' => '',
324                    '7' => '',
325                    '8' => '',
326                    '9' => '',
327                    '10' => '1',
328                    '11' => '',
329                ),
330                '2' => array(
331                    '0' => '082',
332                    '1' => '082_จัดซื้อ',
333                    '2' => '00001',
334                    '3' => '00005',
335                    '4' => '00001',
336                    '5' => '',
337                    '6' => '',
338                    '7' => '',
339                    '8' => '',
340                    '9' => '',
341                    '10' => '1',
342                    '11' => '',
343                ),
344                '3' => array(
345                    '0' => '083',
346                    '1' => '083_จัดซื้อ',
347                    '2' => '00001',
348                    '3' => '00005',
349                    '4' => '00001',
350                    '5' => '',
351                    '6' => '',
352                    '7' => '',
353                    '8' => '',
354                    '9' => '',
355                    '10' => '1',
356                    '11' => '',
357                ),
358            ),
359            'tNameModule' => 'user',
360            'tTypeModule' => 'master',
361            'tFlagClearTmp' => '',
362            'tImportDocumentNo' => '',
363            'tImportFrmBchCode' => '',
364            'tImportSplVatRate' => '',
365            'tImportSplVatCode' => '',
366          );
367        $oOutput = $this->request(
368            'POST',
369            'common/cHome/FSxImpImportFileExcel',
370            $aParam
371        );
372        $this->assertStringContainsString('aInsPackdata', $oOutput);
373        $this->assertResponseCode(200);
374    }
375
376    //userEventImportMove2Master
377    // 21-03-2023 Papitchaya
378    public function test_USR09_ยืนยันการนำเข้าข้อมูล_ต้องสำเร็จ(){
379        print ' test_USR09_ยืนยันการนำเข้าข้อมูล_ต้องสำเร็จ';
380        $aParam = array(
381            'tTypeCaseDuplicate' => '2',
382            'tDefaultPwd' => 'L2lAf14Fp/jQlypugDBNoA==',
383        );
384        $oOutput = $this->request(
385            'POST',
386            'authen/user/cUser/FSaCUSRImportMove2Master',
387            $aParam
388        );
389        $this->assertStringContainsString('success', $oOutput);
390        $this->assertResponseCode(200);
391    }
392
393}