From f895c155394fbdc13fa696d78dcdde6f0f80a2ee Mon Sep 17 00:00:00 2001 From: Benoit Maziere Date: Wed, 18 Apr 2018 09:41:16 +0200 Subject: [PATCH] chore(clean): clean up namespaces, docs & folder structure --- README.md | 10 +++----- composer.json | 4 +-- docs/00-docs.md | 4 +++ docs/10-immutable-tabs-type.md | 12 ++++----- .../20-test-helper-traits.md | 0 src/Form/Type/ImmutableTabsType.php | 2 +- .../{ => Form}/form_admin_fields.html.twig | 0 src/SonataHelpersBundle.php | 25 +++++++++++++++++++ .../Tests}/Admin/AdminFormFieldTestTrait.php | 2 +- {Tests => src/Tests}/Admin/AdminTestCase.php | 2 +- .../Tests}/Common/ClassTestHelper.php | 2 +- .../Tests}/Common/TranslationTestHelper.php | 2 +- .../Fragments/FragmentFormFieldTestTrait.php | 2 +- {Tests => src/Tests}/MockBuilderTrait.php | 4 +-- tests/Form/Type/ImmutableTabsTypeTest.php | 4 +-- 15 files changed, 51 insertions(+), 24 deletions(-) rename Docs/Tests/TestHelperTraits.md => docs/20-test-helper-traits.md (100%) rename src/Ressources/views/{ => Form}/form_admin_fields.html.twig (100%) create mode 100644 src/SonataHelpersBundle.php rename {Tests => src/Tests}/Admin/AdminFormFieldTestTrait.php (98%) rename {Tests => src/Tests}/Admin/AdminTestCase.php (99%) rename {Tests => src/Tests}/Common/ClassTestHelper.php (94%) rename {Tests => src/Tests}/Common/TranslationTestHelper.php (95%) rename {Tests => src/Tests}/Fragments/FragmentFormFieldTestTrait.php (98%) rename {Tests => src/Tests}/MockBuilderTrait.php (89%) diff --git a/README.md b/README.md index 4ee24ba..aa53261 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,7 @@ -# sonata +# SonataHelpers -## Immutable tabs form type +WIP -- [Immutable Tabs Form Type](./docs/10-immutable-tabs-type.md) +## Documentation -## Test helpers - -- [Test Helpers](docs/Tests/TestHelperTraits.md) +- [Documentation](./docs/00-docs.md) diff --git a/composer.json b/composer.json index dc227e1..97fec51 100644 --- a/composer.json +++ b/composer.json @@ -21,10 +21,10 @@ "symfony/phpunit-bridge": "^4.0" }, "autoload": { - "psr-4": { "Sonata\\SonataHelpersBundle\\": "src/" } + "psr-4": { "Sonata\\HelpersBundle\\": "src/" } }, "autoload-dev": { - "psr-4": { "Sonata\\SonataHelpersBundle\\Tests\\": "tests/" } + "psr-4": { "Sonata\\HelpersBundle\\Tests\\": "tests/" } }, "config": { "sort-packages": true diff --git a/docs/00-docs.md b/docs/00-docs.md index 19d8e06..2d84201 100644 --- a/docs/00-docs.md +++ b/docs/00-docs.md @@ -3,3 +3,7 @@ ## Immutable tabs form type - [Immutable Tabs Form Type](./10-immutable-tabs-type.md) + +## Test helpers + +- [Test Helpers](./20-test-helper-traits.md) diff --git a/docs/10-immutable-tabs-type.md b/docs/10-immutable-tabs-type.md index e4adf7e..136e719 100644 --- a/docs/10-immutable-tabs-type.md +++ b/docs/10-immutable-tabs-type.md @@ -12,17 +12,17 @@ To get tabs into a block of page or admin form. It extends the `Sonata\CoreBundle\Form\Type\ImmutableArrayType` -And use a specific widget defined in `src/AdminBundle/Ressources/Views/form_admin_fields.html.twig` so you must add it to your admin sonata config +And use a specific widget defined in `SonataHelpersBundle/Ressources/views/From/form_admin_fields.html.twig` so you must add it to your admin sonata config ``` sonata_admin: admin_services: - canalplus.awaken.admin.item: + app.admin.item: templates: - form: ['CanalPlusAwakenAdminBundle:Form:form_admin_fields.html.twig'] + form: ['SonataHelpersBundle:Form:form_admin_fields.html.twig'] ``` -Don't forget to add the css `src/AdminBundle/Ressources/public/css/immutableTabsType.css` to have cute tabs +Don't forget to add the css `SonataHelpersBundle/Ressources/public/css/immutableTabsType.css` to have cute tabs An array of tabs must be set key : key of tab that will be used to record value in database @@ -98,7 +98,7 @@ data are a json with the key of the immutableTabsType then the key of tabs as su ### Exemple of data -```` +``` { "settings": { "fr": { @@ -112,4 +112,4 @@ data are a json with the key of the immutableTabsType then the key of tabs as su } } } -```` \ No newline at end of file +``` diff --git a/Docs/Tests/TestHelperTraits.md b/docs/20-test-helper-traits.md similarity index 100% rename from Docs/Tests/TestHelperTraits.md rename to docs/20-test-helper-traits.md diff --git a/src/Form/Type/ImmutableTabsType.php b/src/Form/Type/ImmutableTabsType.php index 8eae5c7..3ad6162 100644 --- a/src/Form/Type/ImmutableTabsType.php +++ b/src/Form/Type/ImmutableTabsType.php @@ -11,7 +11,7 @@ * */ -namespace Sonata\SonataHelpersBundle\Form\Type; +namespace Sonata\HelpersBundle\Form\Type; use Sonata\CoreBundle\Form\Type\ImmutableArrayType; use Symfony\Component\Form\FormBuilderInterface; diff --git a/src/Ressources/views/form_admin_fields.html.twig b/src/Ressources/views/Form/form_admin_fields.html.twig similarity index 100% rename from src/Ressources/views/form_admin_fields.html.twig rename to src/Ressources/views/Form/form_admin_fields.html.twig diff --git a/src/SonataHelpersBundle.php b/src/SonataHelpersBundle.php new file mode 100644 index 0000000..bf33c43 --- /dev/null +++ b/src/SonataHelpersBundle.php @@ -0,0 +1,25 @@ + + */ +class SonataHelpersBundle extends Bundle +{ +} diff --git a/Tests/Admin/AdminFormFieldTestTrait.php b/src/Tests/Admin/AdminFormFieldTestTrait.php similarity index 98% rename from Tests/Admin/AdminFormFieldTestTrait.php rename to src/Tests/Admin/AdminFormFieldTestTrait.php index c50a5f2..a5b2480 100644 --- a/Tests/Admin/AdminFormFieldTestTrait.php +++ b/src/Tests/Admin/AdminFormFieldTestTrait.php @@ -11,7 +11,7 @@ * */ -namespace SonataHelpers\Tests\Admin; +namespace Sonata\HelpersBundle\Tests\Admin; use Sonata\AdminBundle\Admin\AdminInterface; use Sonata\AdminBundle\Form\FormMapper; diff --git a/Tests/Admin/AdminTestCase.php b/src/Tests/Admin/AdminTestCase.php similarity index 99% rename from Tests/Admin/AdminTestCase.php rename to src/Tests/Admin/AdminTestCase.php index 51d7da5..aa84b38 100644 --- a/Tests/Admin/AdminTestCase.php +++ b/src/Tests/Admin/AdminTestCase.php @@ -11,7 +11,7 @@ * */ -namespace SonataHelpers\Tests\Admin; +namespace Sonata\HelpersBundle\Tests\Admin; use Doctrine\Common\Inflector\Inflector; use Knp\Menu\FactoryInterface; diff --git a/Tests/Common/ClassTestHelper.php b/src/Tests/Common/ClassTestHelper.php similarity index 94% rename from Tests/Common/ClassTestHelper.php rename to src/Tests/Common/ClassTestHelper.php index 2894203..0087ee6 100644 --- a/Tests/Common/ClassTestHelper.php +++ b/src/Tests/Common/ClassTestHelper.php @@ -11,7 +11,7 @@ * */ -namespace SonataHelpers\Tests\Common; +namespace Sonata\HelpersBundle\Tests\Common; /** * Class ClassTestHelper. diff --git a/Tests/Common/TranslationTestHelper.php b/src/Tests/Common/TranslationTestHelper.php similarity index 95% rename from Tests/Common/TranslationTestHelper.php rename to src/Tests/Common/TranslationTestHelper.php index f6f5f50..225134d 100644 --- a/Tests/Common/TranslationTestHelper.php +++ b/src/Tests/Common/TranslationTestHelper.php @@ -11,7 +11,7 @@ * */ -namespace SonataHelpers\Tests\Common; +namespace Sonata\HelpersBundle\Tests\Common; /** * Class TranslationTestHelper. diff --git a/Tests/Fragments/FragmentFormFieldTestTrait.php b/src/Tests/Fragments/FragmentFormFieldTestTrait.php similarity index 98% rename from Tests/Fragments/FragmentFormFieldTestTrait.php rename to src/Tests/Fragments/FragmentFormFieldTestTrait.php index 28edba0..22b99fe 100644 --- a/Tests/Fragments/FragmentFormFieldTestTrait.php +++ b/src/Tests/Fragments/FragmentFormFieldTestTrait.php @@ -11,7 +11,7 @@ * */ -namespace SonataHelpers\Tests\FragmentService; +namespace Sonata\HelpersBundle\Tests\FragmentService; use Sonata\AdminBundle\Admin\AdminInterface; use Sonata\AdminBundle\Form\FormMapper; diff --git a/Tests/MockBuilderTrait.php b/src/Tests/MockBuilderTrait.php similarity index 89% rename from Tests/MockBuilderTrait.php rename to src/Tests/MockBuilderTrait.php index b861786..00921d1 100755 --- a/Tests/MockBuilderTrait.php +++ b/src/Tests/MockBuilderTrait.php @@ -11,9 +11,9 @@ * */ -namespace SonataHelpers\Tests; +namespace Sonata\HelpersBundle\Tests; -use SonataHelpers\Tests\Common\TranslationTestHelper; +use Sonata\HelpersBundle\Tests\Common\TranslationTestHelper; use Symfony\Component\Translation\TranslatorInterface; /** diff --git a/tests/Form/Type/ImmutableTabsTypeTest.php b/tests/Form/Type/ImmutableTabsTypeTest.php index 03a4a1a..39612c7 100644 --- a/tests/Form/Type/ImmutableTabsTypeTest.php +++ b/tests/Form/Type/ImmutableTabsTypeTest.php @@ -11,10 +11,10 @@ * */ -namespace Sonata\SonataHelpersBundle\Tests\Form\Type; +namespace Sonata\HelpersBundle\Tests\Form\Type; use Sonata\CoreBundle\Form\Type\ImmutableArrayType; -use Sonata\SonataHelpersBundle\Form\Type\ImmutableTabsType; +use Sonata\HelpersBundle\Form\Type\ImmutableTabsType; use Symfony\Component\Form\FormBuilder; use Symfony\Component\Form\Test\TypeTestCase;