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

ProductFixture   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Test Coverage

Coverage 77.78%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 6
c 1
b 0
f 0
dl 0
loc 25
ccs 7
cts 9
cp 0.7778
rs 10
wmc 4

4 Methods

Rating   Name   Duplication   Size   Complexity  
A getSku() 0 3 1
A __construct() 0 3 1
A getId() 0 3 1
A rollback() 0 3 1
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