|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace Magium\Magento\Extractors\Admin\Order; |
|
4
|
|
|
|
|
5
|
|
|
use Magium\Extractors\AbstractExtractor; |
|
6
|
|
|
use Magium\Magento\AbstractMagentoTestCase; |
|
7
|
|
|
use Magium\Magento\Themes\Admin\ThemeConfiguration; |
|
8
|
|
|
use Magium\WebDriver\WebDriver; |
|
9
|
|
|
|
|
10
|
|
|
class OrderSummary extends AbstractExtractor |
|
11
|
|
|
{ |
|
12
|
|
|
const EXTRACTOR = 'Admin\Order\OrderSummary'; |
|
13
|
|
|
protected $orderDate; |
|
14
|
|
|
protected $orderStatus; |
|
15
|
|
|
protected $purchasedFrom; |
|
16
|
|
|
protected $placedFromIP; |
|
17
|
|
|
|
|
18
|
|
|
public function __construct(WebDriver $webDriver, AbstractMagentoTestCase $testCase, ThemeConfiguration $theme) |
|
19
|
|
|
{ |
|
20
|
|
|
parent::__construct($webDriver, $testCase, $theme); |
|
21
|
|
|
} |
|
22
|
|
|
|
|
23
|
|
|
/** |
|
24
|
|
|
* @return mixed |
|
25
|
|
|
*/ |
|
26
|
|
|
public function getOrderDate() |
|
27
|
|
|
{ |
|
28
|
|
|
return $this->orderDate; |
|
29
|
|
|
} |
|
30
|
|
|
|
|
31
|
|
|
/** |
|
32
|
|
|
* @return mixed |
|
33
|
|
|
*/ |
|
34
|
|
|
public function getOrderStatus() |
|
35
|
|
|
{ |
|
36
|
|
|
return $this->orderStatus; |
|
37
|
|
|
} |
|
38
|
|
|
|
|
39
|
|
|
/** |
|
40
|
|
|
* @return mixed |
|
41
|
|
|
*/ |
|
42
|
|
|
public function getPurchasedFrom() |
|
43
|
|
|
{ |
|
44
|
|
|
return $this->purchasedFrom; |
|
45
|
|
|
} |
|
46
|
|
|
|
|
47
|
|
|
/** |
|
48
|
|
|
* @return mixed |
|
49
|
|
|
*/ |
|
50
|
|
|
public function getPlacedFromIP() |
|
51
|
|
|
{ |
|
52
|
|
|
return $this->placedFromIP; |
|
53
|
|
|
} |
|
54
|
|
|
|
|
55
|
|
|
public function extract() |
|
56
|
|
|
{ |
|
57
|
|
|
$baseXpath = '//h4[contains(concat(" ",normalize-space(@class)," ")," head-account ")]/../../descendant::td/label[.="%s"]/../../td/strong'; |
|
58
|
|
|
|
|
59
|
|
|
$element = $this->webDriver->byXpath(sprintf($baseXpath, $this->testCase->getTranslator()->translate('Order Date'))); |
|
60
|
|
|
$this->orderDate = trim($element->getText()); |
|
61
|
|
|
|
|
62
|
|
|
$element = $this->webDriver->byXpath(sprintf($baseXpath, $this->testCase->getTranslator()->translate('Order Status'))); |
|
63
|
|
|
$this->orderStatus = trim($element->getText()); |
|
64
|
|
|
|
|
65
|
|
|
$element = $this->webDriver->byXpath(sprintf($baseXpath, $this->testCase->getTranslator()->translate('Purchased From'))); |
|
66
|
|
|
$this->purchasedFrom = trim($element->getText()); |
|
67
|
|
|
|
|
68
|
|
|
$element = $this->webDriver->byXpath(sprintf($baseXpath, $this->testCase->getTranslator()->translate('Placed from IP'))); |
|
69
|
|
|
$this->placedFromIP = trim($element->getText()); |
|
70
|
|
|
} |
|
71
|
|
|
|
|
72
|
|
|
} |