1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Magium\Magento\Actions\Checkout\Steps; |
4
|
|
|
|
5
|
|
|
use Facebook\WebDriver\WebDriverExpectedCondition; |
6
|
|
|
use Magium\Magento\AbstractMagentoTestCase; |
7
|
|
|
use Magium\Magento\Actions\Checkout\ShippingMethods\ShippingMethodInterface; |
8
|
|
|
use Magium\Magento\Themes\OnePageCheckout\AbstractThemeConfiguration; |
9
|
|
|
use Magium\WebDriver\ExpectedCondition; |
10
|
|
|
use Magium\WebDriver\WebDriver; |
11
|
|
|
|
12
|
|
|
class ShippingMethod implements StepInterface |
13
|
|
|
{ |
14
|
|
|
const ACTION = 'Checkout\Steps\ShippingMethod'; |
15
|
|
|
protected $webdriver; |
16
|
|
|
protected $theme; |
17
|
|
|
protected $testCase; |
18
|
|
|
protected $shipping; |
19
|
|
|
|
20
|
|
|
protected $requireShipping = false; |
21
|
|
|
|
22
|
|
|
public function __construct( |
23
|
|
|
WebDriver $webdriver, |
24
|
|
|
AbstractThemeConfiguration $theme, |
25
|
|
|
AbstractMagentoTestCase $testCase, |
26
|
|
|
ShippingMethodInterface $shippingMethod |
27
|
|
|
) { |
28
|
|
|
$this->webdriver = $webdriver; |
29
|
|
|
$this->theme = $theme; |
30
|
|
|
$this->testCase = $testCase; |
31
|
|
|
$this->shipping = $shippingMethod; |
32
|
|
|
|
33
|
|
|
} |
34
|
|
|
|
35
|
|
|
public function requireShipping($require = true) |
36
|
|
|
{ |
37
|
|
|
$this->requireShipping = $require; |
38
|
|
|
} |
39
|
|
|
|
40
|
|
|
public function execute() |
41
|
|
|
{ |
42
|
|
|
$this->webdriver->wait()->until(ExpectedCondition::elementExists($this->theme->getShippingMethodContinueButtonXpath(), WebDriver::BY_XPATH)); |
|
|
|
|
43
|
|
|
$this->webdriver->wait()->until(ExpectedCondition::visibilityOf($this->webdriver->byXpath($this->theme->getShippingMethodContinueButtonXpath()))); |
|
|
|
|
44
|
|
|
$this->shipping->choose($this->requireShipping); |
45
|
|
|
|
46
|
|
|
return true; // continue to next step |
47
|
|
|
} |
48
|
|
|
|
49
|
|
View Code Duplication |
public function nextAction() |
|
|
|
|
50
|
|
|
{ |
51
|
|
|
|
52
|
|
|
$this->webdriver->byXpath($this->theme->getShippingMethodContinueButtonXpath())->click(); |
53
|
|
|
$this->webdriver->wait()->until( |
54
|
|
|
WebDriverExpectedCondition::not( |
|
|
|
|
55
|
|
|
WebDriverExpectedCondition::visibilityOf( |
56
|
|
|
$this->webdriver->byXpath( |
57
|
|
|
$this->theme->getShippingMethodContinueCompletedXpath() |
58
|
|
|
) |
59
|
|
|
) |
60
|
|
|
) |
61
|
|
|
); |
62
|
|
|
return true; |
63
|
|
|
} |
64
|
|
|
} |
It seems like the type of the argument is not accepted by the function/method which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example: