| Conditions | 4 |
| Paths | 8 |
| Total Lines | 75 |
| Lines | 10 |
| Ratio | 13.33 % |
| 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[zip][zip01]' => '530', |
||
| 27 | 'entry[zip][zip02]' => '0001', |
||
| 28 | 'entry[address][pref]' => ['value' => '27'], |
||
| 29 | 'entry[address][addr01]' => '大阪市北区', |
||
| 30 | 'entry[address][addr02]' => '梅田2-4-9 ブリーゼタワー13F', |
||
| 31 | 'entry[tel][tel01]' => '111', |
||
| 32 | 'entry[tel][tel02]' => '111', |
||
| 33 | 'entry[tel][tel03]' => '111', |
||
| 34 | 'entry[email][first]' => $new_email, |
||
| 35 | 'entry[email][second]' => $new_email, |
||
| 36 | 'entry[password][first]' => 'password', |
||
| 37 | 'entry[password][second]' => 'password', |
||
| 38 | 'entry[job]' => ['value' => '1'], |
||
| 39 | ]; |
||
| 40 | $findPluginByCode = Fixtures::get('findPluginByCode'); |
||
| 41 | $Plugin = $findPluginByCode('MailMagazine'); |
||
| 42 | if ($Plugin) { |
||
| 43 | $I->amGoingTo('メルマガプラグインを発見したため、メルマガを購読します'); |
||
| 44 | $form['entry[mailmaga_flg]'] = '1'; |
||
| 45 | } |
||
| 46 | $I->submitForm(['css' => '.ec-layoutRole__main form'], $form, ['css' => 'button.ec-blockBtn--action']); |
||
| 47 | |||
| 48 | // 入力した会員情報を確認する。 |
||
| 49 | $I->see('姓 名', '.ec-registerRole form .ec-borderedDefs dl:nth-child(1) dd'); |
||
| 50 | $I->see('111 - 111 - 111', '.ec-registerRole form .ec-borderedDefs dl:nth-child(5) dd'); |
||
| 51 | $I->see($new_email, '.ec-registerRole form .ec-borderedDefs dl:nth-child(7) dd'); |
||
| 52 | |||
| 53 | $I->resetEmails(); |
||
| 54 | // 「会員登録をする」ボタンを押下する |
||
| 55 | $I->click('.ec-registerRole form button.ec-blockBtn--action'); |
||
| 56 | |||
| 57 | $I->seeEmailCount(2); |
||
| 58 | foreach (array($new_email, $BaseInfo->getEmail01()) as $email) { |
||
| 59 | $I->seeInLastEmailSubjectTo($email, '会員登録のご確認'); |
||
| 60 | $I->seeInLastEmailTo($email, '姓 名 様'); |
||
| 61 | $I->seeInLastEmailTo($email, 'この度は会員登録依頼をいただきまして、有り難うございます。'); |
||
| 62 | } |
||
| 63 | |||
| 64 | // 「トップページへ」ボタンを押下する |
||
| 65 | $I->click('a.ec-blockBtn--cancel'); |
||
| 66 | $I->see('新着情報', '.ec-news__title'); |
||
| 67 | |||
| 68 | |||
| 69 | // アクティベートURL取得 |
||
| 70 | $activateUrl = $I->grabFromLastEmailTo($new_email, '@/entry/activate/(.*)@'); |
||
| 71 | $I->resetEmails(); |
||
| 72 | |||
| 73 | // アクティベートURLからトップページへ |
||
| 74 | $I->amOnPage($activateUrl); |
||
| 75 | $I->see('新規会員登録(完了)', 'div.ec-pageHeader h1'); |
||
| 76 | |||
| 77 | $I->seeEmailCount(2); |
||
| 78 | foreach (array($new_email, $BaseInfo->getEmail01()) as $email) { |
||
| 79 | $I->seeInLastEmailSubjectTo($email, '会員登録が完了しました。'); |
||
| 80 | $I->seeInLastEmailTo($email, '姓 名 様'); |
||
| 81 | $I->seeInLastEmailTo($email, '本会員登録が完了いたしました。'); |
||
| 82 | } |
||
| 83 | |||
| 84 | $I->click('div.ec-registerCompleteRole a.ec-blockBtn--cancel'); |
||
| 85 | $I->see('新着情報', '.ec-news__title'); |
||
| 86 | } |
||
| 87 | |||
| 218 |