Failed Conditions
Push — modify-scrutinizeryml ( 361e25...08b4c1 )
by Kentaro
63:54 queued 57:30
created

EA05CustomerCest::customer_検索エラー()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 9

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 1
dl 0
loc 9
rs 9.9666
c 0
b 0
f 0
1
<?php
2
3
use Codeception\Util\Fixtures;
4
use Page\Admin\CsvSettingsPage;
5
use Page\Admin\CustomerEditPage;
6
use Page\Admin\CustomerManagePage;
7
8
/**
9
 * @group admin
10
 * @group admin02
11
 * @group customer
12
 * @group ea5
13
 */
14
class EA05CustomerCest
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...
15
{
16
    public function _before(\AcceptanceTester $I)
17
    {
18
        // すべてのテストケース実施前にログインしておく
19
        // ログイン後は管理アプリのトップページに遷移している
20
        $I->loginAsAdmin();
21
    }
22
23
    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...
24
    {
25
    }
26
27 View Code Duplication
    public function customer_検索(\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...
28
    {
29
        $I->wantTo('EA0501-UC01-T01 検索');
30
31
32
        $CustomerListPage = CustomerManagePage::go($I);
33
34
        $createCustomer = Fixtures::get('createCustomer');
35
        $customer = $createCustomer();
36
37
        $CustomerListPage->検索($customer->getEmail());
38
        $I->see('検索結果:1件が該当しました', CustomerManagePage::$検索結果メッセージ);
39
    }
40
41
    public function customer_検索結果なし(\AcceptanceTester $I)
42
    {
43
        $I->wantTo('EA0501-UC01-T02 検索 結果なし');
44
        $faker = Fixtures::get('faker');
45
        $email = microtime(true).'.'.$faker->safeEmail;
46
47
        CustomerManagePage::go($I)
48
            ->検索($email);
49
50
        $I->see('検索条件に合致するデータが見つかりませんでした', CustomerManagePage::$検索結果_結果なしメッセージ);
51
    }
52
53
    public function customer_検索エラー(\AcceptanceTester $I)
54
    {
55
        $I->wantTo('EA0501-UC01-T03 検索 エラー');
56
57
        CustomerManagePage::go($I)
58
            ->詳細検索_電話番号('あああ');
59
60
        $I->see('検索条件に誤りがあります。', CustomerManagePage::$検索結果_エラーメッセージ);
61
    }
62
63
    public function customer_会員登録(\AcceptanceTester $I)
64
    {
65
        $I->wantTo('EA0502-UC01-T02(& UC01-T02) 会員登録');
66
        $faker = Fixtures::get('faker');
67
        $email = microtime(true).'.'.$faker->safeEmail;
68
69
        $CustomerRegisterPage = CustomerEditPage::go($I)
70
            ->入力_姓('testuser')
71
            ->入力_名('testuser')
72
            ->入力_セイ('テストユーザー')
73
            ->入力_メイ('テストユーザー')
74
            ->入力_都道府県(['27' => '大阪府'])
75
            ->入力_郵便番号('530-0001')
76
            ->入力_市区町村名('大阪市北区梅田2-4-9')
77
            ->入力_番地_ビル名('ブリーゼタワー13F')
78
            ->入力_Eメール($email)
79
            ->入力_電話番号('111-111-111')
80
            ->入力_パスワード('password')
81
            ->入力_パスワード確認('password');
82
83
        $findPluginByCode = Fixtures::get('findPluginByCode');
84
        $Plugin = $findPluginByCode('MailMagazine');
85
        if ($Plugin) {
86
            $I->amGoingTo('メルマガプラグインを発見したため、メルマガを購読します');
87
            $I->click('#admin_customer_mailmaga_flg_0');
88
        }
89
90
        $CustomerRegisterPage->登録();
91
        /* ブラウザによるhtml5のエラーなのでハンドリング不可 */
92
        $I->see('会員情報を保存しました。', CustomerEditPage::$登録完了メッセージ);
93
    }
94
95
    public function customer_会員登録_必須項目未入力(\AcceptanceTester $I)
96
    {
97
        $I->wantTo('EA0502-UC01-T02 会員登録_必須項目未入力');
98
99
        CustomerEditPage::go($I)->登録();
100
101
        $I->seeElement(['css' => '#admin_customer_name_name01:invalid']); // 姓がエラー
102
        $I->dontSeeElement(CustomerEditPage::$登録完了メッセージ);
103
    }
104
105
    public function customer_会員編集(\AcceptanceTester $I)
106
    {
107
        $I->wantTo('EA0502-UC02-T01 会員編集');
108
109
        $createCustomer = Fixtures::get('createCustomer');
110
        $customer = $createCustomer();
111
112
        $CustomerListPage = CustomerManagePage::go($I)
113
            ->検索($customer->getEmail());
114
115
        $I->see('検索結果:1件が該当しました', CustomerManagePage::$検索結果メッセージ);
116
117
        $CustomerListPage->一覧_編集(1);
118
119
        $CustomerRegisterPage = CustomerEditPage::at($I)
120
            ->入力_姓('testuser-1');
121
122
        $findPluginByCode = Fixtures::get('findPluginByCode');
123
        $Plugin = $findPluginByCode('MailMagazine');
124
        if ($Plugin) {
125
            $I->amGoingTo('メルマガプラグインを発見したため、メルマガを購読します');
126
            $I->click('#admin_customer_mailmaga_flg_0');
127
        }
128
129
        $CustomerRegisterPage->登録();
130
        $I->see('会員情報を保存しました。', CustomerEditPage::$登録完了メッセージ);
131
132
        $CustomerRegisterPage
133
            ->入力_姓('')
134
            ->登録();
135
    }
136
137
    public function customer_会員編集_必須項目未入力(\AcceptanceTester $I)
138
    {
139
        $I->wantTo('EA0502-UC02-T02 会員編集_必須項目未入力');
140
141
        $createCustomer = Fixtures::get('createCustomer');
142
        $customer = $createCustomer();
143
144
        $CustomerListPage = CustomerManagePage::go($I)
145
            ->検索($customer->getEmail());
146
147
        $I->see('検索結果:1件が該当しました', CustomerManagePage::$検索結果メッセージ);
148
149
        $CustomerListPage->一覧_編集(1);
150
151
        CustomerEditPage::at($I)
152
            ->入力_姓('')
153
            ->登録();
154
155
        $I->seeElement(['css' => '#admin_customer_name_name01:invalid']);
156
        $I->dontSeeElement(CustomerEditPage::$登録完了メッセージ);
157
    }
158
159 View Code Duplication
    public function customer_会員削除(\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...
160
    {
161
        $I->wantTo('EA0501-UC03-T01 会員削除');
162
163
        $createCustomer = Fixtures::get('createCustomer');
164
        $customer = $createCustomer();
165
166
        $CustomerManagePage = CustomerManagePage::go($I)
167
            ->検索($customer->getEmail());
168
169
        $CustomerManagePage->一覧_削除(1);
170
171
        $I->see('検索条件に合致するデータが見つかりませんでした', CustomerManagePage::$検索結果_結果なしメッセージ);
172
    }
173
174
    public function customer_会員削除キャンセル(\AcceptanceTester $I)
175
    {
176
        $I->wantTo('EA0501-UC03-T02 会員削除キャンセル');
177
178
        $createCustomer = Fixtures::get('createCustomer');
179
        $customer = $createCustomer();
180
181
        $CustomerManagePage = CustomerManagePage::go($I)
182
            ->検索($customer->getEmail());
183
184
        $CustomerIdForNotDel = $CustomerManagePage->一覧_会員ID(1);
185
        $CustomerManagePage->一覧_削除(1, false);
186
187
        $I->assertEquals($CustomerIdForNotDel, $CustomerManagePage->一覧_会員ID(1));
188
    }
189
190
    /**
191
     * @env firefox
192
     * @env chrome
193
     */
194
    public function customer_CSV出力(\AcceptanceTester $I)
195
    {
196
        $I->wantTo('EA0501-UC05-T01 CSV出力');
197
198
        $findCustomers = Fixtures::get('findCustomers');
199
        CustomerManagePage::go($I)
200
            ->検索()
201
            ->CSVダウンロード();
202
203
        $CustomerCSV = $I->getLastDownloadFile('/^customer_\d{14}\.csv$/');
204
        $I->assertEquals(count($findCustomers()) + 1, count(file($CustomerCSV)));
205
    }
206
207 View Code Duplication
    public function customer_CSV出力項目設定(\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...
208
    {
209
        $I->wantTo('EA0501-UC04-T01 CSV出力項目設定');
210
211
212
        CustomerManagePage::go($I)
213
            ->検索()
214
            ->CSV出力項目設定();
215
216
        CsvSettingsPage::at($I);
217
        $value = $I->grabValueFrom(CsvSettingsPage::$CSVタイプ);
218
        $I->assertEquals('2', $value);
219
    }
220
221
    public function customer_仮会員メール再送(\AcceptanceTester $I)
222
    {
223
        $I->wantTo('EA0501-UC06-T01(& UC06-T02) 仮会員メール再送');
224
225
        $I->resetEmails();
226
227
        $createCustomer = Fixtures::get('createCustomer');
228
        $customer = $createCustomer(null, false);
229
        $BaseInfo = Fixtures::get('baseinfo');
230
231
        CustomerManagePage::go($I)
232
            ->検索($customer->getEmail())
233
            ->一覧_仮会員メール再送(1);
234
        $I->wait(5);
235
236
        $I->seeEmailCount(2);
237
        foreach (array($customer->getEmail(), $BaseInfo->getEmail01()) as $email) {
238
            $I->seeInLastEmailSubjectTo($email, '会員登録のご確認');
239
            $I->seeInLastEmailTo($email, $customer->getName01().' '.$customer->getName02().' 様');
240
        }
241
    }
242
}
243