Completed
Push — master ( a5022e...49928c )
by Fabian
14s queued 10s
created

ProductFixture::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 1
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
rs 10
1
<?php
2
declare(strict_types=1);
3
4
namespace TddWizard\Fixtures\Catalog;
5
6
use Magento\Catalog\Api\Data\ProductInterface;
7
8
class ProductFixture
9
{
10
    /**
11
     * @var ProductInterface
12
     */
13
    private $product;
14
15 16
    public function __construct(ProductInterface $product)
16
    {
17 16
        $this->product = $product;
18 16
    }
19
20 6
    public function getId(): int
21
    {
22 6
        return (int) $this->product->getId();
23
    }
24
25 15
    public function getSku(): string
26
    {
27 15
        return $this->product->getSku();
28
    }
29
30
    public function rollback(): void
31
    {
32
        ProductFixtureRollback::create()->execute($this);
33
    }
34
}
35