Completed
Push — checkout-consistent-prices ( af49ca )
by Kamil
13:24
created

ShippingElement::getProductWeight()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
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