@@ 8-46 (lines=39) @@ | ||
5 | use Magium\Magento\AbstractMagentoTestCase; |
|
6 | use Magium\WebDriver\WebDriver; |
|
7 | ||
8 | class CashOnDelivery implements PaymentMethodInterface |
|
9 | { |
|
10 | ||
11 | const ACTION = 'Checkout\PaymentMethods\CashOnDelivery'; |
|
12 | ||
13 | protected $webDriver; |
|
14 | protected $testCase; |
|
15 | ||
16 | public function __construct( |
|
17 | WebDriver $webDriver, |
|
18 | AbstractMagentoTestCase $testCase |
|
19 | ) { |
|
20 | $this->webDriver = $webDriver; |
|
21 | $this->testCase = $testCase; |
|
22 | } |
|
23 | ||
24 | public function getId() |
|
25 | { |
|
26 | return 'p_method_cashondelivery'; |
|
27 | } |
|
28 | ||
29 | /** |
|
30 | * Fills in the payment form, selecting it, if necessary |
|
31 | * |
|
32 | * @param $requirePayment |
|
33 | */ |
|
34 | ||
35 | public function pay($requirePayment) |
|
36 | { |
|
37 | if ($requirePayment) { |
|
38 | $this->testCase->assertElementExists($this->getId()); |
|
39 | } |
|
40 | ||
41 | if ($this->webDriver->elementDisplayed($this->getId())) { |
|
42 | $element = $this->webDriver->byId($this->getId()); |
|
43 | $this->webDriver->getMouse()->click($element->getCoordinates()); |
|
44 | } |
|
45 | } |
|
46 | } |
@@ 8-46 (lines=39) @@ | ||
5 | use Magium\Magento\AbstractMagentoTestCase; |
|
6 | use Magium\WebDriver\WebDriver; |
|
7 | ||
8 | class CheckMoneyOrder implements PaymentMethodInterface |
|
9 | { |
|
10 | ||
11 | const ACTION = 'Checkout\PaymentMethods\CheckMoneyOrder'; |
|
12 | ||
13 | protected $webDriver; |
|
14 | protected $testCase; |
|
15 | ||
16 | public function __construct( |
|
17 | WebDriver $webDriver, |
|
18 | AbstractMagentoTestCase $testCase |
|
19 | ) { |
|
20 | $this->webDriver = $webDriver; |
|
21 | $this->testCase = $testCase; |
|
22 | } |
|
23 | ||
24 | public function getId() |
|
25 | { |
|
26 | return 'p_method_checkmo'; |
|
27 | } |
|
28 | ||
29 | /** |
|
30 | * Fills in the payment form, selecting it, if necessary |
|
31 | * |
|
32 | * @param $requirePayment |
|
33 | */ |
|
34 | ||
35 | public function pay($requirePayment) |
|
36 | { |
|
37 | if ($requirePayment) { |
|
38 | $this->testCase->assertElementExists($this->getId()); |
|
39 | } |
|
40 | ||
41 | if ($this->webDriver->elementDisplayed($this->getId())) { |
|
42 | $element = $this->webDriver->byId($this->getId()); |
|
43 | $this->webDriver->getMouse()->click($element->getCoordinates()); |
|
44 | } |
|
45 | } |
|
46 | } |
|
47 |