CartsRestApiFixturesTrait::createProduct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 22
Code Lines 14

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 14
dl 0
loc 22
rs 9.7998
c 0
b 0
f 0
cc 1
nc 1
nop 1
1
<?php
2
3
/**
4
 * This file is part of the Spryker Commerce OS.
5
 * For full license information, please view the LICENSE file that was distributed with this source code.
6
 */
7
8
declare(strict_types = 1);
9
10
namespace PyzTest\Glue\Carts\RestApi\Fixtures;
11
12
use Generated\Shared\Transfer\MoneyValueTransfer;
0 ignored issues
show
Bug introduced by
The type Generated\Shared\Transfer\MoneyValueTransfer was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
13
use Generated\Shared\Transfer\PriceProductTransfer;
0 ignored issues
show
Bug introduced by
The type Generated\Shared\Transfer\PriceProductTransfer was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
14
use Generated\Shared\Transfer\ProductConcreteTransfer;
0 ignored issues
show
Bug introduced by
The type Generated\Shared\Transfer\ProductConcreteTransfer was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
15
use Generated\Shared\Transfer\StockProductTransfer;
0 ignored issues
show
Bug introduced by
The type Generated\Shared\Transfer\StockProductTransfer was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
16
use PyzTest\Glue\Carts\CartsApiTester;
17
use Spryker\Zed\Store\Business\StoreFacadeInterface;
18
19
trait CartsRestApiFixturesTrait
20
{
21
    protected function createProduct(CartsApiTester $I): ProductConcreteTransfer
22
    {
23
        $productConcreteTransfer = $I->haveFullProduct();
24
25
        $I->haveProductInStockForStore($this->getStoreFacade($I)->getCurrentStore(), [
26
            StockProductTransfer::SKU => $productConcreteTransfer->getSku(),
27
            StockProductTransfer::IS_NEVER_OUT_OF_STOCK => 1,
28
        ]);
29
30
        $priceProductOverride = [
31
            PriceProductTransfer::SKU_PRODUCT_ABSTRACT => $productConcreteTransfer->getAbstractSku(),
32
            PriceProductTransfer::SKU_PRODUCT => $productConcreteTransfer->getSku(),
33
            PriceProductTransfer::ID_PRODUCT => $productConcreteTransfer->getIdProductConcrete(),
34
            PriceProductTransfer::PRICE_TYPE_NAME => 'DEFAULT',
35
            PriceProductTransfer::MONEY_VALUE => [
36
                MoneyValueTransfer::NET_AMOUNT => 777,
37
                MoneyValueTransfer::GROSS_AMOUNT => 888,
38
            ],
39
        ];
40
        $I->havePriceProduct($priceProductOverride);
41
42
        return $productConcreteTransfer;
43
    }
44
45
    protected function getStoreFacade(CartsApiTester $I): StoreFacadeInterface
46
    {
47
        return $I->getLocator()->store()->facade();
48
    }
49
}
50