Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
0.00% covered (danger)
0.00%
0 / 151
0.00% covered (danger)
0.00%
0 / 11
CRAP
0.00% covered (danger)
0.00%
0 / 1
Branch_test
0.00% covered (danger)
0.00%
0 / 151
0.00% covered (danger)
0.00%
0 / 11
156
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 / 12
0.00% covered (danger)
0.00%
0 / 1
2
 test_PRI03_ค้นหาข้อมูลสาขาต้องสำเร็จ
0.00% covered (danger)
0.00%
0 / 12
0.00% covered (danger)
0.00%
0 / 1
2
 test_PRI04_เข้าหน้าแก้ไขข้อมูลสาขาต้องสำเร็จ
0.00% covered (danger)
0.00%
0 / 11
0.00% covered (danger)
0.00%
0 / 1
2
 test_PRI05_เข้าหน้าที่อยู่สาขาต้องสำเร็จ
0.00% covered (danger)
0.00%
0 / 12
0.00% covered (danger)
0.00%
0 / 1
2
 test_PRI06_โหลดตารางที่อยู่สาขาต้องสำเร็จ
0.00% covered (danger)
0.00%
0 / 11
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_บันทึกการแก้ไขที่อยู่สาขาต้องสำเร็จ
0.00% covered (danger)
0.00%
0 / 23
0.00% covered (danger)
0.00%
0 / 1
2
 test_PRI09_เข้าหน้าเพิ่มที่อยู่สาขาต้องสำเร็จ
0.00% covered (danger)
0.00%
0 / 12
0.00% covered (danger)
0.00%
0 / 1
2
 test_PRI10_บันทึกการเพิ่มที่อยู่สาขาต้องสำเร็จ
0.00% covered (danger)
0.00%
0 / 23
0.00% covered (danger)
0.00%
0 / 1
2
 test_PRI11_ลบที่อยู่สาขาต้องสำเร็จ
