Conditions | 4 |
Paths | 8 |
Total Lines | 72 |
Lines | 10 |
Ratio | 13.89 % |
Changes | 0 |
Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.
For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.
Commonly applied refactorings include:
If many parameters/temporary variables are present:
1 | <?php |
||
12 | public function customer_会員登録正常(\AcceptanceTester $I) |
||
13 | { |
||
14 | $I->wantTo('EF0401-UC01-T01 会員登録 正常パターン'); |
||
15 | $I->amOnPage('/entry'); |
||
16 | $faker = Fixtures::get('faker'); |
||
17 | $BaseInfo = Fixtures::get('baseinfo'); |
||
18 | $new_email = microtime(true).'.'.$faker->safeEmail; |
||
19 | // 会員情報入力フォームに、会員情報を入力する |
||
20 | // 「同意する」ボタンを押下する |
||
21 | $form = [ |
||
22 | 'entry[name][name01]' => '姓', |
||
23 | 'entry[name][name02]' => '名', |
||
24 | 'entry[kana][kana01]' => 'セイ', |
||
25 | 'entry[kana][kana02]' => 'メイ', |
||
26 | 'entry[postal_code]' => '530-0001', |
||
27 | 'entry[address][pref]' => ['value' => '27'], |
||
28 | 'entry[address][addr01]' => '大阪市北区', |
||
29 | 'entry[address][addr02]' => '梅田2-4-9 ブリーゼタワー13F', |
||
30 | 'entry[phone_number]' => '111-111-111', |
||
31 | 'entry[email][first]' => $new_email, |
||
32 | 'entry[email][second]' => $new_email, |
||
33 | 'entry[password][first]' => 'password', |
||
34 | 'entry[password][second]' => 'password', |
||
35 | 'entry[job]' => ['value' => '1'], |
||
36 | ]; |
||
37 | $findPluginByCode = Fixtures::get('findPluginByCode'); |
||
38 | $Plugin = $findPluginByCode('MailMagazine'); |
||
39 | if ($Plugin) { |
||
40 | $I->amGoingTo('メルマガプラグインを発見したため、メルマガを購読します'); |
||
41 | $form['entry[mailmaga_flg]'] = '1'; |
||
42 | } |
||
43 | $I->submitForm(['css' => '.ec-layoutRole__main form'], $form, ['css' => 'button.ec-blockBtn--action']); |
||
44 | |||
45 | // 入力した会員情報を確認する。 |
||
46 | $I->see('姓 名', '.ec-registerRole form .ec-borderedDefs dl:nth-child(1) dd'); |
||
47 | $I->see('111111111', '.ec-registerRole form .ec-borderedDefs dl:nth-child(5) dd'); |
||
48 | $I->see($new_email, '.ec-registerRole form .ec-borderedDefs dl:nth-child(6) dd'); |
||
49 | |||
50 | $I->resetEmails(); |
||
51 | // 「会員登録をする」ボタンを押下する |
||
52 | $I->click('.ec-registerRole form button.ec-blockBtn--action'); |
||
53 | |||
54 | $I->seeEmailCount(2); |
||
55 | View Code Duplication | foreach (array($new_email, $BaseInfo->getEmail01()) as $email) { |
|
56 | $I->seeInLastEmailSubjectTo($email, '会員登録のご確認'); |
||
57 | $I->seeInLastEmailTo($email, '姓 名 様'); |
||
58 | $I->seeInLastEmailTo($email, 'この度は会員登録依頼をいただきまして、有り難うございます。'); |
||
59 | } |
||
60 | |||
61 | // 「トップページへ」ボタンを押下する |
||
62 | $I->click('a.ec-blockBtn--cancel'); |
||
63 | $I->see('新着情報', '.ec-news__title'); |
||
64 | |||
65 | |||
66 | // アクティベートURL取得 |
||
67 | $activateUrl = $I->grabFromLastEmailTo($new_email, '@/entry/activate/(.*)@'); |
||
68 | $I->resetEmails(); |
||
69 | |||
70 | // アクティベートURLからトップページへ |
||
71 | $I->amOnPage($activateUrl); |
||
72 | $I->see('新規会員登録(完了)', 'div.ec-pageHeader h1'); |
||
73 | |||
74 | $I->seeEmailCount(2); |
||
75 | View Code Duplication | foreach (array($new_email, $BaseInfo->getEmail01()) as $email) { |
|
76 | $I->seeInLastEmailSubjectTo($email, '会員登録が完了しました。'); |
||
77 | $I->seeInLastEmailTo($email, '姓 名 様'); |
||
78 | $I->seeInLastEmailTo($email, '本会員登録が完了いたしました。'); |
||
79 | } |
||
80 | |||
81 | $I->click('div.ec-registerCompleteRole a.ec-blockBtn--cancel'); |
||
82 | $I->see('新着情報', '.ec-news__title'); |
||
83 | } |
||
84 | |||
206 |
You can fix this by adding a namespace to your class:
When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.