Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
0.00% covered (danger)
0.00%
0 / 203
0.00% covered (danger)
0.00%
0 / 12
CRAP
0.00% covered (danger)
0.00%
0 / 1
Printbarcode_test
0.00% covered (danger)
0.00%
0 / 203
0.00% covered (danger)
0.00%
0 / 12
182
0.00% covered (danger)
0.00%
0 / 1
 __construct
n/a
0 / 0
n/a
0 / 0
1
 test_PRI01_เข้าหน้าแรกต้องสำเร็จ
0.00% covered (danger)
0.00%
0 / 7
0.00% covered (danger)
0.00%
0 / 1
2
 test_PRI02_เข้าหน้าหลักต้องสำเร็จ
0.00% covered (danger)
0.00%
0 / 14
0.00% covered (danger)
0.00%
0 / 1
2
 test_PRI03_เพิ่มสินค้าลงตาราง_1_สินค้าต้องสำเร็จ
0.00% covered (danger)
0.00%
0 / 36
0.00% covered (danger)
0.00%
0 / 1
2
 test_PRI04_กดปุ่มล้างข้อมูลต้องสำเร็จ
0.00% covered (danger)
0.00%
0 / 2
0.00% covered (danger)
0.00%
0 / 1
2
 test_PRI05_เพิ่มสินค้าลงตารางหลายสินค้าต้องสำเร็จ
0.00% covered (danger)
0.00%
0 / 36
0.00% covered (danger)
0.00%
0 / 1
2
 test_PRI06_นำข้อมูลสินค้าที่จะพิมพ์มาแสดงเป็นตารางต้องสำเร็จ
0.00% covered (danger)
0.00%
0 / 14
0.00% covered (danger)
0.00%
0 / 1
2
 test_PRI07_ค้นหาชื่อสินค้าที่จะพิมพ์ต้องสำเร็จ
0.00% covered (danger)
0.00%
0 / 14
0.00% covered (danger)
0.00%
0 / 1
2
 test_PRI08_เก็บข้อมูลที่จะพิมพ์ลงตารางHDTmpต้องสำเร็จ
0.00% covered (danger)
0.00%
0 / 15
0.00% covered (danger)
0.00%
0 / 1
2
 test_PRI09_แสดงตัวอย่างก่อนพิมพ์ต้องสำเร็จ
0.00% covered (danger)
0.00%
0 / 11
0.00% covered (danger)
0.00%
0 / 1
2
 test_PRI10_กดยืนยันการสั่งพิมพ์ต้องสำเร็จ
0.00% covered (danger)
0.00%
0 / 12
0.00% covered (danger)
0.00%
0 / 1
2
 test_PRI11_นำเข้าสินค้าผ่าน_template_ต้องมีข้อมูล
0.00% covered (danger)
0.00%
0 / 27
0.00% covered (danger)
0.00%
0 / 1
2
 test_PRI12_สั่งพิมพ์จากการนำเข้าสินค้าผ่าน_template_ต้องมีข้อมูล
