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

CartPage::go()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 1
dl 0
loc 5
rs 10
c 0
b 0
f 0
1
<?php
2
/*
3
 * This file is part of EC-CUBE
4
 *
5
 * Copyright(c) 2000-2017 LOCKON CO.,LTD. All Rights Reserved.
6
 *
7
 * http://www.lockon.co.jp/
8
 *
9
 * This program is free software; you can redistribute it and/or
10
 * modify it under the terms of the GNU General Public License
11
 * as published by the Free Software Foundation; either version 2
12
 * of the License, or (at your option) any later version.
13
 *
14
 * This program is distributed in the hope that it will be useful,
15
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17
 * GNU General Public License for more details.
18
 *
19
 * You should have received a copy of the GNU General Public License
20
 * along with this program; if not, write to the Free Software
21
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
22
 */
23
24
namespace Page\Front;
25
26
27
class CartPage extends AbstractFrontPage
28
{
29
    public function __construct(\AcceptanceTester $I)
30
    {
31
        parent::__construct($I);
32
    }
33
34
    public static function go($I) {
35
        $page = new self($I);
36
        $page->goPage('/cart');
37
        return $page;
38
    }
39
40
    public function 商品名($index)
41
    {
42
        return $this->tester->grabTextFrom(["xpath" => "//div[@class='ec-cartRole']//ul[@class='ec-cartRow'][position()=${index}]//div[@class='ec-cartRow__name']"]);
43
    }
44
45
    public function 商品数量($index)
46
    {
47
        return $this->tester->grabTextFrom(["xpath" => "//div[@class='ec-cartRole']//ul[@class='ec-cartRow'][position()=${index}]//div[@class='ec-cartRow__amount']"]);
48
    }
49
50
    public function 商品数量増やす($index)
51
    {
52
        $this->tester->click(["xpath" => "//div[@class='ec-cartRole']//ul[@class='ec-cartRow'][position()=${index}]//div[@class='ec-cartRow__amountUpDown']/a[contains(@class, 'ec-cartRow__amountUpButton')]"]);
53
        return $this;
54
    }
55
56
    public function 商品数量減らす($index)
57
    {
58
        $this->tester->click(["xpath" => "//div[@class='ec-cartRole']//ul[@class='ec-cartRow'][position()=${index}]//div[@class='ec-cartRow__amountUpDown']/a[contains(@class, 'ec-cartRow__amountDownButton')]"]);
59
        return $this;
60
    }
61
62
    public function 商品削除($index)
63
    {
64
        $this->tester->click(["xpath" => "//div[@class='ec-cartRole']//ul[@class='ec-cartRow'][position()=${index}]//li[@class='ec-cartRow__delColumn']/a"]);
65
        $this->tester->acceptPopup();
66
        return $this;
67
    }
68
69
    public function エラーメッセージ()
70
    {
71
        return $this->tester->grabTextFrom(["css" => 'div.ec-cartRole__error div.ec-alert-warning__text']);
72
    }
73
74
    /**
75
     * @return ShoppingPage
76
     */
77
    public function レジに進む()
78
    {
79
        $this->tester->click(['css' => 'div.ec-cartRole__actions a.ec-blockBtn--action']);
80
        return new ShoppingPage($this->tester);
81
    }
82
83
    /**
84
     * @return TopPage
85
     */
86
    public function お買い物を続ける()
87
    {
88
        $this->tester->click(['css' => 'div.ec-cartRole__actions a.ec-blockBtn--cancel']);
89
        return new TopPage($this->tester);
90
    }
91
}