Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate project to the AceEditorBundle\AceEditorBundle namespace (fixes #74) #75

Merged
merged 4 commits into from
Jan 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ bundle yourself:

return [
// ...
Norzechowicz\AceEditorBundle\NorzechowiczAceEditorBundle::class => ['all' => true],
AceEditorBundle\AceEditorBundle::class => ['all' => true],
// ...
}
```
Expand All @@ -51,9 +51,9 @@ rm v1.2.6.tar.gz
## Usage

```php
use Norzechowicz\AceEditorBundle\Form\Extension\AceEditor\Type\AceEditorType;
use AceEditorBundle\Form\Extension\AceEditor\Type\AceEditorType;

/* @var $builder \Symfony\Component\Form\FormBuilderInterface */
/** @var $builder \Symfony\Component\Form\FormBuilderInterface */
$builder->add('description', AceEditorType::class, array(
'wrapper_attr' => array(), // aceeditor wrapper html attributes.
'width' => '100%',
Expand Down Expand Up @@ -87,7 +87,7 @@ Default configuration:
```
# app/config/config.yml

norzechowicz_ace_editor:
ace_editor:
base_path: "vendor/ace" # notice! this is starting from your project's public web root, typically: `%kernel.project_dir%/public`!
autoinclude: true
debug: false # sources not minified, based on kernel.debug but it can force it
Expand All @@ -97,6 +97,6 @@ norzechowicz_ace_editor:
You can also include Ace editor directly from a location that follow the same directory layout than
`https://github.com/ajaxorg/ace-builds`, all you need to do is setting `base_path` option:
```
norzechowicz_ace_editor:
ace_editor:
base_path: "http://rawgithub.com/ajaxorg/ace-builds/master"
```
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@
"phpunit/phpunit": "^9.2"
},
"autoload": {
"psr-4": { "Norzechowicz\\AceEditorBundle\\": "src/" }
"psr-4": { "AceEditorBundle\\": "src/" }
},
"autoload-dev": {
"psr-4": {
"Norzechowicz\\AceEditorBundle\\Tests\\": "tests/"
"AceEditorBundle\\Tests\\": "tests/"
}
},
"extra": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@

declare(strict_types=1);

namespace Norzechowicz\AceEditorBundle;
namespace AceEditorBundle;

use Norzechowicz\AceEditorBundle\DependencyInjection\Compiler\TwigFormPass;
use AceEditorBundle\DependencyInjection\Compiler\TwigFormPass;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\HttpKernel\Bundle\Bundle;

class NorzechowiczAceEditorBundle extends Bundle
class AceEditorBundle extends Bundle
{
public function build(ContainerBuilder $container): void
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@

declare(strict_types=1);

namespace Norzechowicz\AceEditorBundle\DependencyInjection;
namespace AceEditorBundle\DependencyInjection;

use Symfony\Component\Config\FileLocator;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Loader;
use Symfony\Component\HttpKernel\DependencyInjection\Extension;

class NorzechowiczAceEditorExtension extends Extension
class AceEditorExtension extends Extension
{
public function load(array $configs, ContainerBuilder $container): void
{
Expand All @@ -36,8 +36,8 @@ private function registerAceEditorParameters(array $config, ContainerBuilder $co

$mode = 'src'.($debug ? '' : '-min').($config['noconflict'] ? '-noconflict' : '');

$container->setParameter('norzechowicz_ace_editor.options.autoinclude', $config['autoinclude']);
$container->setParameter('norzechowicz_ace_editor.options.base_path', $config['base_path']);
$container->setParameter('norzechowicz_ace_editor.options.mode', $mode);
$container->setParameter('ace_editor.options.autoinclude', $config['autoinclude']);
$container->setParameter('ace_editor.options.base_path', $config['base_path']);
$container->setParameter('ace_editor.options.mode', $mode);
}
}
4 changes: 2 additions & 2 deletions src/DependencyInjection/Compiler/TwigFormPass.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types=1);

namespace Norzechowicz\AceEditorBundle\DependencyInjection\Compiler;
namespace AceEditorBundle\DependencyInjection\Compiler;

use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
use Symfony\Component\DependencyInjection\ContainerBuilder;
Expand All @@ -16,7 +16,7 @@ public function process(ContainerBuilder $container): void
}

$container->setParameter('twig.form.resources', array_merge(
[$container->getParameter('norzechowicz_ace_editor.form.resource')],
[$container->getParameter('ace_editor.form.resource')],
$container->getParameter('twig.form.resources')
));
}
Expand Down
4 changes: 2 additions & 2 deletions src/DependencyInjection/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types=1);

