Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
0.00% covered (danger)
0.00%
0 / 75
0.00% covered (danger)
0.00%
0 / 6
CRAP
0.00% covered (danger)
0.00%
0 / 1
Abbsalerefund_test
0.00% covered (danger)
0.00%
0 / 75
0.00% covered (danger)
0.00%
0 / 6
56
0.00% covered (danger)
0.00%
0 / 1
 __construct
n/a
0 / 0
n/a
0 / 0
1
 test_เข้าหน้าแรก
0.00% covered (danger)
0.00%
0 / 7
0.00% covered (danger)
0.00%
0 / 1
2
 test_โหลดข้อมูลตัวกรอง
0.00% covered (danger)
0.00%
0 / 7
0.00% covered (danger)
0.00%
0 / 1
2
 test_เลือกดูรายละเอียดบิลอ่างย่อ
0.00% covered (danger)
0.00%
0 / 11
0.00% covered (danger)
0.00%
0 / 1
2
 test_ค้นหารหัสสินค้าในเอกสารใบกำกับภาษีอย่างย่อ
0.00% covered (danger)
0.00%
0 / 12
0.00% covered (danger)
0.00%
0 / 1
2
 test_ค้นหาเอกสารใบอย่างย่อด้วยสาขา
0.00% covered (danger)
0.00%
0 / 19
0.00% covered (danger)
0.00%
0 / 1
2
 test_โหลดข้อมูลเอกสารใบอย่างย่อ
