Conditions | 1 |
Paths | 1 |
Total Lines | 59 |
Lines | 0 |
Ratio | 0 % |
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 |
||
29 | public function top_001(\AcceptanceTester $I) |
||
30 | { |
||
31 | $I->wantTo('EA0101-UC01-T01 TOPページ 初期表示'); |
||
32 | |||
33 | // TOP画面に現在の受注状況、お知らせ、売り上げ状況、ショップ状況が表示されている |
||
34 | $I->see('新規受付', TopPage::$受付状況_新規受付); |
||
35 | $I->see('お知らせ', TopPage::$お知らせ); |
||
36 | $I->see('売上状況', TopPage::$売上状況); |
||
37 | $I->see('ショップ状況', TopPage::$ショップ状況); |
||
38 | |||
39 | // 新規受付をクリックすると受注管理画面に遷移することを確認 |
||
40 | $I->click(TopPage::$受付状況_新規受付); |
||
41 | $I->see('受注一覧', self::ページタイトル); |
||
42 | $I->goToAdminPage(); |
||
43 | |||
44 | // 購入された商品が受注管理画面のページにて反映されていることを確認 |
||
45 | $config = Fixtures::get('config'); |
||
46 | $findOrders = Fixtures::get('findOrders'); |
||
47 | $NewOrders = array_filter($findOrders(), function ($Order) use ($config) { |
||
48 | return $Order->getOrderStatus()->getId() == \Eccube\Entity\Master\OrderStatus::NEW; |
||
49 | }); |
||
50 | $I->see(count($NewOrders), TopPage::$受付状況_新規受付数); |
||
51 | |||
52 | // FIXME [issue] ソート順が指定されていないのでテストが失敗する |
||
53 | // https://github.com/EC-CUBE/ec-cube/issues/1908 |
||
54 | // // 入金待ちをクリックすると「受注管理>入金待ち」のページに遷移することを確認 |
||
55 | // $I->click(TopPage::$受付状況_入金待ち); |
||
56 | // $I->see('受注一覧', self::ページタイトル); |
||
57 | // $I->seeInField(OrderManagePage::$検索条件_受注ステータス, '2'/*入金待ち*/); |
||
58 | // $I->goToAdminPage(); |
||
59 | // |
||
60 | // // 入金済みをクリックすると「受注管理>入金済み」のページに遷移することを確認 |
||
61 | // $I->click(TopPage::$受付状況_入金済み); |
||
62 | // $I->see('受注一覧', self::ページタイトル); |
||
63 | // $I->seeInField(OrderManagePage::$検索条件_受注ステータス, '6'/*入金済み*/); |
||
64 | // $I->goToAdminPage(); |
||
65 | // |
||
66 | // // 取り寄せ中をクリックすると「受注管理>取り寄せ」のページに遷移することを確認 |
||
67 | // $I->click(TopPage::$受付状況_取り寄せ中); |
||
68 | // $I->see('受注一覧', self::ページタイトル); |
||
69 | // $I->seeInField(OrderManagePage::$検索条件_受注ステータス, '4'/*取り寄せ中*/); |
||
70 | // $I->goToAdminPage(); |
||
71 | |||
72 | // お知らせの記事をクリックすると設定されたURLに遷移することを確認 |
||
73 | $I->switchToIFrame("information"); |
||
74 | $I->click(['css' => '.news_area .link_list .tableish a:nth-child(3)']); |
||
75 | $I->switchToNewWindow(); |
||
76 | $I->assertRegExp('/^https?:\/\/www.ec-cube.net\/.*$/', $I->executeJS('return location.href'), '公式サイトが開く'); |
||
77 | $I->switchToWindow(); |
||
78 | |||
79 | // ショップ情報の在庫切れ商品をクリックすると商品管理ページに遷移することを確認 |
||
80 | $I->click(TopPage::$ショップ状況_在庫切れ商品); |
||
81 | $I->see('商品一覧', self::ページタイトル); |
||
82 | $I->goToAdminPage(); |
||
83 | |||
84 | // ショップ情報の会員数をクリックすると会員管理に遷移することを確認 |
||
85 | $I->click(TopPage::$ショップ状況_会員数); |
||
86 | $I->see('会員一覧', self::ページタイトル); |
||
87 | } |
||
88 | } |
||
89 |
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.