0.00% covered (danger)
0.00%
0 / 15
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 Printbarcode_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            'tSesUsrMeclsrName' => 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' => array (
55              'FTUsrStaActive' => 1,
56              'FTUsrLogType' => 1,
57              'FTStaError' => 0,
58              'FTUsrCode' => '00002',
59              'FTUsrName' => 'Adasoft',
60              'FTDptCode' => NULL,
61              'FTDptName' => NULL,
62              'FTImgObj' => NULL,
63            ),
64            'tSesUsrGroup' => array (
65              0 => array (
66                'FTUsrCode' => '00002',
67                'FTAgnCode' => NULL,
68                'FTAgnName' => NULL,
69                'FTBchCode' => NULL,
70                'FTBchName' => NULL,
71                'FTShpCode' => NULL,
72                'FTShpName' => NULL,
73                'FTMerCode' => NULL,
74                'FTMerName' => NULL,
75                'FTWahCode' => NULL,
76                'FTWahName' => NULL,
77                'FTLoginLevel' => 'HQ',
78                'FTStaLoginAgn' => 0,
79              ),
80            ),
81            //'tSesSessionID' => '0000220230123185822',
82            'tSesSessionID' => '0000220230301232726',
83            'tSesSessionDate' => '2023-01-23 18:58:22',
84            'tLangEdit' => 1,
85            'bIsHaveAgn' => NULL,
86            'tSesUsrLevel' => 'HQ',
87            '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\'',
88            'bShpEnabled' => 1,
89            'bAgnEnabled' => 1,
90            'bLockerEnabled' => NULL,
91            'bPdtFasionEnabled' => NULL,
92            'tSesHQBchCode' => '00001',
93            'bSesRegStaLicense' => 1,
94            'tSesCstKey' => '52a8a4705e6c',
95            'bSesRegStaBuyPackage' => 1,
96        );
97    }
98
99    // Route : index
100    public function test_PRI01_เข้าหน้าแรกต้องสำเร็จ(){
101        print 'test_PRI01_เข้าหน้าแรกต้องสำเร็จ';
102        $oOutput = $this->request(
103            'POST',
104            'settingconfig/settingprint/Printbarcode_Controller/index/0/0'
105        );
106        $this->assertStringContainsString('odvSrvPriMainMenu', $oOutput);
107        $this->assertResponseCode(200);
108    }
109
110    // Route : PrintBarCodeDataTableSearch
111    public function test_PRI02_เข้าหน้าหลักต้องสำเร็จ(){
112        print 'test_PRI02_เข้าหน้าหลักต้องสำเร็จ';
113        $aParam = array(
114            'tPlbCode'             => '',
115            'tSearchAll'         => '',
116            'tPRNLblVerGroup'     => '',
117            'nPageCurrent'         => '1',
118        );
119        $oOutput = $this->request(
120            'POST',
121            'settingconfig/settingprint/Printbarcode_Controller/FSvPriDataTableSearch',
122            $aParam
123        );
124        $this->assertStringContainsString('otbPBPdtTemp', $oOutput);
125        $this->assertResponseCode(200);
126    }
127
128    // Route : PrintBarCodeMoveDataIntoTable
129    public function test_PRI03_เพิ่มสินค้าลงตาราง_1_สินค้าต้องสำเร็จ(){
130        print 'test_PRI03_เพิ่มสินค้าลงตาราง_1_สินค้าต้องสำเร็จ';
131        $aParam = array(
132            'tPlbCode' => '00010',
133            'tPrnBarSheet' => 'Normal',
134            'tPrnBarXthDocDateFrom' => '',
135            'tPrnBarXthDocDateTo' => '',
136            'tPrnBarBrowseRptNoFromCode' => '',
137            'tPrnBarBrowseRptNoToCode' => '',
138            'tPrnBarBrowsePdtFromCode' => '00164',
139            'tPrnBarBrowsePdtToCode' => '00164',
140            'tPrnBarBrowsePdtGrpFromCode' => '',
141            'tPrnBarBrowsePdtGrpToCode' => '',
142            'tPrnBarBrowsePdtTypeFromCode' => '',
143            'tPrnBarBrowsePdtTypeToCode' => '',
144            'tPrnBarBrowsePdtBrandFromCode' => '',
145            'tPrnBarBrowsePdtBrandToCode' => '',
146            'tPrnBarBrowsePdtModelFromCode' => '',
147            'tPrnBarBrowsePdtModelToCode' => '',
148            'tPrnBarPdtDepartCode' => '',
149            'tPrnBarPdtClassCode' => '',
150            'tPrnBarPdtSubClassCode' => '',
151            'tPrnBarPdtGroupCode' => '',
152            'tPrnBarPdtComLinesCode' => '',
153            'tPrnBarTotalPrint' => '1',
154            'nPrnBarStaStartDate' => '2',
155            'tPrnBarEffectiveDate' => '2023-03-29',
156            'tPRNLblVerGroup' => 'SL Land',
157            'tPRNLblCode' => 'SL001',
158        );
159
160        $oOutput = $this->request(
161            'POST',
162            'settingconfig/settingprint/Printbarcode_Controller/FSxPriBarMoveDataIntoTable',
163            $aParam
164        );
165        $this->assertStringContainsString('tPlbCode', $oOutput);
166        $this->assertResponseCode(200);
167    }
168
169    // ปุ่มล้างข้อมูล
170    public function test_PRI04_กดปุ่มล้างข้อมูลต้องสำเร็จ(){
171        print 'test_PRI04_กดปุ่มล้างข้อมูลต้องสำเร็จ';
172        $this->test_PRI01_เข้าหน้าแรกต้องสำเร็จ();
173    }
174
175    // Route : PrintBarCodeMoveDataIntoTable
176    public function test_PRI05_เพิ่มสินค้าลงตารางหลายสินค้าต้องสำเร็จ(){
177        print 'test_PRI05_เพิ่มสินค้าลงตารางหลายสินค้าต้องสำเร็จ';
178        $aParam = array(
179            'tPlbCode' => '00010',
180            'tPrnBarSheet' => 'Normal',
181            'tPrnBarXthDocDateFrom' => '',
182            'tPrnBarXthDocDateTo' => '',
183            'tPrnBarBrowseRptNoFromCode' => '',
184            'tPrnBarBrowseRptNoToCode' => '',
185            'tPrnBarBrowsePdtFromCode' => '00164',
186            'tPrnBarBrowsePdtToCode' => '00167',
187            'tPrnBarBrowsePdtGrpFromCode' => '',
188            'tPrnBarBrowsePdtGrpToCode' => '',
189            'tPrnBarBrowsePdtTypeFromCode' => '',
190            'tPrnBarBrowsePdtTypeToCode' => '',
191            'tPrnBarBrowsePdtBrandFromCode' => '',
192            'tPrnBarBrowsePdtBrandToCode' => '',
193            'tPrnBarBrowsePdtModelFromCode' => '',
194            'tPrnBarBrowsePdtModelToCode' => '',
195            'tPrnBarPdtDepartCode' => '',
196            'tPrnBarPdtClassCode' => '',
197            'tPrnBarPdtSubClassCode' => '',
198            'tPrnBarPdtGroupCode' => '',
199            'tPrnBarPdtComLinesCode' => '',
200            'tPrnBarTotalPrint' => '1',
201            'nPrnBarStaStartDate' => '2',
202            'tPrnBarEffectiveDate' => '2023-03-29',
203            'tPRNLblVerGroup' => 'SL Land',
204            'tPRNLblCode' => 'SL001',
205        );
206        $oOutput = $this->request(
207            'POST',
208            'settingconfig/settingprint/Printbarcode_Controller/FSxPriBarMoveDataIntoTable',
209            $aParam
210        );
211        $this->assertStringContainsString('tPlbCode', $oOutput);
212        $this->assertResponseCode(200);
213    }
214
215    // Route : PrintBarCodeDataTableSearch
216    public function test_PRI06_นำข้อมูลสินค้าที่จะพิมพ์มาแสดงเป็นตารางต้องสำเร็จ(){
217        print 'test_PRI06_นำข้อมูลสินค้าที่จะพิมพ์มาแสดงเป็นตารางต้องสำเร็จ';
218        $aParam = array(
219            'tPlbCode' => '00010',
220            'tSearchAll' => '',
221            'tPRNLblVerGroup' => 'SL Land',
222            'nPageCurrent' => '1',
223        );
224        $oOutput = $this->request(
225            'POST',
226            'settingconfig/settingprint/Printbarcode_Controller/FSvPriDataTableSearch',
227            $aParam
228        );
229        $this->assertStringContainsString('odvPBCList', $oOutput);
230        $this->assertResponseCode(200);
231    }
232
233    // Route : PrintBarCodeDataTableSearch
234    public function test_PRI07_ค้นหาชื่อสินค้าที่จะพิมพ์ต้องสำเร็จ(){
235        print 'test_PRI07_ค้นหาชื่อสินค้าที่จะพิมพ์ต้องสำเร็จ';
236        $aParam = array(
237            'tPlbCode' => '00010',
238            'tSearchAll' => '3 หน่วย',
239            'tPRNLblVerGroup' => 'SL Land',
240            'nPageCurrent' => '1',
241        );
242        $oOutput = $this->request(
243            'POST',
244            'settingconfig/settingprint/Printbarcode_Controller/FSvPriDataTableSearch',
245            $aParam
246        );
247        $this->assertStringContainsString('odvPBCList', $oOutput);
248        $this->assertResponseCode(200);
249    }
250
251    // Route : PrintBarCodeEventGenHD
252    public function test_PRI08_เก็บข้อมูลที่จะพิมพ์ลงตารางHDTmpต้องสำเร็จ(){
253        print 'test_PRI08_เก็บข้อมูลที่จะพิมพ์ลงตารางHDTmpต้องสำเร็จ';
254        $aParam = array(
255            'paPackData' => array(
256                'nPrnType' => '1',
257                'tRptNormalQtyPerPage' => '3',
258                'tRptPromotionQtyPerPage' => '',
259            ),
260        );
261        $oOutput = $this->request(
262            'POST',
263            'settingconfig/settingprint/Printbarcode_Controller/FSoPRNEventGenHD',
264            $aParam
265        );
266        $this->assertStringContainsString('Gen HD Tmp Success', $oOutput);
267        $this->assertResponseCode(200);
268    }
269
270    // Route : PrintBarCodePagePreviewList
271    public function test_PRI09_แสดงตัวอย่างก่อนพิมพ์ต้องสำเร็จ(){
272        print 'test_PRI09_แสดงตัวอย่างก่อนพิมพ์ต้องสำเร็จ';
273        $aParam = array(
274            'pnPrnType' => '1',
275        );
276        $oOutput = $this->request(
277            'POST',
278            'settingconfig/settingprint/Printbarcode_Controller/FSvPriPagePreviewList',
279            $aParam
280        );
281        $this->assertStringContainsString('otbPRNPreview', $oOutput);
282        $this->assertResponseCode(200);
283    }
284
285    // Route : PrintBarCodeMQProcess
286    public function test_PRI10_กดยืนยันการสั่งพิมพ์ต้องสำเร็จ(){
287        print 'test_PRI10_กดยืนยันการสั่งพิมพ์ต้องสำเร็จ';
288        $aParam = array(
289            'tPrnBarPrnLableCode'     => '00010',
290            'tPrnBarPrnSrvCode'     => '00006',
291        );
292        $oOutput = $this->request(
293            'POST',
294            'settingconfig/settingprint/Printbarcode_Controller/FSvPriBarMQProcess',
295            $aParam
296        );
297        $this->assertStringContainsString('', $oOutput);
298        $this->assertResponseCode(200);
299    }
300
301
302
303
304
305    // Route : PrintBarCodeMQProcess
306    public function test_PRI11_นำเข้าสินค้าผ่าน_template_ต้องมีข้อมูล(){
307        print 'test_PRI11_นำเข้าสินค้าผ่าน_template_ต้องมีข้อมูล';
308        $aParam = array(
309            'aPackdata' => array(
310                    0 => array('* BarCode Text[25]','* Qty  Decimal[18,4]'),
311                    1 => array('9900001','1','1',''),
312            ),
313            'tNameModule'     => 'printbarcode',
314            'tTypeModule'     => 'document',
315            'tFlagClearTmp' => 1,
316            'tImportDocumentNo' => '',
317            'tImportFrmBchCode' => '',
318            'tImportSplVatRate' => '',
319            'tImportSplVatCode' => '',
320            'poImportBarprint' => array(
321                    'tImportLblCode' => 'L009',
322                    'tImportPrnBarSheet' => 'Normal',
323                    'tImportPrnBarStaStartDate' => 'on',
324                    'tImportPrnBarEffectiveDate' => '2023-04-11'
325            ),
326        );
327        $oOutput = $this->request(
328            'POST',
329            'common/cHome/FSxImpImportFileExcel',
330            $aParam
331        );
332        $this->assertStringContainsString('', $oOutput);
333        $this->assertResponseCode(200);
334
335    }
336
337
338        // Route : PrintBarCodeEventGenHD
339        public function test_PRI12_สั่งพิมพ์จากการนำเข้าสินค้าผ่าน_template_ต้องมีข้อมูล(){
340            print 'test_PRI12_สั่งพิมพ์จากการนำเข้าสินค้าผ่าน_template_ต้องมีข้อมูล';
341            $aParam = array(
342                'paPackData' => array(
343                    'nPrnType' => 1,
344                    'tRptNormalQtyPerPage' => 28,
345                    'tRptPromotionQtyPerPage' => 28,
346                )
347            );
348    
349            $oOutput = $this->request(
350                'POST',
351                'settingconfig/settingprint/Printbarcode_Controller/FSoPRNEventGenHD',
352                $aParam
353            );
354            $this->assertStringContainsString('Gen HD Tmp Success', $oOutput);
355            $this->assertResponseCode(200);
356        }
357
358}