Completed
Push — apply-codeceptions ( 341052...a29855 )
by Kentaro
53:23 queued 21:51
created

EA07BasicinfoCest   A

Complexity

Total Complexity 16

Size/Duplication

Total Lines 240
Duplicated Lines 31.67 %

Coupling/Cohesion

Components 1
Dependencies 10

Importance

Changes 0
Metric Value
dl 76
loc 240
rs 10
c 0
b 0
f 0
wmc 16
lcom 1
cbo 10

16 Methods

Rating   Name   Duplication   Size   Complexity  
A _before() 0 4 1
A _after() 0 3 1
A basicinfo_ショップマスター() 0 10 1
A basicinfo_支払方法一覧() 0 9 1
A basicinfo_支払方法入れ替え() 0 19 1
A basicinfo_支払方法登録() 21 21 1
A basicinfo_支払方法編集() 19 19 1
A basicinfo_支払方法削除() 0 9 1
A basicinfo_配送方法一覧() 0 9 1
A basicinfo_配送方法登録() 20 20 1
A basicinfo_配送方法編集() 0 17 1
A basicinfo_配送方法削除() 0 9 1
A basicinfo_配送方法一覧順序変更() 16 16 1
A basicinfo_税率設定() 0 32 1
A basicinfo_メール設定() 0 12 1
A basicinfo_CSV出力項目() 0 13 1

How to fix   Duplicated Code   

Duplicated Code

Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.

Common duplication problems, and corresponding solutions are:

1
<?php
2
3
use Codeception\Util\Fixtures;
4
use Page\Admin\CsvSettingsPage;
5
use Page\Admin\CustomerAgreementSettingPage;
6
use Page\Admin\DeliveryEditPage;
7
use Page\Admin\DeliveryManagePage;
8
use Page\Admin\MailSettingsPage;
9
use Page\Admin\PaymentEditPage;
10
use Page\Admin\PaymentManagePage;
11
use Page\Admin\ShopSettingPage;
12
use Page\Admin\TaxManagePage;
13
use Page\Admin\TradelawSettingPage;
14
15
/**
16
 * @group admin
17
 * @group admin03
18
 * @group basicinformation
19
 * @group ea7
20
 */
21
class EA07BasicinfoCest
0 ignored issues
show
Coding Style Compatibility introduced by
PSR1 recommends that each class must be in a namespace of at least one level to avoid collisions.

You can fix this by adding a namespace to your class:

namespace YourVendor;

class YourClass { }

When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.