0.00% covered (danger)
0.00%
0 / 19
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 Abbsalerefund_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        $_SESSION['tSesUsername'] = '';
22        $_SESSION['tLangID'] = 1;
23        $this->code = substr(md5(uniqid(mt_rand(), true)), 0, 5);
24        $ci->load->model('authen/login/mLogin');
25        $tSQL = "SELECT
26                FTUsrCode,
27                COUNT (FTBchCode) AS nBch
28            FROM
29                TCNTUsrGroup
30            GROUP BY
31                FTUsrCode
32            HAVING
33                COUNT (FTBchCode) > 1";
34        $aResult = $ci->db->query($tSQL);//หาผู้ใช้ที่มีสาขามากกว่า 1 สาขา
35        $aUsrData  = $aResult->row_array();
36     
37        $aDataUsrGroup = $ci->mLogin->FSaMLOGGetDataUserLoginGroup($aUsrData['FTUsrCode']);
38        $tUsrBchCodeMulti     = $ci->mLogin->FStMLOGMakeArrayToString($aDataUsrGroup,'FTBchCode','value');
39        $tUsrBchNameMulti     = $ci->mLogin->FStMLOGMakeArrayToString($aDataUsrGroup,'FTBchName','value');
40        $tUsrShpCodeMulti     = $ci->mLogin->FStMLOGMakeArrayToString($aDataUsrGroup,'FTShpCode','value');
41        $tUsrShpNameMulti     = $ci->mLogin->FStMLOGMakeArrayToString($aDataUsrGroup,'FTShpName','value');
42        $_SESSION =array (
43            '__ci_last_regenerate' => 1674475513,
44            'lang' => 'th',
45            'tLangID' => 1,
46            'tSesUserLogin' => '009',
47            'tSesUsrRoleCodeMulti' => '\'00002\'',
48            'nSesUsrRoleLevel' => 99,
49            'tSesUsrAgnCode' => NULL,
50            'tSesUsrAgnName' => NULL,
51            'tSesUsrMerCode' => NULL,
52            'tSesUsrMerName' => NULL,
53            'tSesUsrBchCodeDefault' => '00001',
54            'tSesUsrBchNameDefault' => 'AdaSoft00001',
55            'tSesUsrBchCodeMulti' => $tUsrBchCodeMulti,
56            'tSesUsrBchNameMulti' => $tUsrBchNameMulti,
57            'nSesUsrBchCount' => 0,
58            'tSesUsrShpCodeDefault' => '00014',
59            'tSesUsrShpNameDefault' => 'รันไทม์ช็อป',
60            'tSesUsrShpCodeMulti' => $tUsrShpCodeMulti,
61            'tSesUsrShpNameMulti' => $tUsrShpNameMulti,
62            'nSesUsrShpCount' => 0,
63            'tSesUsrWahCode' => '00001',
64            'tSesUsrWahName' => 'คลังขาย',
65            'tSesUsrLoginLevel' => 'BCH',
66            'tSesUsrLoginAgency' => 0,
67            'bSesLogIn' => 1,
68            'tSesUserCode' => $aUsrData['FTUsrCode'],
69            'tSesUsername' => $aUsrData['FTUsrCode'],
70            'tSesUsrDptName' => NULL,
71            'tSesUsrDptCode' => NULL,
72            'tSesUsrUsername' => 'Adasoft',
73            'tSesUsrImagePerson' => NULL,
74            'tSesUsrInfo' => 
75            array (
76              'FTUsrStaActive' => 1,
77              'FTUsrLogType' => 1,
78              'FTStaError' => 0,
79              'FTUsrCode' => $aUsrData['FTUsrCode'],
80              'FTUsrName' => 'Adasoft',
81              'FTDptCode' => NULL,
82              'FTDptName' => NULL,
83              'FTImgObj' => NULL,
84            ),
85            'tSesUsrGroup' => 
86            array (
87              0 => 
88              array (
89                'FTUsrCode' => '00002',
90                'FTAgnCode' => NULL,
91                'FTAgnName' => NULL,
92                'FTBchCode' => NULL,
93                'FTBchName' => NULL,
94                'FTShpCode' => NULL,
95                'FTShpName' => NULL,
96                'FTMerCode' => NULL,
97                'FTMerName' => NULL,
98                'FTWahCode' => NULL,
99                'FTWahName' => NULL,
100                'FTLoginLevel' => 'BCH',
101                'FTStaLoginAgn' => 0,
102              ),
103            ),
104            'tSesSessionID' => '0000220230123185822',
105            'tSesSessionDate' => '2023-01-23 18:58:22',
106            'tLangEdit' => 1,
107            'bIsHaveAgn' => NULL,
108            'tSesUsrLevel' => 'BCH',
109            '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\'',
110            'bShpEnabled' => 1,
111            'bAgnEnabled' => 1,
112            'bLockerEnabled' => NULL,
113            'bPdtFasionEnabled' => NULL,
114            'tSesHQBchCode' => '00001',
115            'bSesRegStaLicense' => 1,
116            'tSesCstKey' => '52a8a4705e6c',
117            'bSesRegStaBuyPackage' => 1,
118        );
119
120
121    }
122
123
124    public function test_เข้าหน้าแรก(){
125        print  "1.test_เลือกดูรายละเอียดบิลอ่างย่อ\n";
126
127      
128        $oOutput = $this->request(
129            'POST',
130            'document/abbsalerefund/Abbsalerefund_controller/index/0/0',
131        );
132        $this->assertStringContainsString('oetABBStaBrowse', $oOutput);
133        $this->assertResponseCode(200);
134    }
135
136
137    public function test_โหลดข้อมูลตัวกรอง(){
138        print  "2.test_โหลดข้อมูลตัวกรอง\n";
139
140      
141        $oOutput = $this->request(
142            'POST',
143            'document/abbsalerefund/Abbsalerefund_controller/FSvCABBPageList',
144        );
145        $this->assertStringContainsString('obtABBBrowseAgency', $oOutput);
146        $this->assertResponseCode(200);
147    }
148
149
150    public function test_เลือกดูรายละเอียดบิลอ่างย่อ(){
151        print  "3.test_เลือกดูรายละเอียดบิลอ่างย่อ\n";
152
153        $aParam = array(
154            'ptDocNo' => 'S2300057000010000023',
155        );
156        $oOutput = $this->request(
157            'POST',
158            'document/abbsalerefund/Abbsalerefund_controller/FSvCABBPageEdit',
159            $aParam
160        );
161        $this->assertStringContainsString('"tStaMessg":"Success"', $oOutput);
162        $this->assertResponseCode(200);
163    }
164
165
166    public function test_ค้นหารหัสสินค้าในเอกสารใบกำกับภาษีอย่างย่อ(){
167        print  "4.test_ค้นหารหัสสินค้าในเอกสารใบกำกับภาษีอย่างย่อ\n";
168
169        $aParam = array(
170            'ptDocNo' => 'S2300057000010000023',
171            'ptSearch'  => '8805631121',
172        );
173
174        $oOutput = $this->request(
175            'POST',
176            'document/abbsalerefund/Abbsalerefund_controller/FSvCABBPageProductDataTable',
177            $aParam
178        );
179        $this->assertStringContainsString('"tStaMessg":"success"', $oOutput);
180        $this->assertResponseCode(200);
181    }
182
183
184
185    public function test_ค้นหาเอกสารใบอย่างย่อด้วยสาขา(){
186        print  "5.test_ค้นหาเอกสารใบอย่างย่อด้วยสาขา\n";
187
188        $aParam =    array(
189            'pnPageCurrent' => '1',
190            'paSearchList' => array(
191              'tAgnCode' => '',
192              'tBchCode' => '00046',
193              'tStaPrcDoc' => '',
194              'tDocType' => 'ALL',
195              'tDocNo' => '',
196              'tChnCode' => '',
197            ),
198          );
199
200        $oOutput = $this->request(
201            'POST',
202            'document/abbsalerefund/Abbsalerefund_controller/FSvCABBPageDataTable',
203            $aParam
204        );
205        $this->assertStringContainsString('odvRGPList', $oOutput);
206        $this->assertResponseCode(200);
207    }
208
209
210    public function test_โหลดข้อมูลเอกสารใบอย่างย่อ(){
211        print  "6.test_โหลดข้อมูลเอกสารใบอย่างย่อ\n";
212
213        $aParam =    array(
214            'pnPageCurrent' => '1',
215            'paSearchList' => array(
216              'tAgnCode' => '',
217              'tBchCode' => '00046',
218              'tStaPrcDoc' => '',
219              'tDocType' => 'ALL',
220              'tDocNo' => '',
221              'tChnCode' => '',
222            ),
223          );
224
225        $oOutput = $this->request(
226            'POST',
227            'document/abbsalerefund/Abbsalerefund_controller/FSvCABBPageDataTable',
228            $aParam
229        );
230        $this->assertStringContainsString('odvRGPList', $oOutput);
231        $this->assertResponseCode(200);
232    }
233
234
235}