Skip to content

Commit

Permalink
[Fixtures] [TO BE DELETED] Sample fixture
Browse files Browse the repository at this point in the history
  • Loading branch information
pamil committed Jun 10, 2016
1 parent 89452f0 commit 85318c7
Show file tree
Hide file tree
Showing 5 changed files with 87 additions and 0 deletions.
48 changes: 48 additions & 0 deletions src/Sylius/Bundle/CoreBundle/Fixture/SampleFixture.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
<?php

/*
* This file is part of the Sylius package.
*
* (c) Paweł Jędrzejewski
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace Sylius\Bundle\CoreBundle\Fixture;

use Sylius\Bundle\FixturesBundle\Fixture\FixtureInterface;
use Symfony\Component\Config\Definition\Builder\TreeBuilder;

/**
* @author Kamil Kokot <kamil.kokot@lakion.com>
*/
final class SampleFixture implements FixtureInterface
{
/**
* {@inheritdoc}
*/
public function getConfigTreeBuilder()
{
$treeBuilder = new TreeBuilder();
$root = $treeBuilder->root('sample_fixture');

$root
->children()
->arrayNode('administrators')
->prototype('scalar')
;

return $treeBuilder;
}

/**
* {@inheritdoc}
*/
public function load(array $options)
{
foreach ($options['administrators'] as $administrator) {
printf('Creating an admin account for "%s"' . "\n", $administrator);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ imports:
- { resource: "parameters.yml" }
- { resource: "sylius.yml" }
- { resource: "state_machine.yml" }
- { resource: "fixtures.yml" }

assetic:
debug: "%kernel.debug%"
Expand Down
14 changes: 14 additions & 0 deletions src/Sylius/Bundle/CoreBundle/Resources/config/app/fixtures.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# This file is part of the Sylius package.
# (c) Paweł Jędrzejewski

sylius_fixtures:
suites:
sample_suite:
fixtures:
sample_fixture:
priority: 10
options:
administrators:
- Zbigniew Hołdys
- Krzysztof Krawczyk
- Ryszard Rynkowski
20 changes: 20 additions & 0 deletions src/Sylius/Bundle/CoreBundle/Resources/config/fixture.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>

<!--
This file is part of the Sylius package.
(c) Paweł Jędrzejewski
For the full copyright and license information, please view the LICENSE
file that was distributed with this source code.
-->

<container xmlns="http://symfony.com/schema/dic/services" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">
<services>
<service id="sylius.fixture.sample" class="Sylius\Bundle\CoreBundle\Fixture\SampleFixture">
<tag name="sylius_fixtures.fixture" fixture-name="sample_fixture" />
</service>
</services>
</container>
4 changes: 4 additions & 0 deletions src/Sylius/Bundle/CoreBundle/Resources/config/services.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@
xsi:schemaLocation="http://symfony.com/schema/dic/services
http://symfony.com/schema/dic/services/services-1.0.xsd">

<imports>
<import resource="fixture.xml" />
</imports>

<parameters>
<parameter key="sylius.settings_schema.general.class">Sylius\Bundle\CoreBundle\Settings\GeneralSettingsSchema</parameter>
<parameter key="sylius.settings_schema.taxation.class">Sylius\Bundle\CoreBundle\Settings\TaxationSettingsSchema</parameter>
Expand Down

0 comments on commit 85318c7

Please sign in to comment.