diff --git a/src/Fixture/Factory/ProductBundleFixtureFactory.php b/src/Fixture/Factory/ProductBundleFixtureFactory.php new file mode 100644 index 00000000..315203a4 --- /dev/null +++ b/src/Fixture/Factory/ProductBundleFixtureFactory.php @@ -0,0 +1,38 @@ +optionsResolver = new OptionsResolver(); + } + + protected function configureOptions(OptionsResolver $resolver): void + { + $resolver + ->setDefault('code', '') + ->setAllowedTypes('code', 'string') + ->setDefault('name', '') + ->setAllowedTypes('name', 'string') + ->setDefault('price', 0) + ->setAllowedTypes('price', 'integer') + ->setDefault('quantity', 0) + ->setAllowedTypes('quantity', 'integer') + ; + } + + public function create(array $options = []): ProductBundleInterface + { + $options = $this->optionsResolver->resolve($options); + } +} diff --git a/src/Fixture/ProductBundleFixture.php b/src/Fixture/ProductBundleFixture.php new file mode 100644 index 00000000..e3d8435f --- /dev/null +++ b/src/Fixture/ProductBundleFixture.php @@ -0,0 +1,26 @@ +children(); + $resourceNodeChildren->scalarNode('code')->cannotBeEmpty()->end(); + $resourceNodeChildren->scalarNode('name')->cannotBeEmpty()->end(); + $resourceNodeChildren->integerNode('price')->end(); + $resourceNodeChildren->integerNode('quantity')->end(); + } + + public function getName(): string + { + return 'product_bundle'; + } +} diff --git a/src/Resources/config/services.xml b/src/Resources/config/services.xml index ea17a5b4..145bb073 100644 --- a/src/Resources/config/services.xml +++ b/src/Resources/config/services.xml @@ -6,6 +6,7 @@ + diff --git a/src/Resources/config/services/fixture.xml b/src/Resources/config/services/fixture.xml new file mode 100644 index 00000000..5c690718 --- /dev/null +++ b/src/Resources/config/services/fixture.xml @@ -0,0 +1,16 @@ + + + + + + + + + + + + + diff --git a/tests/Application/config/packages/bitbag_sylius_product_bundle_plugin.yml b/tests/Application/config/packages/bitbag_sylius_product_bundle_plugin.yml index bd17eb83..181a8d7e 100644 --- a/tests/Application/config/packages/bitbag_sylius_product_bundle_plugin.yml +++ b/tests/Application/config/packages/bitbag_sylius_product_bundle_plugin.yml @@ -1,2 +1,17 @@ imports: - - { resource: "@BitBagSyliusProductBundlePlugin/Resources/config/config.yml" } + - { resource: "@BitBagSyliusProductBundlePlugin/Resources/config/config.yml" } + +sylius_fixtures: + suites: + default: + listeners: + orm_purger: ~ + logger: ~ + fixtures: + product_bundle: + options: + custom: + code: 'bundle' + name: Product Bundle + price: 1000 + quantity: 100