namespace Norzechowicz\AceEditorBundle\DependencyInjection;
namespace AceEditorBundle\DependencyInjection;

use Symfony\Component\Config\Definition\Builder\TreeBuilder;
use Symfony\Component\Config\Definition\ConfigurationInterface;
Expand All @@ -11,7 +11,7 @@ class Configuration implements ConfigurationInterface
{
public function getConfigTreeBuilder(): TreeBuilder
{
$treeBuilder = new TreeBuilder('norzechowicz_ace_editor');
$treeBuilder = new TreeBuilder('ace_editor');
$rootNode = $treeBuilder->getRootNode();

$rootNode
Expand Down
2 changes: 1 addition & 1 deletion src/Form/Extension/AceEditor/Type/AceEditorType.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types=1);

namespace Norzechowicz\AceEditorBundle\Form\Extension\AceEditor\Type;
namespace AceEditorBundle\Form\Extension\AceEditor\Type;

use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Exception\InvalidArgumentException;
Expand Down
4 changes: 2 additions & 2 deletions src/Resources/config/form.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">

<parameters>
<parameter key="norzechowicz_ace_editor.form.resource">@NorzechowiczAceEditor/Form/div_layout.html.twig</parameter>
<parameter key="ace_editor.form.resource">@NorbertTechSymfonyAceEditor/Form/div_layout.html.twig</parameter>
</parameters>
<services>
<service id="norzechowicz_ace_editor.form.type.ace_editor" class="Norzechowicz\AceEditorBundle\Form\Extension\AceEditor\Type\AceEditorType">
<service id="ace_editor.form.type.ace_editor" class="AceEditorBundle\Form\Extension\AceEditor\Type\AceEditorType">
<tag name="form.type" alias="ace_editor" />
</service>
</services>
Expand Down
8 changes: 4 additions & 4 deletions src/Resources/config/twig.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">
<services>
<!-- Twig Extensions -->
<service id="norzechowicz_ace_editor.twig.form_extension" class="Norzechowicz\AceEditorBundle\Twig\Extension\AceEditorExtension">
<service id="ace_editor.twig.form_extension" class="AceEditorBundle\Twig\Extension\AceEditorExtension">
<tag name="twig.extension" />
<argument>%norzechowicz_ace_editor.options.autoinclude%</argument>
<argument>%norzechowicz_ace_editor.options.base_path%</argument>
<argument>%norzechowicz_ace_editor.options.mode%</argument>
<argument>%ace_editor.options.autoinclude%</argument>
<argument>%ace_editor.options.base_path%</argument>
<argument>%ace_editor.options.mode%</argument>
</service>
</services>
</container>
2 changes: 1 addition & 1 deletion src/Twig/Extension/AceEditorExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types=1);

namespace Norzechowicz\AceEditorBundle\Twig\Extension;
namespace AceEditorBundle\Twig\Extension;

use Symfony\Bridge\Twig\Extension\AssetExtension;
use Twig\Environment;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,19 @@

declare(strict_types=1);

namespace Norzechowicz\AceEditorBundle\Tests;
namespace AceEditorBundle\Tests;

use Norzechowicz\AceEditorBundle\DependencyInjection\Compiler\TwigFormPass;
use Norzechowicz\AceEditorBundle\NorzechowiczAceEditorBundle;
use AceEditorBundle\AceEditorBundle;
use AceEditorBundle\DependencyInjection\Compiler\TwigFormPass;
use PHPUnit\Framework\TestCase;
use Symfony\Component\DependencyInjection\ContainerBuilder;