0.00% covered (danger)
0.00%
0 / 14
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 Branch_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            'company/branch/cBranch/index/0/0'
105        );
106        $this->assertStringContainsString('odvBchMainMenu', $oOutput);
107        $this->assertResponseCode(200);
108    }
109
110    // Route : branchDataTable
111    public function test_PRI02_เข้าหน้าหลักต้องสำเร็จ(){
112        print 'test_PRI02_เข้าหน้าหลักต้องสำเร็จ';
113        $aParam = array(
114            'tSearchAll'     => '',
115            'nPageCurrent'     => '1',
116        );
117        $oOutput = $this->request(
118            'POST',
119            'company/branch/cBranch/FSvCBCHDataList',
120            $aParam
121        );
122        $this->assertStringContainsString('ocbListItem', $oOutput);
123        $this->assertResponseCode(200);
124    }
125
126    // Route : branchDataTable
127    public function test_PRI03_ค้นหาข้อมูลสาขาต้องสำเร็จ(){
128        print 'test_PRI03_ค้นหาข้อมูลสาขาต้องสำเร็จ';
129        $aParam = array(
130            'tSearchAll'     => '00057',
131            'nPageCurrent'     => '1',
132        );
133        $oOutput = $this->request(
134            'POST',
135            'company/branch/cBranch/FSvCBCHDataList',
136            $aParam
137        );
138        $this->assertStringContainsString('ocbListItem', $oOutput);
139        $this->assertResponseCode(200);
140    }
141
142    // Route : branchPageEdit
143    public function test_PRI04_เข้าหน้าแก้ไขข้อมูลสาขาต้องสำเร็จ(){
144        print 'test_PRI04_เข้าหน้าแก้ไขข้อมูลสาขาต้องสำเร็จ';
145        $aParam = array(
146            'tBchCode' => '00057',
147        );
148        $oOutput = $this->request(
149            'POST',
150            'company/branch/cBranch/FSvCBCHEditPage',
151            $aParam
152        );
153        $this->assertStringContainsString('odvBranchPanelBody', $oOutput);
154        $this->assertResponseCode(200);
155    }
156
157    // Route : branchAddressData
158    public function test_PRI05_เข้าหน้าที่อยู่สาขาต้องสำเร็จ(){
159        print 'test_PRI05_เข้าหน้าที่อยู่สาขาต้องสำเร็จ';
160        $aParam = array(
161            'ptBchCode' => '00057',
162            'ptBchName' => 'Zen enterprise สาขาลาดพร้าว',
163        );
164        $oOutput = $this->request(
165            'POST',
166            'company/branch/cBranchAddress/FSvCBCHAddressData',
167            $aParam
168        );
169        $this->assertStringContainsString('ohdBranchAddressBchCode', $oOutput);
170        $this->assertResponseCode(200);
171    }
172
173    // Route : branchAddressDataTable
174    public function test_PRI06_โหลดตารางที่อยู่สาขาต้องสำเร็จ(){
175        print 'test_PRI06_โหลดตารางที่อยู่สาขาต้องสำเร็จ';
176        $aParam = array(
177            'ptBchCode' => '00057',
178        );
179        $oOutput = $this->request(
180            'POST',
181            'company/branch/cBranchAddress/FSvCBCHAddressDataTable',
182            $aParam
183        );
184        $this->assertStringContainsString('otbBranchAddressTableList', $oOutput);
185        $this->assertResponseCode(200);
186    }
187
188    // Route : branchAddressPageEdit
189    public function test_PRI07_เข้าหน้าแก้ไขที่อยู่สาขาต้องสำเร็จ(){
190        print 'test_PRI07_เข้าหน้าแก้ไขที่อยู่สาขาต้องสำเร็จ';
191        $aParam = array(
192            'FNLngID' => '1',
193            'FTAddGrpType' => '1',
194            'FTAddRefCode' => '00057',
195            'FNAddSeqNo' => '10',
196        );
197        $oOutput = $this->request(
198            'POST',
199            'company/branch/cBranchAddress/FSvCBCHAddressCallPageEdit',
200            $aParam
201        );
202        $this->assertStringContainsString('ofmBranchAddressForm', $oOutput);
203        $this->assertResponseCode(200);
204    }
205
206    // Route : branchAddressEditEvent
207    public function test_PRI08_บันทึกการแก้ไขที่อยู่สาขาต้องสำเร็จ(){
208        print 'test_PRI08_บันทึกการแก้ไขที่อยู่สาขาต้องสำเร็จ';
209        $aParam = array(
210            'ohdBranchAddressRoute' => 'branchAddressEditEvent',
211            'ohdBranchAddressRefCode' => '00057',
212            'ohdBranchAddressVersion' => '2',
213            'ohdBranchAddressGrpType' => '1',
214            'ohdBranchAddressSeqNo' => '10',
215            'ohdBranchAddressMapLong' => 'NaN',
216            'ohdBranchAddressMapLat' => 'NaN',
217            'oetBranchAddressName' => 'Zen enterprise สาขาลาดพร้าว',
218            'oetBranchAddressTaxNo' => '1102100231200',
219            'oetBranchAddressV2Desc1' => '',
220            'oetBranchAddressV2Desc2' => '',
221            'oetBranchAddressWebSite' => '',
222            'oetBranchAddressRmk' => '',
223        );
224        $oOutput = $this->request(
225            'POST',
226            'company/branch/cBranchAddress/FSoCBCHAddressEditEvent',
227            $aParam
228        );
229        $this->assertStringContainsString('Success Update Branch Address.', $oOutput);
230        $this->assertResponseCode(200);
231    }
232
233    // Route : branchAddressPageAdd
234    public function test_PRI09_เข้าหน้าเพิ่มที่อยู่สาขาต้องสำเร็จ(){
235        print 'test_PRI09_เข้าหน้าเพิ่มที่อยู่สาขาต้องสำเร็จ';
236        $aParam = array(
237            'ptBranchAddressBchCode' => '00057',
238            'ptBranchAddressBchName' => 'Zen enterprise สาขาลาดพร้าว',
239        );
240        $oOutput = $this->request(
241            'POST',
242            'company/branch/cBranchAddress/FSvCBCHAddressCallPageAdd',
243            $aParam
244        );
245        $this->assertStringContainsString('ofmBranchAddressForm', $oOutput);
246        $this->assertResponseCode(200);
247    }
248
249    // Route : branchAddressAddEvent
250    public function test_PRI10_บันทึกการเพิ่มที่อยู่สาขาต้องสำเร็จ(){
251        print 'test_PRI10_บันทึกการเพิ่มที่อยู่สาขาต้องสำเร็จ';
252        $aParam = array(
253            'ohdBranchAddressRoute' => 'branchAddressAddEvent',
254            'ohdBranchAddressRefCode' => '00057',
255            'ohdBranchAddressVersion' => '2',
256            'ohdBranchAddressGrpType' => '1',
257            'ohdBranchAddressSeqNo' => '',
258            'ohdBranchAddressMapLong' => '100.50172805786133',
259            'ohdBranchAddressMapLat' => '13.757291080701563',
260            'oetBranchAddressName' => 'Thailand',
261            'oetBranchAddressTaxNo' => '12345678',
262            'oetBranchAddressV2Desc1' => 'สยาม',
263            'oetBranchAddressV2Desc2' => 'ลาดพร้าว',
264            'oetBranchAddressWebSite' => '',
265            'oetBranchAddressRmk' => '',
266        );
267        $oOutput = $this->request(
268            'POST',
269            'company/branch/cBranchAddress/FSoCBCHAddressAddEvent',
270            $aParam
271        );
272        $this->assertStringContainsString('Success Add Branch Address.', $oOutput);
273        $this->assertResponseCode(200);
274    }
275
276    // Route : branchAddressDeleteEvent
277    public function test_PRI11_ลบที่อยู่สาขาต้องสำเร็จ(){
278        print 'test_PRI11_ลบที่อยู่สาขาต้องสำเร็จ';
279        $aParam = array(
280            'FNLngID' => '1',
281            'FTAddGrpType' => '1',
282            'FTAddRefCode' => '00057',
283            'FNAddSeqNo' => '11',
284        );
285        $oOutput = $this->request(
286            'POST',
287            'company/branch/cBranchAddress/FSoCBCHAddressDeleteEvent',
288            $aParam
289        );
290        $this->assertStringContainsString('Success Delete Branch Address.', $oOutput);
291        $this->assertResponseCode(200);
292    }
293}