Completed
Push — apply-codeceptions ( 341052...a29855 )
by Kentaro
53:23 queued 21:51
created

EA01TopCest::top_001()   B

Complexity

Conditions 1
Paths 1

Size

Total Lines 59

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 1
dl 0
loc 59
rs 8.8945
c 0
b 0
f 0

How to fix   Long Method   

Long Method

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:

1
<?php
2
3
use Codeception\Util\Fixtures;
4
use Page\Admin\CustomerManagePage;
5
use Page\Admin\OrderManagePage;
6
use Page\Admin\TopPage;
7
8
/**
9
 * @group admin
10
 * @group admin01
11
 * @group toppage
12
 * @group ea1
13
 */
14
class EA01TopCest
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
    const ページタイトル = '.c-pageTitle h2.c-pageTitle__title';
17
18
    public function _before(\AcceptanceTester $I)
19
    {
20
        // すべてのテストケース実施前にログインしておく
21
        // ログイン後は管理アプリのトップページに遷移している
22
        $I->loginAsAdmin();
23
    }
24
25
    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...
26
    {
27
    }
28
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::$受付状況_入金待ち);
0 ignored issues
show
Unused Code Comprehensibility introduced by
70% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
56
        // $I->see('受注一覧', self::ページタイトル);
0 ignored issues
show
Unused Code Comprehensibility introduced by
70% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
57
        // $I->seeInField(OrderManagePage::$検索条件_受注ステータス, '2'/*入金待ち*/);
0 ignored issues
show
Unused Code Comprehensibility introduced by
50% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
58
        // $I->goToAdminPage();
0 ignored issues
show
Unused Code Comprehensibility introduced by
72% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
59
        //
60
        // // 入金済みをクリックすると「受注管理>入金済み」のページに遷移することを確認
61
        // $I->click(TopPage::$受付状況_入金済み);
0 ignored issues
show
Unused Code Comprehensibility introduced by
70% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
62
        // $I->see('受注一覧', self::ページタイトル);
0 ignored issues
show
Unused Code Comprehensibility introduced by
70% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
63
        // $I->seeInField(OrderManagePage::$検索条件_受注ステータス, '6'/*入金済み*/);
0 ignored issues
show
Unused Code Comprehensibility introduced by
50% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
64
        // $I->goToAdminPage();
0 ignored issues
show
Unused Code Comprehensibility introduced by
72% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
65
        //
66
        // // 取り寄せ中をクリックすると「受注管理>取り寄せ」のページに遷移することを確認
67
        // $I->click(TopPage::$受付状況_取り寄せ中);
0 ignored issues
show
Unused Code Comprehensibility introduced by
70% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
68
        // $I->see('受注一覧', self::ページタイトル);
0 ignored issues
show
Unused Code Comprehensibility introduced by
70% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
69
        // $I->seeInField(OrderManagePage::$検索条件_受注ステータス, '4'/*取り寄せ中*/);
0 ignored issues
show
Unused Code Comprehensibility introduced by
50% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
70
        // $I->goToAdminPage();
0 ignored issues
show
Unused Code Comprehensibility introduced by
72% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
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