These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | |||
3 | use Codeception\Util\Fixtures; |
||
4 | use Page\Front\CustomerAddressEditPage; |
||
5 | use Page\Front\CustomerAddressListPage; |
||
6 | use Page\Front\HistoryPage; |
||
7 | use Page\Front\MyPage; |
||
8 | use Page\Front\ProductDetailPage; |
||
9 | |||
10 | /** |
||
11 | * @group front |
||
12 | * @group mypage |
||
13 | * @group ef5 |
||
14 | */ |
||
15 | class EF05MypageCest |
||
16 | { |
||
17 | public function _before(\AcceptanceTester $I) |
||
18 | { |
||
19 | } |
||
20 | |||
21 | public function _after(\AcceptanceTester $I) |
||
22 | { |
||
23 | } |
||
24 | |||
25 | View Code Duplication | public function mypage_初期表示(\AcceptanceTester $I) |
|
26 | { |
||
27 | $I->wantTo('EF0501-UC01-T01 Mypage 初期表示'); |
||
28 | $createCustomer = Fixtures::get('createCustomer'); |
||
29 | $customer = $createCustomer(); |
||
30 | $I->loginAsMember($customer->getEmail(), 'password'); |
||
31 | |||
32 | MyPage::go($I); |
||
33 | MyPage::at($I); |
||
34 | } |
||
35 | |||
36 | public function mypage_ご注文履歴_(\AcceptanceTester $I) |
||
37 | { |
||
38 | $I->wantTo('EF0502-UC01-T01 Mypage ご注文履歴'); |
||
39 | $createCustomer = Fixtures::get('createCustomer'); |
||
40 | $customer = $createCustomer(); |
||
41 | $createOrders = Fixtures::get('createOrders'); |
||
42 | $Orders = $createOrders($customer, 5, [], \Eccube\Entity\Master\OrderStatus::NEW); |
||
0 ignored issues
–
show
|
|||
43 | |||
44 | $I->loginAsMember($customer->getEmail(), 'password'); |
||
45 | |||
46 | // TOPページ>マイページ>ご注文履歴 |
||
47 | MyPage::go($I)->注文履歴(); |
||
48 | |||
49 | // 注文内容の状況/簡易情報が表示される、各注文履歴に「詳細を見る」ボタンが表示される |
||
50 | $I->see('ご注文履歴', 'div.ec-pageHeader h1'); |
||
51 | $I->see('ご注文番号', 'div.ec-historyRole dl.ec-definitions'); |
||
52 | $I->see('詳細を見る', 'div.ec-historyRole p.ec-historyListHeader__action a'); |
||
53 | } |
||
54 | |||
55 | public function mypage_ご注文履歴詳細(\AcceptanceTester $I) |
||
56 | { |
||
57 | $I->wantTo('EF0503-UC01-T01 Mypage ご注文履歴詳細'); |
||
58 | $createCustomer = Fixtures::get('createCustomer'); |
||
59 | $customer = $createCustomer(); |
||
60 | $createOrders = Fixtures::get('createOrders'); |
||
61 | $createOrders($customer, 5, [], \Eccube\Entity\Master\OrderStatus::NEW); |
||
62 | |||
63 | $I->loginAsMember($customer->getEmail(), 'password'); |
||
64 | |||
65 | MyPage::go($I)->注文履歴詳細(1); |
||
66 | |||
67 | HistoryPage::at($I); |
||
68 | |||
69 | $I->see('ご注文状況', 'div.ec-orderOrder div.ec-definitions:nth-child(3) dt'); |
||
70 | // $I->see('注文受付', '#main_middle .order_detail'); TODO 受注ステータスが可変するためテストが通らない場合がある |
||
71 | $I->see('配送情報', 'div.ec-orderRole div.ec-orderDelivery div.ec-rectHeading h2'); |
||
72 | $I->see('お届け先', 'div.ec-orderRole div.ec-orderDelivery div.ec-orderDelivery__title'); |
||
73 | $I->see('お支払方法', 'div.ec-orderRole div.ec-orderPayment div.ec-rectHeading h2'); |
||
74 | $I->see('お問い合わせ', 'div.ec-orderRole div.ec-orderConfirm div.ec-rectHeading h2'); |
||
75 | $I->see('メール配信履歴一覧', 'div.ec-orderRole div.ec-orderMails div.ec-rectHeading h2'); |
||
76 | $I->see('小計', 'div.ec-orderRole__summary div.ec-totalBox dl:nth-child(1)'); |
||
77 | $I->see('手数料', 'div.ec-orderRole__summary div.ec-totalBox dl:nth-child(2)'); |
||
78 | $I->see('送料', 'div.ec-orderRole__summary div.ec-totalBox dl:nth-child(3)'); |
||
79 | $I->see('合計', 'div.ec-orderRole__summary div.ec-totalBox .ec-totalBox__total'); |
||
80 | } |
||
81 | |||
82 | public function mypage_お気に入り一覧(\AcceptanceTester $I) |
||
83 | { |
||
84 | $I->wantTo('EF0508-UC01-T01 Mypage お気に入り一覧'); |
||
85 | $createCustomer = Fixtures::get('createCustomer'); |
||
86 | $customer = $createCustomer(); |
||
87 | $I->loginAsMember($customer->getEmail(), 'password'); |
||
88 | |||
89 | // TOPページ>マイページ>ご注文履歴 |
||
90 | MyPage::go($I)->お気に入り一覧(); |
||
91 | |||
92 | // 最初はなにも登録されていない |
||
93 | $I->see('お気に入り一覧', 'div.ec-pageHeader h1'); |
||
94 | $I->see('お気に入りが登録されていません。', 'div.ec-favoriteRole'); |
||
95 | |||
96 | // お気に入り登録 |
||
97 | ProductDetailPage::go($I, 2)->お気に入りに追加(); |
||
98 | |||
99 | MyPage::go($I)->お気に入り一覧(); |
||
100 | $I->see('パーコレーター', 'ul.ec-favoriteRole__itemList li:nth-child(1) p.ec-favoriteRole__itemTitle'); |
||
101 | |||
102 | // お気に入りを削除 |
||
103 | $I->click('ul.ec-favoriteRole__itemList li:nth-child(1) a.ec-closeBtn--circle'); |
||
104 | $I->acceptPopup(); |
||
105 | } |
||
106 | |||
107 | public function mypage_会員情報編集(\AcceptanceTester $I) |
||
108 | { |
||
109 | $I->wantTo('EF0504-UC01-T01 Mypage 会員情報編集'); |
||
110 | $createCustomer = Fixtures::get('createCustomer'); |
||
111 | $customer = $createCustomer(); |
||
112 | $I->loginAsMember($customer->getEmail(), 'password'); |
||
113 | $faker = Fixtures::get('faker'); |
||
114 | $new_email = microtime(true).'.'.$faker->safeEmail; |
||
115 | |||
116 | // TOPページ>マイページ>会員情報編集 |
||
117 | MyPage::go($I)->会員情報編集(); |
||
118 | |||
119 | // 会員情報フォームに既存の登録情報が表示される |
||
120 | $I->seeInField(['id' => 'entry_name_name01'], $customer->getName01()); |
||
121 | |||
122 | $form = [ |
||
123 | 'entry[name][name01]' => '姓05', |
||
124 | 'entry[name][name02]' => '名05', |
||
125 | 'entry[kana][kana01]' => 'セイ', |
||
126 | 'entry[kana][kana02]' => 'メイ', |
||
127 | 'entry[postal_code]' => '530-0001', |
||
128 | 'entry[address][pref]' => ['value' => '27'], |
||
129 | 'entry[address][addr01]' => '大阪市北区', |
||
130 | 'entry[address][addr02]' => '梅田2-4-9 ブリーゼタワー13F', |
||
131 | 'entry[phone_number]' => '111-111-111', |
||
132 | 'entry[email][first]' => $new_email, |
||
133 | 'entry[email][second]' => $new_email, |
||
134 | 'entry[password][first]' => 'password', |
||
135 | 'entry[password][second]' => 'password', |
||
136 | ]; |
||
137 | |||
138 | $findPluginByCode = Fixtures::get('findPluginByCode'); |
||
139 | $Plugin = $findPluginByCode('MailMagazine'); |
||
140 | if ($Plugin) { |
||
141 | $I->amGoingTo('メルマガプラグインを発見したため、メルマガを購読します'); |
||
142 | // 必須入力が効いてない https://github.com/EC-CUBE/mail-magazine-plugin/issues/29 |
||
143 | $form['entry[mailmaga_flg]'] = '1'; |
||
144 | } |
||
145 | // 会員情報フォームに会員情報を入力する |
||
146 | $I->submitForm("div.ec-editRole form", $form); |
||
147 | |||
148 | // 会員情報編集(完了)画面が表示される |
||
149 | $I->see('会員情報編集(完了)', 'div.ec-pageHeader h1'); |
||
150 | |||
151 | // 「トップページへ」ボタンを押下する |
||
152 | $I->click('div.ec-registerCompleteRole a.ec-blockBtn--cancel'); |
||
153 | |||
154 | // TOPページヘ遷移する |
||
155 | $I->see('新着情報', '.ec-news__title'); |
||
156 | } |
||
157 | |||
158 | View Code Duplication | public function mypage_お届け先編集表示(\AcceptanceTester $I) |
|
159 | { |
||
160 | $I->wantTo('EF0506-UC01-T01 Mypage お届け先編集表示'); |
||
161 | $createCustomer = Fixtures::get('createCustomer'); |
||
162 | $customer = $createCustomer(); |
||
163 | $I->loginAsMember($customer->getEmail(), 'password'); |
||
164 | |||
165 | // TOPページ>マイページ>お届け先一覧 |
||
166 | MyPage::go($I)->お届け先編集(); |
||
167 | |||
168 | $I->see('お届け先一覧', 'div.ec-pageHeader h1'); |
||
169 | } |
||
170 | |||
171 | public function mypage_お届け先編集作成変更(\AcceptanceTester $I) |
||
172 | { |
||
173 | $I->wantTo('EF0506-UC01-T02 Mypage お届け先編集作成変更'); |
||
174 | $createCustomer = Fixtures::get('createCustomer'); |
||
175 | $customer = $createCustomer(); |
||
176 | $I->loginAsMember($customer->getEmail(), 'password'); |
||
177 | |||
178 | // お届先作成 |
||
179 | // TOPページ>マイページ>お届け先編集 |
||
180 | MyPage::go($I) |
||
181 | ->お届け先編集() |
||
182 | ->追加(); |
||
183 | |||
184 | // 入力 & submit |
||
185 | CustomerAddressEditPage::at($I) |
||
186 | ->入力_姓('姓05') |
||
187 | ->入力_名('名05') |
||
188 | ->入力_セイ('セイ') |
||
189 | ->入力_メイ('メイ') |
||
190 | ->入力_郵便番号('530-0001') |
||
191 | ->入力_都道府県(['value' => '27']) |
||
192 | ->入力_市区町村名('大阪市北区') |
||
193 | ->入力_番地_ビル名('梅田2-4-9 ブリーゼタワー13F') |
||
194 | ->入力_電話番号('111-111-111') |
||
195 | ->登録する(); |
||
196 | |||
197 | // お届け先編集ページ |
||
198 | CustomerAddressListPage::at($I); |
||
199 | |||
200 | // 一覧に追加されている |
||
201 | $I->see('大阪市北区', 'div.ec-addressList div:nth-child(1) div.ec-addressList__address'); |
||
202 | |||
203 | // お届先編集 |
||
204 | // TOPページ>マイページ>お届け先編集 |
||
205 | MyPage::go($I) |
||
206 | ->お届け先編集() |
||
207 | ->変更(1); |
||
208 | |||
209 | CustomerAddressEditPage::at($I) |
||
210 | ->入力_姓('姓05') |
||
211 | ->入力_名('名05') |
||
212 | ->入力_セイ('セイ') |
||
213 | ->入力_メイ('メイ') |
||
214 | ->入力_郵便番号('530-0001') |
||
215 | ->入力_都道府県(['value' => '27']) |
||
216 | ->入力_市区町村名('大阪市南区') |
||
217 | ->入力_番地_ビル名('梅田2-4-9 ブリーゼタワー13F') |
||
218 | ->入力_電話番号('111-111-111') |
||
219 | ->登録する(); |
||
220 | |||
221 | // お届け先編集ページ |
||
222 | CustomerAddressListPage::at($I); |
||
223 | |||
224 | // 一覧に反映されている |
||
225 | $I->see('大阪市南区', 'div.ec-addressList div:nth-child(1) div.ec-addressList__address'); |
||
226 | } |
||
227 | |||
228 | public function mypage_お届け先編集削除(\AcceptanceTester $I) |
||
229 | { |
||
230 | $I->wantTo('EF0503-UC01-T01 Mypage お届け先編集削除'); |
||
231 | $createCustomer = Fixtures::get('createCustomer'); |
||
232 | $customer = $createCustomer(); |
||
233 | $I->loginAsMember($customer->getEmail(), 'password'); |
||
234 | |||
235 | // TOPページ>マイページ>お届け先編集 |
||
236 | MyPage::go($I)->お届け先編集()->追加(); |
||
237 | |||
238 | CustomerAddressEditPage::at($I) |
||
239 | ->入力_姓('姓0501') |
||
240 | ->入力_名('名0501') |
||
241 | ->入力_セイ('セイ') |
||
242 | ->入力_メイ('メイ') |
||
243 | ->入力_郵便番号('530-0001') |
||
244 | ->入力_都道府県(['value' => '27']) |
||
245 | ->入力_市区町村名('大阪市西区') |
||
246 | ->入力_番地_ビル名('梅田2-4-9 ブリーゼタワー13F') |
||
247 | ->入力_電話番号('111-111-111') |
||
248 | ->登録する(); |
||
249 | |||
250 | $I->see('大阪市西区', 'div.ec-addressList div:nth-child(1) div.ec-addressList__address'); |
||
251 | |||
252 | CustomerAddressListPage::at($I) |
||
253 | ->削除(1); |
||
254 | |||
255 | // 確認 |
||
256 | $I->see('0 件', 'div.ec-layoutRole div.ec-layoutRole__contents p.ec-para-nomal strong'); |
||
257 | } |
||
258 | |||
259 | View Code Duplication | public function mypage_退会手続き未実施(\AcceptanceTester $I) |
|
260 | { |
||
261 | $I->wantTo('EF0507-UC03-T01 Mypage 退会手続き 未実施'); |
||
262 | $createCustomer = Fixtures::get('createCustomer'); |
||
263 | $customer = $createCustomer(); |
||
264 | $I->loginAsMember($customer->getEmail(), 'password'); |
||
265 | |||
266 | // TOPページ>マイページ>退会手続き |
||
267 | MyPage::go($I) |
||
268 | ->退会手続き(); |
||
269 | |||
270 | // 会員退会手続きへ |
||
271 | $I->click('div.ec-withdrawRole form button'); |
||
272 | |||
273 | // 未実施 |
||
274 | $I->click('div.ec-withdrawConfirmRole form a.ec-withdrawConfirmRole__cancel'); |
||
275 | |||
276 | MyPage::at($I); |
||
277 | } |
||
278 | |||
279 | public function mypage_退会手続き(\AcceptanceTester $I) |
||
280 | { |
||
281 | $I->wantTo('EF0507-UC03-T02 Mypage 退会手続き'); |
||
282 | $createCustomer = Fixtures::get('createCustomer'); |
||
283 | $customer = $createCustomer(); |
||
284 | $I->loginAsMember($customer->getEmail(), 'password'); |
||
285 | |||
286 | // TOPページ>マイページ>お届け先編集 |
||
287 | MyPage::go($I) |
||
288 | ->退会手続き(); |
||
289 | |||
290 | // 会員退会手続きへ |
||
291 | $I->click('div.ec-withdrawRole form button'); |
||
292 | |||
293 | // 実施 |
||
294 | $I->click('div.ec-withdrawConfirmRole form button'); |
||
295 | $I->see('退会手続き', 'div.ec-pageHeader h1'); |
||
296 | $I->see('退会が完了いたしました', 'div.ec-withdrawCompleteRole div.ec-reportHeading'); |
||
297 | $I->click('div.ec-withdrawCompleteRole a.ec-blockBtn--cancel'); |
||
298 | |||
299 | // TOPページヘ遷移する |
||
300 | $I->see('新着情報', '.ec-news__title'); |
||
301 | } |
||
302 | } |
||
303 |
This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.
Both the
$myVar
assignment in line 1 and the$higher
assignment in line 2 are dead. The first because$myVar
is never used and the second because$higher
is always overwritten for every possible time line.