-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'feature/CO-2601_add_missing_factories' into 'master'
feature/CO-2601_add_missing_factories See merge request connector/core!26
- Loading branch information
Showing
13 changed files
with
360 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Jtl\Connector\Core\Model\Generator; | ||
|
||
use Jtl\Connector\Core\Model\CategoryCustomerGroup; | ||
|
||
/** | ||
* Class CategoryCustomerGroupFactory | ||
* | ||
* @package Jtl\Connector\Core\Model\Generator | ||
*/ | ||
class CategoryCustomerGroupFactory extends AbstractModelFactory | ||
{ | ||
/** | ||
* @return array<string, mixed> | ||
* @throws \Exception | ||
*/ | ||
protected function makeFakeArray(): array | ||
{ | ||
return [ | ||
'customerGroupId' => $this->getFactory('Identity')->makeOneArray(), | ||
'discount' => $this->faker->randomFloat(2, 0, 10) | ||
]; | ||
} | ||
|
||
/** | ||
* @return string | ||
*/ | ||
protected function getModelClass(): string | ||
{ | ||
return CategoryCustomerGroup::class; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Jtl\Connector\Core\Model\Generator; | ||
|
||
use Jtl\Connector\Core\Model\CategoryInvisibility; | ||
|
||
/** | ||
* Class CategoryInvisibilityFactory | ||
* | ||
* @package Jtl\Connector\Core\Model\Generator | ||
*/ | ||
class CategoryInvisibilityFactory extends AbstractModelFactory | ||
{ | ||
/** | ||
* @return array<string, mixed> | ||
*/ | ||
protected function makeFakeArray(): array | ||
{ | ||
return [ | ||
'customerGroupId' => $this->getFactory('Identity')->makeOneArray() | ||
]; | ||
} | ||
|
||
/** | ||
* @return string | ||
*/ | ||
protected function getModelClass(): string | ||
{ | ||
return CategoryInvisibility::class; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Jtl\Connector\Core\Model\Generator; | ||
|
||
use Jtl\Connector\Core\Model\Checksum; | ||
|
||
/** | ||
* Class ChecksumFactory | ||
* | ||
* @package Jtl\Connector\Core\Model\Generator | ||
*/ | ||
class ChecksumFactory extends AbstractModelFactory | ||
{ | ||
/** | ||
* @return array<string, mixed> | ||
*/ | ||
protected function makeFakeArray(): array | ||
{ | ||
return [ | ||
'foreignKey' => $this->getFactory('Identity')->makeOneArray(), | ||
'endpoint' => $this->faker->uuid, | ||
'hasChanged' => false, | ||
'host' => (string)$this->faker->numberBetween(1), | ||
'type' => Checksum::TYPE_VARIATION | ||
]; | ||
} | ||
|
||
/** | ||
* @return string | ||
*/ | ||
protected function getModelClass(): string | ||
{ | ||
return Checksum::class; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Jtl\Connector\Core\Model\Generator; | ||
|
||
use Jtl\Connector\Core\Model\CustomerGroup; | ||
|
||
/** | ||
* Class CustomerGroupFactory | ||
* | ||
* @package Jtl\Connector\Core\Model\Generator | ||
*/ | ||
class CustomerGroupFactory extends AbstractModelFactory | ||
{ | ||
/** | ||
* @return array<string, mixed> | ||
* @throws \Exception | ||
*/ | ||
protected function makeFakeArray(): array | ||
{ | ||
return [ | ||
'id' => $this->getFactory('Identity')->makeOneArray(), | ||
'applyNetPrice' => $this->faker->boolean, | ||
'discount' => $this->faker->randomFloat(2, 0, 10), | ||
'isDefault' => $this->faker->boolean, | ||
'attributes' => $this->getFactory('TranslatableAttribute')->makeArray(\random_int(1, 3)), | ||
'i18ns' => $this->getFactory('CustomerGroupI18n')->makeArray(\random_int(1, 3)) | ||
]; | ||
} | ||
|
||
/** | ||
* @return string | ||
*/ | ||
protected function getModelClass(): string | ||
{ | ||
return CustomerGroup::class; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Jtl\Connector\Core\Model\Generator; | ||
|
||
use Jtl\Connector\Core\Model\CustomerGroupI18n; | ||
|
||
/** | ||
* Class CustomerGroupI18nFactory | ||
* | ||
* @package Jtl\Connector\Core\Model\Generator | ||
*/ | ||
class CustomerGroupI18nFactory extends AbstractModelFactory | ||
{ | ||
/** | ||
* @return array<string, string> | ||
*/ | ||
protected function makeFakeArray(): array | ||
{ | ||
return [ | ||
'name' => $this->faker->name | ||
]; | ||
} | ||
|
||
/** | ||
* @return string | ||
*/ | ||
protected function getModelClass(): string | ||
{ | ||
return CustomerGroupI18n::class; | ||
} | ||
} |
35 changes: 35 additions & 0 deletions
35
src/Model/Generator/CustomerGroupPackagingQuantityFactory.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Jtl\Connector\Core\Model\Generator; | ||
|
||
use Jtl\Connector\Core\Model\CustomerGroupPackagingQuantity; | ||
|
||
/** | ||
* Class CustomerGroupPackagingQuantityFactory | ||
* | ||
* @package Jtl\Connector\Core\Model\Generator | ||
*/ | ||
class CustomerGroupPackagingQuantityFactory extends AbstractModelFactory | ||
{ | ||
/** | ||
* @return array<string, mixed> | ||
*/ | ||
protected function makeFakeArray(): array | ||
{ | ||
return [ | ||
'customerGroupId' => $this->getFactory('Identity')->makeOneArray(), | ||
'minimumOrderQuantity' => $this->faker->numberBetween(1, 100), | ||
'packagingQuantity' => $this->faker->numberBetween(1, 100) | ||
]; | ||
} | ||
|
||
/** | ||
* @return string | ||
*/ | ||
protected function getModelClass(): string | ||
{ | ||
return CustomerGroupPackagingQuantity::class; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Jtl\Connector\Core\Model\Generator; | ||
|
||
use Jtl\Connector\Core\Model\PartsList; | ||
|
||
/** | ||
* Class PartsListFactory | ||
* | ||
* @package Jtl\Connector\Core\Model\Generator | ||
*/ | ||
class PartsListFactory extends AbstractModelFactory | ||
{ | ||
/** | ||
* @return array<string, mixed> | ||
*/ | ||
protected function makeFakeArray(): array | ||
{ | ||
return [ | ||
'productId' => $this->getFactory('Identity')->makeOneArray(), | ||
'quantity' => $this->faker->numberBetween(1, 100) | ||
]; | ||
} | ||
|
||
/** | ||
* @return string | ||
*/ | ||
protected function getModelClass(): string | ||
{ | ||
return PartsList::class; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Jtl\Connector\Core\Model\Generator; | ||
|
||
use Jtl\Connector\Core\Model\ProductConfigGroup; | ||
|
||
/** | ||
* Class ProductConfigGroupFactory | ||
* | ||
* @package Jtl\Connector\Core\Model\Generator | ||
*/ | ||
class ProductConfigGroupFactory extends AbstractModelFactory | ||
{ | ||
/** | ||
* @return array<string, mixed> | ||
*/ | ||
protected function makeFakeArray(): array | ||
{ | ||
return [ | ||
'configGroupId' => $this->getFactory('Identity')->makeOneArray(), | ||
'sort' => $this->faker->numberBetween(1, 10) | ||
]; | ||
} | ||
|
||
/** | ||
* @return string | ||
*/ | ||
protected function getModelClass(): string | ||
{ | ||
return ProductConfigGroup::class; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Jtl\Connector\Core\Model\Generator; | ||
|
||
use Jtl\Connector\Core\Model\ProductInvisibility; | ||
|
||
/** | ||
* Class ProductInvisibilityFactory | ||
* | ||
* @package Jtl\Connector\Core\Model\Generator | ||
*/ | ||
class ProductInvisibilityFactory extends AbstractModelFactory | ||
{ | ||
/** | ||
* @return array<string, mixed> | ||
*/ | ||
protected function makeFakeArray(): array | ||
{ | ||
return [ | ||
'customerGroupId' => $this->getFactory('Identity')->makeOneArray(), | ||
]; | ||
} | ||
|
||
/** | ||
* @return string | ||
*/ | ||
protected function getModelClass(): string | ||
{ | ||
return ProductInvisibility::class; | ||
} | ||
} |
Oops, something went wrong.