Loading history...
22
{
23
    public function _before(\AcceptanceTester $I)
24
    {
25
        $I->loginAsAdmin();
26
    }
27
28
    public function _after(\AcceptanceTester $I)
0 ignored issues
show
Unused Code introduced by
The parameter $I is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
29
    {
30
    }
31
32
    public function basicinfo_ショップマスター(\AcceptanceTester $I)
33
    {
34
        $I->wantTo('EA0701-UC01-T01 ショップマスター');
35
36
        ShopSettingPage::go($I)
37
            ->入力_会社名('会社名')
38
            ->登録();
39
40
        $I->see('登録が完了しました。', ShopSettingPage::$登録完了メッセージ);
41
    }
42
43
    public function basicinfo_支払方法一覧(\AcceptanceTester $I)
44
    {
45
        $I->wantTo('EA0704-UC01-T01 支払方法 一覧');
46
47
        // 表示
48
        $PaymentManagePage = PaymentManagePage::go($I);
49
50
        $I->see('郵便振替', $PaymentManagePage->一覧_支払方法(1));
51
    }
52
53
    public function basicinfo_支払方法入れ替え(\AcceptanceTester $I)
54
    {
55
        $I->wantTo('EA0704-UC02-T01 支払方法 入れ替え');
56
57
        // 表示
58
        $PaymentManagePage = PaymentManagePage::go($I);
59
60
        // 入れ替え
61
        $I->see('郵便振替', $PaymentManagePage->一覧_支払方法(1));
62
        $PaymentManagePage->一覧_下に(1);
63
64
        $PaymentManagePage = PaymentManagePage::go($I);
65
        $I->see('郵便振替', $PaymentManagePage->一覧_支払方法(2));
66
67
68
        $PaymentManagePage->一覧_上に(2);
69
        $PaymentManagePage = PaymentManagePage::go($I);
70
        $I->see('郵便振替', $PaymentManagePage->一覧_支払方法(1));
71
    }
72
73 View Code Duplication
    public function basicinfo_支払方法登録(\AcceptanceTester $I)
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
74
    {
75
        $I->getScenario()->skip('EA0705-UC01-T01 支払方法 登録');
76
        $I->wantTo('EA0705-UC01-T01 支払方法 登録');
77
78
        // 表示
79
        // 登録フォーム
80
        PaymentManagePage::go($I)
81
            ->新規入力();
82
83
        // 登録
84
        PaymentEditPage::at($I)
85
            ->入力_支払方法('payment method1')
86
            ->入力_手数料('100')
87
            ->入力_利用条件下限('1')
88
            ->登録();
89
90
        $PaymentManagePage = PaymentManagePage::at($I);
91
        $I->see('登録が完了しました。', PaymentManagePage::$登録完了メッセージ);
92
        $I->see('payment method1', $PaymentManagePage->一覧_支払方法(1));
93
    }
94
95 View Code Duplication
    public function basicinfo_支払方法編集(\AcceptanceTester $I)
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
96
    {
97
        $I->getScenario()->skip('EA0705-UC01-T01 支払方法 登録');
98
        $I->wantTo('EA0705-UC02-T01 支払方法 編集');
99
100
        // 表示
101
        PaymentManagePage::go($I)
102
            ->一覧_編集(1);
103
104
        // 編集
105
        PaymentEditPage::at($I)
106
            ->入力_支払方法('payment method2')
107
            ->入力_手数料('1000')
108
            ->登録();
109
110
        $PaymentManagePage = PaymentManagePage::at($I);
111
        $I->see('登録が完了しました。', PaymentManagePage::$登録完了メッセージ);
112
        $I->see('payment method2', $PaymentManagePage->一覧_支払方法(1));
113
    }
114
115
    public function basicinfo_支払方法削除(\AcceptanceTester $I)
116
    {
117
        $I->wantTo('EA0704-UC03-T01 支払方法 削除');
118
119
        // 表示
120
        // 削除
121
        PaymentManagePage::go($I)
122
            ->一覧_削除(1);
123
    }
124
125
    public function basicinfo_配送方法一覧(\AcceptanceTester $I)
126
    {
127
        $I->wantTo('EA0706-UC01-T01 配送方法 一覧');
128
129
        // 表示
130
        $DeliveryManagePage = DeliveryManagePage::go($I);
131
132
        $I->see('サンプル宅配', $DeliveryManagePage->一覧_名称(1));
133
    }
134
135 View Code Duplication
    public function basicinfo_配送方法登録(\AcceptanceTester $I)
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
136
    {
137
        $I->wantTo('EA0707-UC01-T01 配送方法 登録');
138
139
        // 表示
140
        DeliveryManagePage::go($I)
141
            ->新規登録();
142
143
        // 登録
144
        DeliveryEditPage::at($I)
145
            ->入力_配送業者名('配送業者名')
146
            ->入力_名称('名称')
147
            ->入力_支払方法選択(['1', '4'])
148
            ->入力_全国一律送料('100')
149
            ->登録();
150
151
        $DeliveryManagePage = DeliveryManagePage::at($I);
152
        $I->see('登録が完了しました。', DeliveryManagePage::$登録完了メッセージ);
153
        $I->see('配送業者名', $DeliveryManagePage->一覧_名称(1));
154
    }
155
156
    public function basicinfo_配送方法編集(\AcceptanceTester $I)
157
    {
158
        $I->wantTo('EA0707-UC02-T01 配送方法 編集');
159
160
        // 表示
161
        DeliveryManagePage::go($I)
162
            ->一覧_編集(1);
163
164
        // 編集
165
        DeliveryEditPage::at($I)
166
            ->入力_配送業者名('配送業者名1')
167
            ->登録();
168
169
        $DeliveryManagePage = DeliveryManagePage::at($I);
170
        $I->see('登録が完了しました。', DeliveryManagePage::$登録完了メッセージ);
171
        $I->see('配送業者名1', $DeliveryManagePage->一覧_名称(1));
172
    }
173
174
    public function basicinfo_配送方法削除(\AcceptanceTester $I)
175
    {
176
        $I->wantTo('EA0706-UC03-T01 配送方法 削除');
177
178
        DeliveryManagePage::go($I)
179
            ->一覧_削除(1);
180
181
        $I->acceptPopup();
182
    }
183
184 View Code Duplication
    public function basicinfo_配送方法一覧順序変更(\AcceptanceTester $I)
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
185
    {
186
        $I->wantTo('EA0706-UC02-T01 配送方法一覧順序変更');
187
188
        $DeliveryManagePage = DeliveryManagePage::go($I);
189
        $I->see('サンプル宅配', $DeliveryManagePage->一覧_名称(1));
190
        $I->see('サンプル業者', $DeliveryManagePage->一覧_名称(2));
191
192
        $DeliveryManagePage->一覧_下に(1);
193
        $I->see('サンプル業者', $DeliveryManagePage->一覧_名称(1));
194
        $I->see('サンプル宅配', $DeliveryManagePage->一覧_名称(2));
195
196
        $DeliveryManagePage->一覧_上に(2);
197
        $I->see('サンプル宅配', $DeliveryManagePage->一覧_名称(1));
198
        $I->see('サンプル業者', $DeliveryManagePage->一覧_名称(2));
199
    }
200
201
    public function basicinfo_税率設定(\AcceptanceTester $I)
202
    {
203
        $I->wantTo('EA0708-UC01-T01 税率設定');
204
205
        // 表示
206
        $TaxManagePage = TaxManagePage::go($I);
207
208
        // 一覧
209
        $I->see('共通税率設定', '#page_admin_setting_shop_tax > div.c-container > div.c-contentsArea > div.c-contentsArea__cols > div > div > div > div.card-header');
210
        $I->see('8%', '#tax_rule_list__item--1 > td.align-middle.text-right');
211
212
        // 登録
213
        $TaxManagePage
214
            ->入力_消費税率(1, '10')
215
            ->入力_適用日(date('Y-m-d'))
216
            ->入力_適用時(date('H:i'))
217
            ->共通税率設定_登録();
218
        $I->see('10%', $TaxManagePage->一覧_税率(2));
219
220
        // edit
221
        $TaxManagePage
222
            ->一覧_編集(2)
223
            ->入力_消費税率(2, 12)
224
            ->決定(2);
225
226
        $I->see('税率設定情報を保存しました。', TaxManagePage::$登録完了メッセージ);
227
        $I->see('12%', $TaxManagePage->一覧_税率(2));
228
229
        // 削除
230
        $TaxManagePage->一覧_削除(2);
231
        $I->see('税率設定情報を削除しました。', TaxManagePage::$登録完了メッセージ);
232
    }
233
234
    public function basicinfo_メール設定(\AcceptanceTester $I)
235
    {
236
        $I->wantTo('EA0709-UC02-T01  メール設定'); // EA0709-UC01-T01 はメールテンプレート登録機能がないのでテスト不可
237
238
        // 表示
239
        MailSettingsPage::go($I)
240
            ->入力_テンプレート('注文受付メール')
241
            ->入力_件名('ご注文有難うございました')
242
            ->登録();
243
244
        $I->see('メールテンプレート情報を保存しました。', MailSettingsPage::$登録完了メッセージ);
245
    }
246
247
    public function basicinfo_CSV出力項目(\AcceptanceTester $I)
248
    {
249
        $I->wantTo('EA0710-UC01-T01  CSV出力項目設定');
250
251
        // 表示
252
        CsvSettingsPage::go($I)
253
            ->入力_CSVタイプ('受注CSV')
254
            ->選択_出力項目('誕生日')
255
            ->削除()
256
            ->設定();
257
258
        $I->see('CSV出力を設定しました。', CsvSettingsPage::$登録完了メッセージ);
259
    }
260
}
261