diff --git a/.phpunit/.gitemtpy.html b/.phpunit/.gitemtpy.html new file mode 100644 index 0000000..566549b --- /dev/null +++ b/.phpunit/.gitemtpy.html @@ -0,0 +1,10 @@ + + + + + Title + + + + + \ No newline at end of file diff --git a/.travis.yml b/.travis.yml index 9bd7838..8d65008 100644 --- a/.travis.yml +++ b/.travis.yml @@ -56,7 +56,10 @@ before_install: - if [ "$SYMFONY_VERSION" != "" ]; then composer require symfony/symfony:${SYMFONY_VERSION} --no-update; fi - export BRANCH=$(if [ "$TRAVIS_PULL_REQUEST" == "false" ]; then echo $TRAVIS_BRANCH; else echo $TRAVIS_PULL_REQUEST_BRANCH; fi) -install: travis_wait composer update --prefer-dist $COMPOSER_FLAGS +install: + - phpenv config-add travis.php.ini + - php -ini | grep memory_limit + - travis_wait composer update --prefer-dist $COMPOSER_FLAGS script: - if [ "${TEST_INSTALLATION}" == true ]; then make test_installation; else make test; fi diff --git a/composer.json b/composer.json index ca733aa..da477f1 100644 --- a/composer.json +++ b/composer.json @@ -18,7 +18,7 @@ "require": { "php": "^7.1", "symfony/framework-bundle": "^2.8 || ^3.3 || ^4.0", - "sonata-project/doctrine-phpcr-admin-bundle": "^2.1", + "sonata-project/doctrine-phpcr-admin-bundle": "^2.2", "sonata-project/admin-bundle": "^3.6.0", "symfony-cmf/tree-browser-bundle": "^2.0" }, @@ -37,10 +37,10 @@ "matthiasnoback/symfony-dependency-injection-test": "^1.1", "matthiasnoback/symfony-config-test": "^2.1", "burgov/key-value-form-bundle": "^1.0", - "egeloen/ckeditor-bundle": "^4.0", "symfony/asset": "^2.8 || ^3.3 || ^4.0", "symfony/browser-kit": "^2.8 || ^3.3 || ^4.0", - "symfony/css-selector": "^2.8 || ^3.3 || ^4.0" + "symfony/css-selector": "^2.8 || ^3.3 || ^4.0", + "friendsofsymfony/ckeditor-bundle": "^1.0" }, "suggest": { "symfony-cmf/routing-bundle": "To make use of the alternate locale provider.", diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 3a2dc07..a2a7e87 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -24,9 +24,4 @@ - - - - - diff --git a/src/Admin/Content/StaticContentAdmin.php b/src/Admin/Content/StaticContentAdmin.php index 111def3..f05dd5c 100644 --- a/src/Admin/Content/StaticContentAdmin.php +++ b/src/Admin/Content/StaticContentAdmin.php @@ -11,7 +11,7 @@ namespace Symfony\Cmf\Bundle\SonataPhpcrAdminIntegrationBundle\Admin\Content; -use Ivory\CKEditorBundle\Form\Type\CKEditorType; +use FOS\CKEditorBundle\Form\Type\CKEditorType; use Sonata\AdminBundle\Datagrid\DatagridMapper; use Sonata\AdminBundle\Datagrid\ListMapper; use Sonata\AdminBundle\Form\FormMapper; @@ -40,7 +40,7 @@ public function getExportFormats() /** * Set configuration for CKEditorType. * - * Documentation: http://symfony.com/doc/master/bundles/IvoryCKEditorBundle/usage/config.html + * Documentation: http://symfony.com/doc/master/bundles/FOSCKEditorBundle/usage/config.html * * @param array $config configuration for CKEditorType */ diff --git a/src/DependencyInjection/Factory/ContentAdminFactory.php b/src/DependencyInjection/Factory/ContentAdminFactory.php index 65a4016..c964375 100644 --- a/src/DependencyInjection/Factory/ContentAdminFactory.php +++ b/src/DependencyInjection/Factory/ContentAdminFactory.php @@ -11,7 +11,7 @@ namespace Symfony\Cmf\Bundle\SonataPhpcrAdminIntegrationBundle\DependencyInjection\Factory; -use Ivory\CKEditorBundle\IvoryCKEditorBundle; +use FOS\CKEditorBundle\FOSCKEditorBundle; use Symfony\Component\Config\Definition\Builder\NodeBuilder; use Symfony\Component\Config\Definition\Exception\InvalidConfigurationException; use Symfony\Component\DependencyInjection\ContainerBuilder; @@ -39,6 +39,7 @@ public function addConfiguration(NodeBuilder $builder) { $builder ->arrayNode('ivory_ckeditor') + ->setDeprecated('IvoryCKEditorBundle was moved into the FOSCKeditorBundle. Pleas this one will not do anything at the end') ->treatFalseLike(['enabled' => false]) ->treatTrueLike(['enabled' => true]) ->treatNullLike(['enabled' => 'auto']) @@ -52,6 +53,19 @@ public function addConfiguration(NodeBuilder $builder) ->scalarNode('config_name')->end() ->end() ->end() + ->arrayNode('fos_ck_editor') + ->treatFalseLike(['enabled' => false]) + ->treatTrueLike(['enabled' => true]) + ->treatNullLike(['enabled' => 'auto']) + ->addDefaultsIfNotSet() + ->ignoreExtraKeys() + ->children() + ->enumNode('enabled') + ->values([true, false, 'auto']) + ->defaultValue('auto') + ->end() + ->scalarNode('config_name')->end() + ->end() ; } @@ -62,22 +76,22 @@ public function create(array $config, ContainerBuilder $container, XmlFileLoader { $loader->load('content.xml'); - $message = 'IvoryCKEditorBundle integration was explicitely enabled, but the bundle is not available.'; - if (class_exists(IvoryCKEditorBundle::class)) { + $message = 'FOSCKEditorBundle integration was explicitely enabled, but the bundle is not available.'; + if (class_exists(FOSCKEditorBundle::class)) { $message .= ' (did you forget to register the bundle in the AppKernel?)'; } $ckeditorConfig = []; - if ($this->isConfigEnabledAuto($container, $config['ivory_ckeditor']['enabled'], 'IvoryCKEditorBundle', $message)) { - if (!isset($config['ivory_ckeditor']['config_name'])) { - throw new InvalidConfigurationException('The cmf_sonata_phpcr_admin_integration.bundles.content.ivory_ckeditor.config_name setting has to be defined when IvoryCKEditorBundle integration is enabled.'); + if ($this->isConfigEnabledAuto($container, $config['fos_ck_editor']['enabled'], 'FOSCKEditorBundle', $message)) { + if (!isset($config['fos_ck_editor']['config_name'])) { + throw new InvalidConfigurationException('The cmf_sonata_phpcr_admin_integration.bundles.content.fos_ck_editor.config_name setting has to be defined when FOSCKEditorBundle integration is enabled.'); } - unset($config['ivory_ckeditor']['enabled']); + unset($config['fos_ck_editor']['enabled']); - $ckeditorConfig = $config['ivory_ckeditor']; + $ckeditorConfig = $config['fos_ck_editor']; } - $container->setParameter('cmf_sonata_phpcr_admin_integration.content.ivory_ckeditor', $ckeditorConfig); + $container->setParameter('cmf_sonata_phpcr_admin_integration.content.fos_ck_editor', $ckeditorConfig); } } diff --git a/src/Resources/config/content.xml b/src/Resources/config/content.xml index f6051e5..7841cb2 100644 --- a/src/Resources/config/content.xml +++ b/src/Resources/config/content.xml @@ -29,7 +29,7 @@ - %cmf_sonata_phpcr_admin_integration.content.ivory_ckeditor% + %cmf_sonata_phpcr_admin_integration.content.fos_ck_editor% diff --git a/tests/Fixtures/App/config/bundles.php b/tests/Fixtures/App/config/bundles.php index cfa07af..6bf61a9 100644 --- a/tests/Fixtures/App/config/bundles.php +++ b/tests/Fixtures/App/config/bundles.php @@ -9,6 +9,7 @@ * file that was distributed with this source code. */ +use FOS\CKEditorBundle\FOSCKEditorBundle; use Knp\Bundle\MenuBundle\KnpMenuBundle; use Sonata\AdminBundle\SonataAdminBundle; use Sonata\BlockBundle\SonataBlockBundle; @@ -27,11 +28,11 @@ Symfony\Cmf\Bundle\MenuBundle\CmfMenuBundle::class => ['all' => true], Symfony\Cmf\Bundle\ContentBundle\CmfContentBundle::class => ['all' => true], JMS\SerializerBundle\JMSSerializerBundle::class => ['all' => true], - Ivory\CKEditorBundle\IvoryCKEditorBundle::class => ['all' => true], SonataBlockBundle::class => ['all' => true], SonataCoreBundle::class => ['all' => true], SonataAdminBundle::class => ['all' => true], KnpMenuBundle::class => ['all' => true], SonataDoctrinePHPCRAdminBundle::class => ['all' => true], CmfTreeBrowserBundle::class => ['all' => true], + FOSCKEditorBundle::class => ['all' => true], ]; diff --git a/tests/Fixtures/App/config/cmf_sonata_admin_integration.yml b/tests/Fixtures/App/config/cmf_sonata_admin_integration.yml index e6eaf8b..e4361a6 100644 --- a/tests/Fixtures/App/config/cmf_sonata_admin_integration.yml +++ b/tests/Fixtures/App/config/cmf_sonata_admin_integration.yml @@ -4,7 +4,7 @@ cmf_sonata_phpcr_admin_integration: core: ~ menu: ~ content: - ivory_ckeditor: { config_name: cmf_sonata_admin_integration } + fos_ck_editor: { config_name: cmf_sonata_admin_integration } routing: basepath: /test/routing @@ -44,7 +44,7 @@ cmf_core: multilang: locales: [en, de] -ivory_ck_editor: +fos_ck_editor: configs: cmf_sonata_admin_integration: { toolbar: standard } diff --git a/tests/Unit/DependencyInjection/Factory/ContentAdminFactoryTest.php b/tests/Unit/DependencyInjection/Factory/ContentAdminFactoryTest.php index 9b93e61..9f71889 100644 --- a/tests/Unit/DependencyInjection/Factory/ContentAdminFactoryTest.php +++ b/tests/Unit/DependencyInjection/Factory/ContentAdminFactoryTest.php @@ -33,13 +33,13 @@ protected function setUp() { $this->factory = new ContentAdminFactory(); $this->container = new ContainerBuilder(); - $this->container->setParameter('kernel.bundles', ['IvoryCKEditorBundle' => true]); + $this->container->setParameter('kernel.bundles', ['FOSCKEditorBundle' => true]); $this->fileLoader = $this->createMock(XmlFileLoader::class); } /** * @expectedException \Symfony\Component\Config\Definition\Exception\InvalidConfigurationException - * @expectedExceptionMessage config_name setting has to be defined when IvoryCKEditorBundle integration is enabled + * @expectedExceptionMessage config_name setting has to be defined when FOSCKEditorBundle integration is enabled */ public function testInvalidCKEditorEnabledWithoutConfigName() { @@ -56,26 +56,26 @@ public function testCKEditorDisabledWithoutConfigName() { $config = $this->process($this->buildConfig(), [[ 'bundles' => [ - 'content' => ['ivory_ckeditor' => false], + 'content' => ['fos_ck_editor' => false], ], ]]); $this->create($config); - $this->assertEquals([], $this->container->getParameter('cmf_sonata_phpcr_admin_integration.content.ivory_ckeditor')); + $this->assertEquals([], $this->container->getParameter('cmf_sonata_phpcr_admin_integration.content.fos_ck_editor')); } public function testCKEditorEnabledWithConfigName() { $config = $this->process($this->buildConfig(), [[ 'bundles' => [ - 'content' => ['ivory_ckeditor' => ['config_name' => 'default']], + 'content' => ['fos_ck_editor' => ['config_name' => 'default']], ], ]]); $this->create($config); - $this->assertEquals(['config_name' => 'default'], $this->container->getParameter('cmf_sonata_phpcr_admin_integration.content.ivory_ckeditor')); + $this->assertEquals(['config_name' => 'default'], $this->container->getParameter('cmf_sonata_phpcr_admin_integration.content.fos_ck_editor')); } protected function buildConfig() diff --git a/travis.php.ini b/travis.php.ini new file mode 100644 index 0000000..7999e96 --- /dev/null +++ b/travis.php.ini @@ -0,0 +1 @@ +memory_limit = -1