class NorzechowiczAceEditorBundleTest extends TestCase
class AceEditorBundleTest extends TestCase
{
public function testBuild(): void
{
$container = new ContainerBuilder();
$bundle = new NorzechowiczAceEditorBundle();
$bundle = new AceEditorBundle();
$bundle->build($container);

$this->assertNotEmpty(array_filter(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,30 +2,30 @@

declare(strict_types=1);

namespace Norzechowicz\AceEditorBundle\Tests\DependencyInjection;
namespace AceEditorBundle\Tests\DependencyInjection;

use Norzechowicz\AceEditorBundle\DependencyInjection\NorzechowiczAceEditorExtension;
use AceEditorBundle\DependencyInjection\AceEditorExtension;
use PHPUnit\Framework\TestCase;
use Symfony\Component\DependencyInjection\ContainerBuilder;

class NorzechowiczEditorExtensionTest extends TestCase
class AceEditorExtensionTest extends TestCase
{
/**
* @dataProvider loadProvider
*/
public function testLoad(array $parameters, bool $kernelDebug, array $expected): void
{
$extension = new NorzechowiczAceEditorExtension();
$extension = new AceEditorExtension();
$container = new ContainerBuilder();

$container->setParameter('kernel.debug', $kernelDebug);

$extension->load([$parameters], $container);

$result = [
'autoinclude' => $container->getParameter('norzechowicz_ace_editor.options.autoinclude'),
'base_path' => $container->getParameter('norzechowicz_ace_editor.options.base_path'),
'mode' => $container->getParameter('norzechowicz_ace_editor.options.mode'),
'autoinclude' => $container->getParameter('ace_editor.options.autoinclude'),
'base_path' => $container->getParameter('ace_editor.options.base_path'),
'mode' => $container->getParameter('ace_editor.options.mode'),
];

$this->assertSame($expected, $result);
Expand Down
6 changes: 3 additions & 3 deletions tests/DependencyInjection/Compiler/TwigFormPassTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

declare(strict_types=1);

namespace Norzechowicz\AceEditorBundle\Tests\DependencyInjection\Compiler;
namespace AceEditorBundle\Tests\DependencyInjection\Compiler;

use Norzechowicz\AceEditorBundle\DependencyInjection\Compiler\TwigFormPass;
use AceEditorBundle\DependencyInjection\Compiler\TwigFormPass;
use PHPUnit\Framework\TestCase;
use Symfony\Component\Config\FileLocator;
use Symfony\Component\DependencyInjection\ContainerBuilder;
Expand Down Expand Up @@ -36,7 +36,7 @@ public function testProcessHasTwigFormResources(): void
$compiler->process($container);

$this->assertSame(
['@NorzechowiczAceEditor/Form/div_layout.html.twig', 'foo'],
['@NorbertTechSymfonyAceEditor/Form/div_layout.html.twig', 'foo'],
$container->getParameter('twig.form.resources')
);
}
Expand Down
4 changes: 2 additions & 2 deletions tests/DependencyInjection/ConfigurationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

declare(strict_types=1);

namespace Norzechowicz\AceEditorBundle\Tests\DependencyInjection;
namespace AceEditorBundle\Tests\DependencyInjection;

use Norzechowicz\AceEditorBundle\DependencyInjection\Configuration;
use AceEditorBundle\DependencyInjection\Configuration;
use PHPUnit\Framework\TestCase;
use Symfony\Component\Config\Definition\Processor;

Expand Down
4 changes: 2 additions & 2 deletions tests/Form/Extension/AceEditor/Type/AceEditorTypeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

declare(strict_types=1);

namespace Norzechowicz\AceEditorBundle\Tests\Form\Extension\AceEditor\Type;
namespace AceEditorBundle\Tests\Form\Extension\AceEditor\Type;

use Norzechowicz\AceEditorBundle\Form\Extension\AceEditor\Type\AceEditorType;
use AceEditorBundle\Form\Extension\AceEditor\Type\AceEditorType;
use PHPUnit\Framework\TestCase;
use Symfony\Component\Form\Extension\Core\Type\TextareaType;
use Symfony\Component\OptionsResolver\OptionsResolver;
Expand Down
4 changes: 2 additions & 2 deletions tests/Twig/Extension/AceEditorExtensionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

declare(strict_types=1);

namespace Norzechowicz\AceEditorBundle\Tests\Twig\Extension;
namespace AceEditorBundle\Tests\Twig\Extension;

use Norzechowicz\AceEditorBundle\Twig\Extension\AceEditorExtension;
use AceEditorBundle\Twig\Extension\AceEditorExtension;
use PHPUnit\Framework\MockObject\MockObject;
use PHPUnit\Framework\TestCase;
use Symfony\Bridge\Twig\Extension\AssetExtension;
Expand Down