|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/* |
|
4
|
|
|
* This file is part of the Sylius package. |
|
5
|
|
|
* |
|
6
|
|
|
* (c) Paweł Jędrzejewski |
|
7
|
|
|
* |
|
8
|
|
|
* For the full copyright and license information, please view the LICENSE |
|
9
|
|
|
* file that was distributed with this source code. |
|
10
|
|
|
*/ |
|
11
|
|
|
|
|
12
|
|
|
declare(strict_types=1); |
|
13
|
|
|
|
|
14
|
|
|
namespace Sylius\Behat\Element\Product\ShowPage; |
|
15
|
|
|
|
|
16
|
|
|
use FriendsOfBehat\PageObjectExtension\Element\Element; |
|
17
|
|
|
|
|
18
|
|
|
final class ShippingElement extends Element implements ShippingElementInterface |
|
19
|
|
|
{ |
|
20
|
|
|
public function getProductShippingCategory(): string |
|
21
|
|
|
{ |
|
22
|
|
|
return $this->getElement('shipping_category')->getText(); |
|
23
|
|
|
} |
|
24
|
|
|
|
|
25
|
|
|
public function getProductHeight(): float |
|
26
|
|
|
{ |
|
27
|
|
|
return (float) $this->getElement('product_height')->getText(); |
|
28
|
|
|
} |
|
29
|
|
|
|
|
30
|
|
|
public function getProductDepth(): float |
|
31
|
|
|
{ |
|
32
|
|
|
return (float) $this->getElement('product_depth')->getText(); |
|
33
|
|
|
} |
|
34
|
|
|
|
|
35
|
|
|
public function getProductWeight(): float |
|
36
|
|
|
{ |
|
37
|
|
|
return (float) $this->getElement('product_weight')->getText(); |
|
38
|
|
|
} |
|
39
|
|
|
|
|
40
|
|
|
public function getProductWidth(): float |
|
41
|
|
|
{ |
|
42
|
|
|
return (float) $this->getElement('product_width')->getText(); |
|
43
|
|
|
} |
|
44
|
|
|
|
|
45
|
|
|
protected function getDefinedElements(): array |
|
46
|
|
|
{ |
|
47
|
|
|
return array_merge(parent::getDefinedElements(), [ |
|
48
|
|
|
'product_depth' => '#shipping tr:contains("Depth") td:nth-child(2)', |
|
49
|
|
|
'product_height' => '#shipping tr:contains("Height") td:nth-child(2)', |
|
50
|
|
|
'product_weight' => '#shipping tr:contains("Weight") td:nth-child(2)', |
|
51
|
|
|
'product_width' => '#shipping tr:contains("Width") td:nth-child(2)', |
|
52
|
|
|
'shipping_category' => '#shipping tr:contains("Shipping category") td:nth-child(2)', |
|
53
|
|
|
]); |
|
54
|
|
|
} |
|
55
|
|
|
} |
|
56
|
|
|
|