From 4fcf58027e9e2f8ac063e2a8ec5bd6b2d4aeadcc Mon Sep 17 00:00:00 2001 From: Al Ganiev Date: Sun, 12 Jan 2020 13:43:10 +1000 Subject: [PATCH] Symfony5 (#379) Symfony 5 Compatibility --- .travis.yml | 35 +- README.md | 35 +- composer.json | 28 +- phpunit.xml.dist | 2 +- src/Bridge/ElFinderBridge.php | 8 - src/Command/ElFinderInstallerCommand.php | 56 +++ ...ElFinderConfigurationProviderInterface.php | 13 + .../ElFinderConfigurationReader.php | 60 +--- src/Connector/ElFinderConnector.php | 3 - src/Controller/ElFinderController.php | 108 +++--- .../Compiler/TwigFormPass.php | 5 +- src/DependencyInjection/Configuration.php | 18 +- .../FMElfinderExtension.php | 18 +- src/Event/ElFinderEvents.php | 25 -- src/Event/ElFinderPostExecutionEvent.php | 3 - src/Event/ElFinderPreExecutionEvent.php | 6 +- src/Form/Type/ElFinderType.php | 11 +- src/Loader/ElFinderLoader.php | 13 +- ...ElFinderConfigurationProviderInterface.php | 16 - src/Resources/config/command.xml | 14 + src/Resources/config/elfinder.xml | 6 + src/Resources/config/routing.yml | 7 +- src/Resources/entity/ElFinderFile.php.dst | 318 ------------------ .../fixtures/LoadRootElement.php.dst | 40 --- .../views/Elfinder/ckeditor.html.twig | 117 ++++--- .../views/Elfinder/elfinder_type.html.twig | 104 ++++-- .../views/Elfinder/fm_tinymce.html.twig | 112 ++++-- .../Elfinder/helper/assets_css.html.twig | 4 - .../views/Elfinder/helper/assets_js.html.twig | 4 - .../views/Elfinder/helper/main.js.twig | 131 ++++++++ src/Resources/views/Elfinder/simple.html.twig | 89 +++-- .../views/Elfinder/summernote.html.twig | 110 ++++-- .../views/Elfinder/tinymce.html.twig | 146 +++++--- .../views/Elfinder/tinymce4.html.twig | 118 +++++-- src/Session/ElFinderSession.php | 3 - src/Twig/Extension/FMElfinderExtension.php | 3 - .../ElFinderConfigurationReaderTest.php | 5 +- .../Compiler/TwigFormPassTest.php | 3 - .../ConfigurationLoadTest.php | 7 +- .../FMElfinderExtensionTest.php | 10 +- .../Event/ElFinderPostExecutionEventTest.php | 5 - tests/Event/ElFinderPreExecutionEventTest.php | 5 - tests/FMElfinderBundleTest.php | 5 - tests/Fixtures/config/config.php | 1 - tests/Fixtures/config/config.xml | 1 - tests/Fixtures/config/config.yml | 1 - tests/Form/Type/ElFinderTypeTest.php | 5 - tests/Functional/config/config.yml | 1 - tests/Loader/ElFinderLoaderTest.php | 11 +- .../Extension/FMElfinderExtensionTest.php | 4 +- 50 files changed, 885 insertions(+), 968 deletions(-) create mode 100644 src/Command/ElFinderInstallerCommand.php create mode 100644 src/Configuration/ElFinderConfigurationProviderInterface.php delete mode 100644 src/Event/ElFinderEvents.php delete mode 100644 src/Model/ElFinderConfigurationProviderInterface.php create mode 100644 src/Resources/config/command.xml delete mode 100644 src/Resources/entity/ElFinderFile.php.dst delete mode 100644 src/Resources/fixtures/LoadRootElement.php.dst delete mode 100644 src/Resources/views/Elfinder/helper/assets_css.html.twig delete mode 100644 src/Resources/views/Elfinder/helper/assets_js.html.twig create mode 100644 src/Resources/views/Elfinder/helper/main.js.twig diff --git a/.travis.yml b/.travis.yml index 688b14a..85d24cc 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,39 +6,24 @@ cache: - $HOME/.composer/cache - $HOME/symfony-bridge/.phpunit -env: - global: - - COMPOSER_PREFER_LOWEST=false - - SYMFONY_DEPRECATIONS_HELPER=weak_vendors - - SYMFONY_PHPUNIT_BRIDGE_VERSION=4.0.* - - SYMFONY_VERSION=3.4.* - - PHPUNIT_FLAGS="-v" - - SYMFONY_PHPUNIT_DIR="$HOME/symfony-bridge/.phpunit" matrix: fast_finish: true include: - - php: 7.2 - env: SYMFONY_VERSION=4.1.* SYMFONY_PHPUNIT_BRIDGE_VERSION=4.1.* SYMFONY_DEPRECATIONS_HELPER=weak_vendors LEVEL=0 - - php: 7.3 - env: SYMFONY_VERSION=4.1.* SYMFONY_PHPUNIT_BRIDGE_VERSION=4.1.* SYMFONY_DEPRECATIONS_HELPER=weak_vendors LEVEL=0 - - php: 7.1 - env: SYMFONY_VERSION=4.2.* SYMFONY_PHPUNIT_BRIDGE_VERSION=4.2.* SYMFONY_DEPRECATIONS_HELPER=weak_vendors LEVEL=0 - - php: 7.2 - env: SYMFONY_VERSION=4.2.* SYMFONY_PHPUNIT_BRIDGE_VERSION=4.2.* SYMFONY_DEPRECATIONS_HELPER=weak_vendors LEVEL=0 - - php: 7.3 - env: SYMFONY_VERSION=4.2.* SYMFONY_PHPUNIT_BRIDGE_VERSION=4.2.* SYMFONY_DEPRECATIONS_HELPER=weak_vendors LEVEL=0 + - php: 7.2 + env: SYMFONY_VERSION="^4.4.0" + - php: 7.3 + env: SYMFONY_VERSION="^5.0.0" before_install: - - echo "memory_limit=2G" >> ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/travis.ini + - echo "memory_limit=4G" >> ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/travis.ini + - phpenv config-rm xdebug.ini || true + - composer global require --no-progress --no-scripts --no-plugins symfony/flex dev-master + - if [ "$SYMFONY_VERSION" != "" ]; then composer require --no-update "symfony/framework-bundle:${SYMFONY_VERSION}"; fi; -install: - - composer require --no-update symfony/symfony:${SYMFONY_VERSION} - - composer require --no-update symfony/form:${SYMFONY_VERSION} - - composer require --dev --no-update symfony/phpunit-bridge:${SYMFONY_PHPUNIT_BRIDGE_VERSION} - - composer update --prefer-source `if [[ $COMPOSER_PREFER_LOWEST = true ]]; then echo "--prefer-lowest --prefer-stable"; fi` +install: php -d memory_limit=-1 $(phpenv which composer) update $COMPOSER_FLAGS --no-suggest script: - - SYMFONY_PHPUNIT_VERSION=6.5 ./vendor/bin/simple-phpunit $PHPUNIT_FLAGS + - ./vendor/bin/phpunit --coverage-text --colors notifications: email: helios.ag@gmail.com diff --git a/README.md b/README.md index 73ca242..4b771b4 100644 --- a/README.md +++ b/README.md @@ -65,44 +65,22 @@ For Symfony Flex installation you need to enable community recipes: composer config extra.symfony.allow-contrib true ``` -And install +Install ```sh composer require helios-ag/fm-elfinder-bundle ``` -Other way (non flex way) is to add FMElFinderBundle to your composer.json - -```json -{ - "require": { - "helios-ag/fm-elfinder-bundle": "~9", - } -} -``` - -also add **component-dir** under **config** node of composer.json - -(also you can manually copy assets to this directory) - -```json -{ - "config": { - "component-dir": "public/assets" - } -} -``` - -Now tell composer to download the bundle by running the command: - +Copy elfinder assets to public folder ```sh -composer update helios-ag/fm-elfinder-bundle + bin/console elfinder:install ``` -### Step 2: Enable the bundle -Enable the bundle in the kernel: +### Step 2: Enable the bundle (Optional) + +Enable the bundle in the kernel (not needed with symfony flex): ```php - + ./tests diff --git a/src/Bridge/ElFinderBridge.php b/src/Bridge/ElFinderBridge.php index e530519..06ddaaf 100644 --- a/src/Bridge/ElFinderBridge.php +++ b/src/Bridge/ElFinderBridge.php @@ -6,19 +6,11 @@ use FM\ElfinderBundle\ElFinder\ElFinder; use elFinderVolumeDriver; -/** - * Class ElFinderBridge. - */ class ElFinderBridge extends ElFinder { /** @var SessionInterface */ protected $session; - /** - * ElFinderBridge constructor. - * - * @param $opts - */ public function __construct($opts) { if ($this->session) { diff --git a/src/Command/ElFinderInstallerCommand.php b/src/Command/ElFinderInstallerCommand.php new file mode 100644 index 0000000..6d21f9f --- /dev/null +++ b/src/Command/ElFinderInstallerCommand.php @@ -0,0 +1,56 @@ +fileSystem = $filesystem; + $this->parameterBag = $parameterBag; + parent::__construct(); + } + + protected function configure(): void + { + $this + ->setDescription('Copies elfinder assets to public directory') + ; + } + + protected function execute(InputInterface $input, OutputInterface $output): int + { + $publicDir = $this->parameterBag->get('kernel.project_dir').'/public/bundles/fmelfinder'; + + $this->fileSystem->mirror(self::ELFINDER_CSS_DIR, $publicDir.'/css'); + $this->fileSystem->mirror(self::ELFINDER_IMG_DIR, $publicDir.'/img'); + $this->fileSystem->mirror(self::ELFINDER_JS_DIR, $publicDir.'/js'); + $this->fileSystem->mirror(self::ELFINDER_SOUNDS_DIR, $publicDir.'/sounds'); + + $output->writeln('elFinder assets successfully installed'); + + return 0; + } +} diff --git a/src/Configuration/ElFinderConfigurationProviderInterface.php b/src/Configuration/ElFinderConfigurationProviderInterface.php new file mode 100644 index 0000000..321719c --- /dev/null +++ b/src/Configuration/ElFinderConfigurationProviderInterface.php @@ -0,0 +1,13 @@ +parameters = $parameters; $this->requestStack = $requestStack; $this->container = $container; } - /** - * @param $instance - * - * @return array - * - * @throws \Exception - */ - public function getConfiguration($instance) + public function getConfiguration(string $instance): array { $request = $this->requestStack->getCurrentRequest(); $efParameters = $this->parameters; @@ -166,15 +145,7 @@ public function getConfiguration($instance) return $options; } - /** - * @param $parameter - * @param $request - * @param $homeFolder - * @param $path - * - * @return string - */ - private function getURL($parameter, Request $request, $homeFolder, $path) + private function getURL(array $parameter, Request $request, string $homeFolder, string $path): string { if (isset($parameter['url']) && $parameter['url']) { if (0 === strpos($parameter['url'], 'http')) { @@ -195,8 +166,6 @@ private function getURL($parameter, Request $request, $homeFolder, $path) * @param $serviceName * * @return Filesystem - * - * @throws \MongoConnectionException */ private function configureFlysystem($opt, $adapter, $serviceName) { @@ -316,7 +285,7 @@ private function configureFlysystem($opt, $adapter, $serviceName) return $filesystem; } - private function getFlysystemFilesystem($serviceName) + private function getFlysystemFilesystem(string $serviceName) { $filesystem = $this->container->get($serviceName); if (!is_object($filesystem) || (!$filesystem instanceof Filesystem)) { @@ -326,14 +295,9 @@ private function getFlysystemFilesystem($serviceName) return $filesystem; } - /** - * @param array $parameter - * - * @return array - */ - private function configureDriver(array $parameter) + private function configureDriver(array $parameter): array { - $settings = array(); + $settings = []; switch (strtolower($parameter['driver'])) { case 'ftp': @@ -428,8 +392,6 @@ public function access($attr, $path, $data, $volume) * @param ElfinderSecurityInterface $voter * * @return array - * - * @throws \Exception */ protected function parseSecurityConfiguration(ElfinderSecurityInterface $voter) { diff --git a/src/Connector/ElFinderConnector.php b/src/Connector/ElFinderConnector.php index dc6260a..bef5270 100644 --- a/src/Connector/ElFinderConnector.php +++ b/src/Connector/ElFinderConnector.php @@ -4,9 +4,6 @@ use elFinder; -/** - * Class ElFinderConnector. - */ class ElFinderConnector extends \elFinderConnector { public function run($queryParameters = null) diff --git a/src/Controller/ElFinderController.php b/src/Controller/ElFinderController.php index 7233259..f2f7179 100644 --- a/src/Controller/ElFinderController.php +++ b/src/Controller/ElFinderController.php @@ -1,23 +1,24 @@ container->getParameter('fm_elfinder'); @@ -53,27 +54,26 @@ public function showAction(Request $request, $instance, $homeFolder) * @param array $parameters * @param string $instance * @param string $homeFolder - * @param $assetsPath - * @param null $formTypeId + * @param string $assetsPath + * @param string $formTypeId * * @return array * * @throws Exception */ - private function selectEditor($parameters, $instance, $homeFolder, $assetsPath, $formTypeId = null) + private function selectEditor(array $parameters, string $instance, string $homeFolder, string $assetsPath, string $formTypeId = null): array { $editor = $parameters['editor']; $locale = $parameters['locale'] ?: $this->container->getParameter('locale'); $fullScreen = $parameters['fullscreen']; $relativePath = $parameters['relative_path']; $pathPrefix = $parameters['path_prefix']; - $includeAssets = $parameters['include_assets']; $theme = $parameters['theme']; // convert to javascript array $onlyMimes = count($parameters['visible_mime_types']) ? "['".implode("','", $parameters['visible_mime_types'])."']" : '[]'; - $result = array(); + $result = []; switch ($editor) { case 'custom': @@ -82,10 +82,9 @@ private function selectEditor($parameters, $instance, $homeFolder, $assetsPath, } $result['template'] = $parameters['editor_template']; - $result['params'] = array( + $result['params'] = [ 'locale' => $locale, 'fullscreen' => $fullScreen, - 'includeAssets' => $includeAssets, 'instance' => $instance, 'homeFolder' => $homeFolder, 'relative_path' => $relativePath, @@ -93,15 +92,14 @@ private function selectEditor($parameters, $instance, $homeFolder, $assetsPath, 'theme' => $theme, 'pathPrefix' => $pathPrefix, 'onlyMimes' => $onlyMimes, - ); + ]; return $result; case 'ckeditor': $result['template'] = '@FMElfinder/Elfinder/ckeditor.html.twig'; - $result['params'] = array( + $result['params'] = [ 'locale' => $locale, 'fullscreen' => $fullScreen, - 'includeAssets' => $includeAssets, 'instance' => $instance, 'homeFolder' => $homeFolder, 'relative_path' => $relativePath, @@ -109,15 +107,14 @@ private function selectEditor($parameters, $instance, $homeFolder, $assetsPath, 'theme' => $theme, 'pathPrefix' => $pathPrefix, 'onlyMimes' => $onlyMimes, - ); + ]; return $result; case 'summernote': $result['template'] = '@FMElfinder/Elfinder/summernote.html.twig'; - $result['params'] = array( + $result['params'] = [ 'locale' => $locale, 'fullscreen' => $fullScreen, - 'includeAssets' => $includeAssets, 'instance' => $instance, 'homeFolder' => $homeFolder, 'relative_path' => $relativePath, @@ -125,29 +122,27 @@ private function selectEditor($parameters, $instance, $homeFolder, $assetsPath, 'theme' => $theme, 'pathPrefix' => $pathPrefix, 'onlyMimes' => $onlyMimes, - ); + ]; return $result; case 'tinymce': $result['template'] = '@FMElfinderBundle/Elfinder/tinymce.html.twig'; - $result['params'] = array( + $result['params'] = [ 'locale' => $locale, - 'tinymce_popup_path' => $this->getAssetsUrl($parameters['tinymce_popup_path']), - 'includeAssets' => $includeAssets, + 'tinymce_popup_path' => $parameters['tinymce_popup_path'], 'instance' => $instance, 'homeFolder' => $homeFolder, 'prefix' => $assetsPath, 'theme' => $theme, 'pathPrefix' => $pathPrefix, 'onlyMimes' => $onlyMimes, - ); + ]; return $result; case 'tinymce4': $result['template'] = '@FMElfinder/Elfinder/tinymce4.html.twig'; - $result['params'] = array( + $result['params'] = [ 'locale' => $locale, - 'includeAssets' => $includeAssets, 'instance' => $instance, 'homeFolder' => $homeFolder, 'relative_path' => $relativePath, @@ -155,14 +150,13 @@ private function selectEditor($parameters, $instance, $homeFolder, $assetsPath, 'theme' => $theme, 'pathPrefix' => $pathPrefix, 'onlyMimes' => $onlyMimes, - ); + ]; return $result; case 'fm_tinymce': $result['template'] = '@FMElfinder/Elfinder/fm_tinymce.html.twig'; - $result['params'] = array( + $result['params'] = [ 'locale' => $locale, - 'includeAssets' => $includeAssets, 'instance' => $instance, 'homeFolder' => $homeFolder, 'relative_path' => $relativePath, @@ -170,15 +164,14 @@ private function selectEditor($parameters, $instance, $homeFolder, $assetsPath, 'theme' => $theme, 'pathPrefix' => $pathPrefix, 'onlyMimes' => $onlyMimes, - ); + ]; return $result; case 'form': $result['template'] = '@FMElfinder/Elfinder/elfinder_type.html.twig'; - $result['params'] = array( + $result['params'] = [ 'locale' => $locale, 'fullscreen' => $fullScreen, - 'includeAssets' => $includeAssets, 'instance' => $instance, 'homeFolder' => $homeFolder, 'id' => $formTypeId, @@ -187,74 +180,59 @@ private function selectEditor($parameters, $instance, $homeFolder, $assetsPath, 'theme' => $theme, 'pathPrefix' => $pathPrefix, 'onlyMimes' => $onlyMimes, - ); + ]; return $result; default: $result['template'] = '@FMElfinder/Elfinder/simple.html.twig'; - $result['params'] = array( + $result['params'] = [ 'locale' => $locale, 'fullscreen' => $fullScreen, - 'includeAssets' => $includeAssets, 'instance' => $instance, 'homeFolder' => $homeFolder, 'prefix' => $assetsPath, 'onlyMimes' => $onlyMimes, 'theme' => $theme, 'pathPrefix' => $pathPrefix, - ); + ]; return $result; } } /** - * Loader service init. + * @param SessionInterface $session + * @param EventDispatcherInterface $eventDispatcher + * @param Request $request + * @param string $instance + * @param string $homeFolder * - * @param Request $request - * @param string $instance - * @param string $homeFolder - * - * @return JsonResponse/void + * @return JsonResponse */ - public function loadAction(Request $request, $instance, $homeFolder) + public function load(SessionInterface $session, EventDispatcherInterface $eventDispatcher, Request $request, string $instance, string $homeFolder): JsonResponse { $loader = $this->get('fm_elfinder.loader'); $loader->initBridge($instance); // builds up the Bridge object for the loader with the given instance + if ($loader instanceof ElFinderLoader) { - $loader->setSession(new ElFinderSession($this->get('session'))); + $loader->setSession(new ElFinderSession($session)); } + /** @var HttpKernel $httpKernel */ $httpKernel = $this->get('http_kernel'); $preExecutionEvent = new ElFinderPreExecutionEvent($request, $httpKernel, $instance, $homeFolder); - $this->get('event_dispatcher')->dispatch(ElFinderEvents::PRE_EXECUTION, $preExecutionEvent); + $eventDispatcher->dispatch($preExecutionEvent); $result = $loader->load($request); // the instance is already set $postExecutionEvent = new ElFinderPostExecutionEvent($request, $httpKernel, $instance, $homeFolder, $result); - $this->get('event_dispatcher')->dispatch(ElFinderEvents::POST_EXECUTION, $postExecutionEvent); + $eventDispatcher->dispatch($postExecutionEvent); // returning result (who may have been modified by a post execution event listener) return new JsonResponse($postExecutionEvent->getResult()); } - /** - * Get url from config string. - * - * @param string $inputUrl - * - * @return string - */ - protected function getAssetsUrl($inputUrl) + public function mainJS() { - /** @var $assets \Symfony\Component\Templating\Helper\CoreAssetsHelper */ - $assets = $this->container->get('templating.helper.assets'); - - $url = preg_replace('/^asset\[(.+)\]$/i', '$1', $inputUrl); - - if ($inputUrl !== $url) { - return $assets->getUrl($url); - } - - return $inputUrl; + return $this->render('@FMElfinder/Elfinder/helper/main.js.twig'); } } diff --git a/src/DependencyInjection/Compiler/TwigFormPass.php b/src/DependencyInjection/Compiler/TwigFormPass.php index 988765b..33cb8d4 100644 --- a/src/DependencyInjection/Compiler/TwigFormPass.php +++ b/src/DependencyInjection/Compiler/TwigFormPass.php @@ -5,9 +5,6 @@ use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface; -/** - * Class TwigFormPass. - */ class TwigFormPass implements CompilerPassInterface { public function process(ContainerBuilder $container) @@ -17,7 +14,7 @@ public function process(ContainerBuilder $container) } $container->setParameter('twig.form.resources', array_merge( - array('@FMElfinder/Form/elfinder_widget.html.twig'), + ['@FMElfinder/Form/elfinder_widget.html.twig'], $container->getParameter('twig.form.resources') )); } diff --git a/src/DependencyInjection/Configuration.php b/src/DependencyInjection/Configuration.php index 190e6f1..f1d2853 100644 --- a/src/DependencyInjection/Configuration.php +++ b/src/DependencyInjection/Configuration.php @@ -17,11 +17,8 @@ class Configuration implements ConfigurationInterface public function getConfigTreeBuilder() { $treeBuilder = new TreeBuilder('fm_elfinder'); - if (\method_exists($treeBuilder, 'getRootNode')) { - $rootNode = $treeBuilder->getRootNode(); - } else { - $rootNode = $treeBuilder->root('fm_elfinder'); - } + $rootNode = $treeBuilder->getRootNode(); + $rootNode ->fixXmlConfig('instance') ->children() @@ -40,7 +37,6 @@ public function getConfigTreeBuilder() ->scalarNode('editor_template')->defaultNull()->end() ->booleanNode('fullscreen')->defaultTrue()->end() ->scalarNode('theme')->defaultValue('smoothness')->end() // jQuery UI theme name - ->booleanNode('include_assets')->defaultTrue()->end() ->scalarNode('tinymce_popup_path')->defaultValue('')->end() ->booleanNode('relative_path')->defaultTrue()->end() ->scalarNode('path_prefix')->defaultValue('/')->end() @@ -431,7 +427,7 @@ private function createFlysystemNode() } /** - * @return \Symfony\Component\Config\Definition\Builder\NodeDefinition the plugins node + * @return NodeDefinition the plugins node */ private function createPluginsNode() { @@ -444,7 +440,7 @@ private function createPluginsNode() } /** - * @return \Symfony\Component\Config\Definition\Builder\NodeDefinition the bind node + * @return NodeDefinition the bind node */ private function createBindsNode() { @@ -457,7 +453,7 @@ private function createBindsNode() } /** - * @return \Symfony\Component\Config\Definition\Builder\NodeDefinition the bind node + * @return NodeDefinition the bind node */ private function createDriverOptionsNode() { @@ -470,11 +466,9 @@ private function createDriverOptionsNode() } /** - * Creates a node. - * * @param string $name the node name * - * @return \Symfony\Component\Config\Definition\Builder\NodeDefinition the node + * @return NodeDefinition the node */ private function createNode($name) { diff --git a/src/DependencyInjection/FMElfinderExtension.php b/src/DependencyInjection/FMElfinderExtension.php index 49098fa..142210a 100644 --- a/src/DependencyInjection/FMElfinderExtension.php +++ b/src/DependencyInjection/FMElfinderExtension.php @@ -6,12 +6,8 @@ use Symfony\Component\Config\FileLocator; use Symfony\Component\DependencyInjection\Extension\Extension; use Symfony\Component\DependencyInjection\Loader; -use Symfony\Component\HttpKernel\Kernel; -/** - * Class FMElfinderExtension. - */ -class FMElfinderExtension extends Extension +final class FMElfinderExtension extends Extension { /** * {@inheritdoc} @@ -23,22 +19,14 @@ public function load(array $configs, ContainerBuilder $container) $loader = new Loader\XmlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config')); $loader->load('elfinder.xml'); $loader->load('form.xml'); + $loader->load('command.xml'); $container->setParameter('fm_elfinder', $config); $container->setAlias('fm_elfinder.configurator', $config['configuration_provider']); $container->setAlias('fm_elfinder.loader', $config['loader']); $container->getAlias('fm_elfinder.loader')->setPublic(true); - - if (Kernel::VERSION_ID < 30000) { - $container->getDefinition('fm_elfinder.form.type') - ->clearTag('form.type') - ->addTag('form.type', array('alias' => 'elfinder')); - } } - /** - * @return string - */ - public function getNamespace() + public function getNamespace(): string { return 'http://helios-ag.github.io/schema/dic/fm_elfinder'; } diff --git a/src/Event/ElFinderEvents.php b/src/Event/ElFinderEvents.php deleted file mode 100644 index 11de80f..0000000 --- a/src/Event/ElFinderEvents.php +++ /dev/null @@ -1,25 +0,0 @@ -setDefaults(array( + ->setDefaults([ 'enable' => true, 'instance' => 'default', 'homeFolder' => '', - )) + ]) ->setAllowedTypes('enable', 'bool') - ->setAllowedTypes('instance', array('string', 'null')) - ->setAllowedTypes('homeFolder', array('string', 'null')); + ->setAllowedTypes('instance', ['string', 'null']) + ->setAllowedTypes('homeFolder', ['string', 'null']); } /** diff --git a/src/Loader/ElFinderLoader.php b/src/Loader/ElFinderLoader.php index 4f802cb..ad303cf 100644 --- a/src/Loader/ElFinderLoader.php +++ b/src/Loader/ElFinderLoader.php @@ -4,7 +4,7 @@ use FM\ElfinderBundle\Connector\ElFinderConnector; use FM\ElfinderBundle\Bridge\ElFinderBridge; -use FM\ElfinderBundle\Model\ElFinderConfigurationProviderInterface; +use FM\ElfinderBundle\Configuration\ElFinderConfigurationProviderInterface; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Session\SessionInterface; @@ -28,9 +28,6 @@ class ElFinderLoader /** @var SessionInterface */ protected $session; - /** - * @param \FM\ElfinderBundle\Model\ElFinderConfigurationProviderInterface $configurator - */ public function __construct(ElFinderConfigurationProviderInterface $configurator) { $this->configurator = $configurator; @@ -47,9 +44,8 @@ public function configure() if (!($configurator instanceof ElFinderConfigurationProviderInterface)) { throw new \Exception('Configurator class must implement ElFinderConfigurationProviderInterface'); } - $parameters = $configurator->getConfiguration($this->instance); - return $parameters; + return $configurator->getConfiguration($this->instance); } /** @@ -95,9 +91,6 @@ public function setInstance($instance) $this->instance = $instance; } - /** - * @param \FM\ElfinderBundle\Model\ElFinderConfigurationProviderInterface $configurator - */ public function setConfigurator(ElFinderConfigurationProviderInterface $configurator) { $this->configurator = $configurator; @@ -117,7 +110,7 @@ public function encode($path) $volumes = $this->bridge->getVolumes(); foreach ($volumes as $hashId => $volume) { - $aPathEncoded[$hashId] = $volume->getPath($path); + $aPathEncoded[$hashId] = $volume->getHash($path); } if (1 == count($aPathEncoded)) { diff --git a/src/Model/ElFinderConfigurationProviderInterface.php b/src/Model/ElFinderConfigurationProviderInterface.php deleted file mode 100644 index 1f77d56..0000000 --- a/src/Model/ElFinderConfigurationProviderInterface.php +++ /dev/null @@ -1,16 +0,0 @@ - + + + + + + + + + + \ No newline at end of file diff --git a/src/Resources/config/elfinder.xml b/src/Resources/config/elfinder.xml index afc83e9..6b5da91 100644 --- a/src/Resources/config/elfinder.xml +++ b/src/Resources/config/elfinder.xml @@ -21,5 +21,11 @@ + + + + + + diff --git a/src/Resources/config/routing.yml b/src/Resources/config/routing.yml index ac9dd58..848d4c8 100644 --- a/src/Resources/config/routing.yml +++ b/src/Resources/config/routing.yml @@ -1,6 +1,9 @@ ef_connect: path: /efconnect/{instance}/{homeFolder} - defaults: { _controller: FM\ElfinderBundle\Controller\ElFinderController::loadAction, instance: default, homeFolder: '' } + defaults: { _controller: FM\ElfinderBundle\Controller\ElFinderController::load, instance: default, homeFolder: '' } +ef_main_js: + path: /elfinder.main.js + defaults: { _controller: FM\ElfinderBundle\Controller\ElFinderController::mainJS } elfinder: path: /elfinder/{instance}/{homeFolder} - defaults: { _controller: FM\ElfinderBundle\Controller\ElFinderController::showAction, instance: default, homeFolder: '' } + defaults: { _controller: FM\ElfinderBundle\Controller\ElFinderController::show, instance: default, homeFolder: '' } diff --git a/src/Resources/entity/ElFinderFile.php.dst b/src/Resources/entity/ElFinderFile.php.dst deleted file mode 100644 index 73b0e78..0000000 --- a/src/Resources/entity/ElFinderFile.php.dst +++ /dev/null @@ -1,318 +0,0 @@ -content = $content; - } - - /** - * @return string - */ - public function getContent() - { - return $this->content; - } - - /** - * @param int $height - */ - public function setHeight($height) - { - $this->height = $height; - } - - /** - * @return int - */ - public function getHeight() - { - return $this->height; - } - - /** - * @param string $hidden - */ - public function setHidden($hidden) - { - $this->hidden = $hidden; - } - - /** - * @return string - */ - public function getHidden() - { - return $this->hidden; - } - - /** - * @param int $id - */ - public function setId($id) - { - $this->id = $id; - } - - /** - * @return int - */ - public function getId() - { - return $this->id; - } - - /** - * @param string $locked - */ - public function setLocked($locked) - { - $this->locked = $locked; - } - - /** - * @return string - */ - public function getLocked() - { - return $this->locked; - } - - /** - * @param string $mime - */ - public function setMime($mime) - { - $this->mime = $mime; - } - - /** - * @return string - */ - public function getMime() - { - return $this->mime; - } - - /** - * @param int $mtime - */ - public function setMtime($mtime) - { - $this->mtime = $mtime; - } - - /** - * @return int - */ - public function getMtime() - { - return $this->mtime; - } - - /** - * @param string $name - */ - public function setName($name) - { - $this->name = $name; - } - - /** - * @return string - */ - public function getName() - { - return $this->name; - } - - /** - * @param int $parentId - */ - public function setParentId($parentId) - { - $this->parentId = $parentId; - } - - /** - * @return int - */ - public function getParentId() - { - return $this->parentId; - } - - /** - * @param string $read - */ - public function setRead($read) - { - $this->read = $read; - } - - /** - * @return string - */ - public function getRead() - { - return $this->read; - } - - /** - * @param int $size - */ - public function setSize($size) - { - $this->size = $size; - } - - /** - * @return int - */ - public function getSize() - { - return $this->size; - } - - /** - * @param int $width - */ - public function setWidth($width) - { - $this->width = $width; - } - - /** - * @return int - */ - public function getWidth() - { - return $this->width; - } - - /** - * @param string $write - */ - public function setWrite($write) - { - $this->write = $write; - } - - /** - * @return string - */ - public function getWrite() - { - return $this->write; - } - -} diff --git a/src/Resources/fixtures/LoadRootElement.php.dst b/src/Resources/fixtures/LoadRootElement.php.dst deleted file mode 100644 index 12b58d7..0000000 --- a/src/Resources/fixtures/LoadRootElement.php.dst +++ /dev/null @@ -1,40 +0,0 @@ -setId(1); - $rootElement->setParentId(0); - $rootElement->setName('DATABASE'); - $rootElement->setContent(''); - $rootElement->setSize(0); - $rootElement->setMtime(0); - $rootElement->setMime('directory'); - $rootElement->setRead(1); - $rootElement->setWrite(1); - $rootElement->setLocked(0); - $rootElement->setHidden(0); - $rootElement->setWidth(0); - $rootElement->setHeight(0); - - $manager->persist($rootElement); - $manager->flush(); - } -} diff --git a/src/Resources/views/Elfinder/ckeditor.html.twig b/src/Resources/views/Elfinder/ckeditor.html.twig index 57ecce5..6885c30 100644 --- a/src/Resources/views/Elfinder/ckeditor.html.twig +++ b/src/Resources/views/Elfinder/ckeditor.html.twig @@ -2,53 +2,88 @@ - {% if includeAssets %} - {{ include("@FMElfinder/Elfinder/helper/assets_css.html.twig") }} - {% endif %} - - -{% if includeAssets %} - {{ include("@FMElfinder/Elfinder/helper/assets_js.html.twig") }} -{% endif %} - + + + + + +
- {% if fullscreen %} - $(window).resize(function(){ - var h = $(window).height(); - var $ef = $('.elfinder'); - if($ef.height() != h - 20){ - $ef.height(h -20).resize(); - } - }); - $(window).resize(); - {% endif %} - }); - -
diff --git a/src/Resources/views/Elfinder/elfinder_type.html.twig b/src/Resources/views/Elfinder/elfinder_type.html.twig index 6ba8b5a..e21c095 100644 --- a/src/Resources/views/Elfinder/elfinder_type.html.twig +++ b/src/Resources/views/Elfinder/elfinder_type.html.twig @@ -1,43 +1,79 @@ - {% if includeAssets %} - {{ include("@FMElfinder/Elfinder/helper/assets_css.html.twig") }} - {% endif %} - - -{% if includeAssets %} - {{ include("@FMElfinder/Elfinder/helper/assets_js.html.twig") }} -{% endif %} - + + + + +
- {% if fullscreen %} - var $window = $(window); - $window.resize(function(){ - var $win_height = $window.height(); - if( $f.height() != $win_height ){ - $f.height($win_height).resize(); - } - }); - $window.resize(); - {% endif %} - }); - -
diff --git a/src/Resources/views/Elfinder/fm_tinymce.html.twig b/src/Resources/views/Elfinder/fm_tinymce.html.twig index 1d02df6..0d8e876 100644 --- a/src/Resources/views/Elfinder/fm_tinymce.html.twig +++ b/src/Resources/views/Elfinder/fm_tinymce.html.twig @@ -1,41 +1,87 @@ -{% if includeAssets %} - {{ include("@FMElfinder/Elfinder:helper/assets_css.html.twig") }} -{% endif %} + + + + + -{% if includeAssets %} - {{ include("@FMElfinder/Elfinder/helper/assets_js.html.twig") }} -{% endif %} - -
+ +
+ diff --git a/src/Resources/views/Elfinder/helper/assets_css.html.twig b/src/Resources/views/Elfinder/helper/assets_css.html.twig deleted file mode 100644 index 92651be..0000000 --- a/src/Resources/views/Elfinder/helper/assets_css.html.twig +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/src/Resources/views/Elfinder/helper/assets_js.html.twig b/src/Resources/views/Elfinder/helper/assets_js.html.twig deleted file mode 100644 index 433027b..0000000 --- a/src/Resources/views/Elfinder/helper/assets_js.html.twig +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/src/Resources/views/Elfinder/helper/main.js.twig b/src/Resources/views/Elfinder/helper/main.js.twig new file mode 100644 index 0000000..8500830 --- /dev/null +++ b/src/Resources/views/Elfinder/helper/main.js.twig @@ -0,0 +1,131 @@ +(function(){ + "use strict"; + var // jQuery and jQueryUI version + jqver = '3.3.1', + uiver = '1.12.1', + + // Detect language (optional) + lang = (function() { + var locq = window.location.search, + map = { + 'pt' : 'pt_BR', + 'ug' : 'ug_CN', + 'zh' : 'zh_CN' + }, + full = { + 'zh_tw' : 'zh_TW', + 'zh_cn' : 'zh_CN', + 'fr_ca' : 'fr_CA' + }, + fullLang, locm, lang; + if (locq && (locm = locq.match(/lang=([a-zA-Z_-]+)/))) { + // detection by url query (?lang=xx) + fullLang = locm[1]; + } else { + // detection by browser language + fullLang = (navigator.browserLanguage || navigator.language || navigator.userLanguage || ''); + } + fullLang = fullLang.replace('-', '_').substr(0,5).toLowerCase(); + if (full[fullLang]) { + lang = full[fullLang]; + } else { + lang = (fullLang || 'en').substr(0,2); + if (map[lang]) { + lang = map[lang]; + } + } + return lang; + })(), + + // Start elFinder (REQUIRED) + start = function(elFinder, editors, config) { + // load jQueryUI CSS + elFinder.prototype.loadCss('//cdnjs.cloudflare.com/ajax/libs/jqueryui/'+uiver+'/themes/smoothness/jquery-ui.css'); + + $(function() { + var optEditors = { + commandsOptions: { + edit: { + editors: Array.isArray(editors)? editors : [] + } + } + }, + opts = {}; + + // Interpretation of "elFinderConfig" + if (config && config.managers) { + $.each(config.managers, function(id, mOpts) { + opts = Object.assign(opts, config.defaultOpts || {}); + // editors marges to opts.commandOptions.edit + try { + mOpts.commandsOptions.edit.editors = mOpts.commandsOptions.edit.editors.concat(editors || []); + } catch(e) { + Object.assign(mOpts, optEditors); + } + // Make elFinder + $('#' + id).elfinder( + // 1st Arg - options + $.extend(true, { lang: lang }, opts, mOpts || {}), + // 2nd Arg - before boot up function + function(fm, extraObj) { + // `init` event callback function + fm.bind('init', function() { + // Optional for Japanese decoder "encoding-japanese" + if (fm.lang === 'ja') { + require( + [ 'encoding-japanese' ], + function(Encoding) { + if (Encoding && Encoding.convert) { + fm.registRawStringDecoder(function(s) { + return Encoding.convert(s, {to:'UNICODE',type:'string'}); + }); + } + } + ); + } + }); + } + ); + }); + } else { + alert('"elFinderConfig" object is wrong.'); + } + }); + }, + + // JavaScript loader (REQUIRED) + load = function() { + require([ + 'elfinder' + , 'extras/editors.default.min' // load text, image editors + , 'elFinderConfig' + // , 'extras/quicklook.googledocs.min' // optional preview for GoogleApps contents on the GoogleDrive volume + ], + start, + function(error) { + alert(error.message); + } + ); + }, + + // is IE8 or :? for determine the jQuery version to use (optional) + old = (typeof window.addEventListener === 'undefined' && typeof document.getElementsByClassName === 'undefined') + || + (!window.chrome && !document.unqueID && !window.opera && !window.sidebar && 'WebkitAppearance' in document.documentElement.style && document.body.style && typeof document.body.style.webkitFilter === 'undefined'); + + // config of RequireJS (REQUIRED) + require.config({ + baseUrl : 'bundles/fmelfinder/js', + paths : { + 'jquery' : '//cdnjs.cloudflare.com/ajax/libs/jquery/'+(old? '1.12.4' : jqver)+'/jquery.min', + 'jquery-ui': '//cdnjs.cloudflare.com/ajax/libs/jqueryui/'+uiver+'/jquery-ui.min', + 'elfinder' : 'elfinder.min', + 'encoding-japanese': '//cdn.rawgit.com/polygonplanet/encoding.js/1.0.26/encoding.min' + }, + waitSeconds : 10 // optional + }); + + // load JavaScripts (REQUIRED) + load(); + +})(); diff --git a/src/Resources/views/Elfinder/simple.html.twig b/src/Resources/views/Elfinder/simple.html.twig index aa9db87..63306b5 100644 --- a/src/Resources/views/Elfinder/simple.html.twig +++ b/src/Resources/views/Elfinder/simple.html.twig @@ -1,34 +1,71 @@ - {% if includeAssets %} - {{ include("@FMElfinder/Elfinder/helper/assets_css.html.twig") }} - {% endif %} + + + + + -{% if includeAssets %} - {{ include("@FMElfinder/Elfinder/helper/assets_js.html.twig") }} -{% endif %} - -
+ +
+ diff --git a/src/Resources/views/Elfinder/summernote.html.twig b/src/Resources/views/Elfinder/summernote.html.twig index 4b24c0b..c6644d9 100644 --- a/src/Resources/views/Elfinder/summernote.html.twig +++ b/src/Resources/views/Elfinder/summernote.html.twig @@ -1,38 +1,86 @@ - {% if includeAssets %} - {{ include("@FMElfinder/Elfinder/helper/assets_css.html.twig") }} - {% endif %} + + + + + -{% if includeAssets %} - {{ include("@FMElfinder/Elfinder/helper/assets_js.html.twig") }} -{% endif %} - -
+ + +
+ diff --git a/src/Resources/views/Elfinder/tinymce.html.twig b/src/Resources/views/Elfinder/tinymce.html.twig index f4b2b68..b7c4ecd 100644 --- a/src/Resources/views/Elfinder/tinymce.html.twig +++ b/src/Resources/views/Elfinder/tinymce.html.twig @@ -1,63 +1,107 @@ - {% if includeAssets %} - {{ include("@FMElfinder/Elfinder/helper/assets_css.html.twig") }} - {% endif %} - - -{% if includeAssets %} - {{ include("@FMElfinder/Elfinder/helper/assets_js.html.twig") }} -{% endif %} - - + -
+ }); + + + + + +
+ - + \ No newline at end of file diff --git a/src/Resources/views/Elfinder/tinymce4.html.twig b/src/Resources/views/Elfinder/tinymce4.html.twig index 7ec9638..3f8fe40 100644 --- a/src/Resources/views/Elfinder/tinymce4.html.twig +++ b/src/Resources/views/Elfinder/tinymce4.html.twig @@ -1,45 +1,91 @@ -{% if includeAssets %} - {{ include("@FMElfinder/Elfinder/helper/assets_css.html.twig") }} -{% endif %} - - -{% if includeAssets %} - {{ include("@FMElfinder/Elfinder/helper/assets_js.html.twig") }} -{% endif %} - + -
+ }); + + + + + +
+ diff --git a/src/Session/ElFinderSession.php b/src/Session/ElFinderSession.php index 3c39e9c..6532977 100644 --- a/src/Session/ElFinderSession.php +++ b/src/Session/ElFinderSession.php @@ -4,9 +4,6 @@ use Symfony\Component\HttpFoundation\Session\SessionInterface; -/** - * Class ElFinderSession. - */ class ElFinderSession implements \elFinderSessionInterface { /** @var SessionInterface */ diff --git a/src/Twig/Extension/FMElfinderExtension.php b/src/Twig/Extension/FMElfinderExtension.php index 3048eec..6d8b996 100644 --- a/src/Twig/Extension/FMElfinderExtension.php +++ b/src/Twig/Extension/FMElfinderExtension.php @@ -9,9 +9,6 @@ use Twig\Extension\AbstractExtension; use Twig\TwigFunction; -/** - * Class FMElfinderExtension. - */ class FMElfinderExtension extends AbstractExtension { /** diff --git a/tests/Configuration/ElFinderConfigurationReaderTest.php b/tests/Configuration/ElFinderConfigurationReaderTest.php index 338328d..8bb40a5 100644 --- a/tests/Configuration/ElFinderConfigurationReaderTest.php +++ b/tests/Configuration/ElFinderConfigurationReaderTest.php @@ -5,9 +5,6 @@ use FM\ElfinderBundle\Configuration\ElFinderConfigurationReader; use Symfony\Component\DependencyInjection\ContainerInterface; -/** - * Class ElFinderConfigurationReaderTest. - */ class ElFinderConfigurationReaderTest extends \PHPUnit\Framework\TestCase { /** @@ -315,7 +312,7 @@ public function testSubClassOfHelper() { $rc = new \ReflectionClass('FM\ElfinderBundle\Configuration\ElFinderConfigurationReader'); - $this->assertTrue($rc->isSubclassOf('FM\ElfinderBundle\Model\ElFinderConfigurationProviderInterface')); + $this->assertTrue($rc->isSubclassOf('FM\ElfinderBundle\Configuration\ElFinderConfigurationProviderInterface')); } public function testAccessHidden() diff --git a/tests/DependencyInjection/Compiler/TwigFormPassTest.php b/tests/DependencyInjection/Compiler/TwigFormPassTest.php index 451bfc9..0f9b966 100644 --- a/tests/DependencyInjection/Compiler/TwigFormPassTest.php +++ b/tests/DependencyInjection/Compiler/TwigFormPassTest.php @@ -5,9 +5,6 @@ use FM\ElfinderBundle\DependencyInjection\Compiler\TwigFormPass; use Symfony\Component\DependencyInjection\ContainerBuilder; -/** - * Class TwigFormPassTest. - */ class TwigFormPassTest extends \PHPUnit\Framework\TestCase { public function testProcess() diff --git a/tests/DependencyInjection/ConfigurationLoadTest.php b/tests/DependencyInjection/ConfigurationLoadTest.php index ba18aca..8cdc909 100644 --- a/tests/DependencyInjection/ConfigurationLoadTest.php +++ b/tests/DependencyInjection/ConfigurationLoadTest.php @@ -5,18 +5,20 @@ use FM\ElfinderBundle\DependencyInjection\FMElfinderExtension; use FM\ElfinderBundle\DependencyInjection\Configuration; use Matthias\SymfonyDependencyInjectionTest\PhpUnit\AbstractExtensionConfigurationTestCase; +use Symfony\Component\Config\Definition\ConfigurationInterface; +use Symfony\Component\DependencyInjection\Extension\ExtensionInterface; /** * Class ConfigurationLoadTest. */ class ConfigurationLoadTest extends AbstractExtensionConfigurationTestCase { - protected function getContainerExtension() + protected function getContainerExtension(): ExtensionInterface { return new FMElfinderExtension(); } - protected function getConfiguration() + protected function getConfiguration(): ConfigurationInterface { return new Configuration(); } @@ -38,7 +40,6 @@ public function testSupportsAllConfigFormats($path) 'theme' => 'smoothness', 'editor_template' => 'Elfinder/editor.html.twig', 'fullscreen' => false, - 'include_assets' => false, 'cors_support' => false, 'tinymce_popup_path' => '/pop-up', 'relative_path' => false, diff --git a/tests/DependencyInjection/FMElfinderExtensionTest.php b/tests/DependencyInjection/FMElfinderExtensionTest.php index 93abdf9..647154c 100644 --- a/tests/DependencyInjection/FMElfinderExtensionTest.php +++ b/tests/DependencyInjection/FMElfinderExtensionTest.php @@ -7,14 +7,9 @@ use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\Yaml\Parser; -/** - * Class FMElfinderExtensionTest. - * - * @package FM\ElfinderBundle\Tests\DependencyInjection - */ class FMElfinderExtensionTest extends AbstractExtensionTestCase { - protected function getContainerExtensions() + protected function getContainerExtensions(): array { return array( new FMElfinderExtension(), @@ -38,14 +33,13 @@ public function testMinimumConfiguration() $this->assertTrue($this->container instanceof ContainerBuilder); } - protected function getMinimalConfiguration() + protected function getMinimalConfiguration(): array { $yaml = <<<'EOF' instances: default: locale: '%locale%' editor: simple # other choices are tinymce or simple - include_assets: true fullscreen: true connector: debug: true # defaults to false diff --git a/tests/Event/ElFinderPostExecutionEventTest.php b/tests/Event/ElFinderPostExecutionEventTest.php index 11f22e3..8950a92 100644 --- a/tests/Event/ElFinderPostExecutionEventTest.php +++ b/tests/Event/ElFinderPostExecutionEventTest.php @@ -6,11 +6,6 @@ use Symfony\Component\HttpFoundation\Request; use FM\ElfinderBundle\Event\ElFinderPostExecutionEvent; -/** - * Class ElFinderPostExecutionEventTest. - * - * @package FM\ElfinderBundle\Tests\Event - */ class ElFinderPostExecutionEventTest extends TestCase { public function testHasErrors() diff --git a/tests/Event/ElFinderPreExecutionEventTest.php b/tests/Event/ElFinderPreExecutionEventTest.php index 3e8546a..2d4b1e9 100644 --- a/tests/Event/ElFinderPreExecutionEventTest.php +++ b/tests/Event/ElFinderPreExecutionEventTest.php @@ -6,11 +6,6 @@ use Symfony\Component\HttpFoundation\Request; use FM\ElfinderBundle\Event\ElFinderPreExecutionEvent; -/** - * Class ElFinderPreExecutionEventTest. - * - * @package FM\ElfinderBundle\Tests\Event - */ class ElFinderPreExecutionEventTest extends TestCase { public function testGetCommand() diff --git a/tests/FMElfinderBundleTest.php b/tests/FMElfinderBundleTest.php index ea6ab37..4262b91 100644 --- a/tests/FMElfinderBundleTest.php +++ b/tests/FMElfinderBundleTest.php @@ -4,11 +4,6 @@ use FM\ElfinderBundle\FMElfinderBundle; -/** - * Class FMElfinderBundleTest. - * - * @package FM\ElfinderBundle\Tests - */ class FMElfinderBundleTest extends \PHPUnit\Framework\TestCase { public function testBundle() diff --git a/tests/Fixtures/config/config.php b/tests/Fixtures/config/config.php index 735d3d1..cb8effa 100644 --- a/tests/Fixtures/config/config.php +++ b/tests/Fixtures/config/config.php @@ -9,7 +9,6 @@ 'editor' => 'tinymce', 'editor_template' => 'Elfinder/editor.html.twig', 'fullscreen' => false, - 'include_assets' => false, 'tinymce_popup_path' => '/pop-up', 'relative_path' => false, 'connector' => array( diff --git a/tests/Fixtures/config/config.xml b/tests/Fixtures/config/config.xml index e0dec95..d481760 100644 --- a/tests/Fixtures/config/config.xml +++ b/tests/Fixtures/config/config.xml @@ -8,7 +8,6 @@ editor="tinymce" editor-template="Elfinder/editor.html.twig" fullscreen="false" - include-assets="false" tinymce-popup-path="/pop-up" relative-path="false" > diff --git a/tests/Fixtures/config/config.yml b/tests/Fixtures/config/config.yml index d78da99..39b802d 100644 --- a/tests/Fixtures/config/config.yml +++ b/tests/Fixtures/config/config.yml @@ -6,7 +6,6 @@ fm_elfinder: editor: tinymce editor_template: Elfinder/editor.html.twig fullscreen: false - include_assets: false tinymce_popup_path: /pop-up relative_path: false connector: diff --git a/tests/Form/Type/ElFinderTypeTest.php b/tests/Form/Type/ElFinderTypeTest.php index 08c7b6e..1b9f9d3 100644 --- a/tests/Form/Type/ElFinderTypeTest.php +++ b/tests/Form/Type/ElFinderTypeTest.php @@ -7,11 +7,6 @@ use Symfony\Component\HttpKernel\Kernel; use Symfony\Component\Form\FormView; -/** - * Class ElFinderTypeTest. - * - * @package FM\ElfinderBundle\Tests - */ class ElFinderTypeTest extends \PHPUnit\Framework\TestCase { public function testGetName() diff --git a/tests/Functional/config/config.yml b/tests/Functional/config/config.yml index 3afa4b2..aaef99d 100644 --- a/tests/Functional/config/config.yml +++ b/tests/Functional/config/config.yml @@ -26,7 +26,6 @@ fm_elfinder: editor: custom # other options are tinymce, tinymce4, form, custom and simple, cors_support: true # full symfony life cycle fullscreen: true # defaults true, applies to simple and ckeditor editors - include_assets: true # disable if you want to handle loading of the javascript and css assets yourself connector: debug: false # defaults to false roots: # at least one root must be defined diff --git a/tests/Loader/ElFinderLoaderTest.php b/tests/Loader/ElFinderLoaderTest.php index 7a41e92..8b076c6 100644 --- a/tests/Loader/ElFinderLoaderTest.php +++ b/tests/Loader/ElFinderLoaderTest.php @@ -2,23 +2,18 @@ namespace FM\ElfinderBundle\Tests\Loader; +use FM\ElfinderBundle\Configuration\ElFinderConfigurationProviderInterface; use FM\ElfinderBundle\Loader\ElFinderLoader; class ElFinderLoaderTest extends \PHPUnit\Framework\TestCase { - /** - * @var ElFinderLoader - */ protected $loader; - /** - * @var - */ protected $configuratorMock; - public function setUp() + public function setUp(): void { - $this->configuratorMock = $this->createMock('FM\ElfinderBundle\Model\ElFinderConfigurationProviderInterface'); + $this->configuratorMock = $this->createMock(ElFinderConfigurationProviderInterface::class); $this->configuratorMock->expects($this->any()) ->method('getConfiguration') ->will($this->returnValue(array('parameters' => array()))); diff --git a/tests/Twig/Extension/FMElfinderExtensionTest.php b/tests/Twig/Extension/FMElfinderExtensionTest.php index 2bfb30c..b3453d3 100644 --- a/tests/Twig/Extension/FMElfinderExtensionTest.php +++ b/tests/Twig/Extension/FMElfinderExtensionTest.php @@ -30,7 +30,7 @@ class FMElfinderExtensionTest extends \PHPUnit\Framework\TestCase /** @var Template */ protected $template; - protected function setUp() + protected function setUp(): void { $this->twig = new Environment(new FilesystemLoader(array(__DIR__.'/../../../src/Resources/views/Elfinder/helper'))); $this->extension = new FMElfinderExtension($this->twig); @@ -125,7 +125,7 @@ public function testName() /** * {@inheritdoc} */ - protected function tearDown() + protected function tearDown(): void { unset($this->template); unset($this->twig);