-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
111 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
tests/DependencyInjection/AbstractSonataAdminExtensionTest.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
/* | ||
* This file is part of the Sonata Project package. | ||
* | ||
* (c) Thomas Rabaix <[email protected]> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace Sonata\AdminBundle\Tests\DependencyInjection; | ||
|
||
use PHPUnit\Framework\TestCase; | ||
use Sonata\AdminBundle\DependencyInjection\SonataAdminExtension; | ||
use Sonata\AdminBundle\Tests\Fixtures\DependencyInjection\DummySonataAdminExtension; | ||
use Symfony\Component\DependencyInjection\ContainerBuilder; | ||
|
||
class AbstractSonataAdminExtensionTest extends TestCase | ||
{ | ||
public function testLoadIntlTemplatesInOtherSonataAdminExtensions(): void | ||
{ | ||
$container = new ContainerBuilder(); | ||
$container->setParameter('kernel.bundles', []); | ||
$container->prependExtensionConfig('sonata_admin', ['use_intl_templates' => true]); | ||
$extension = new SonataAdminExtension(); | ||
$dummyExtension = new DummySonataAdminExtension(); | ||
$container->registerExtension($dummyExtension); | ||
$extension->prepend($container); | ||
$container->registerExtension($extension); | ||
$dummyExtension->load([], $container); | ||
|
||
$this->assertSame('@SonataAdmin/CRUD/Intl/list_date.html.twig', $dummyExtension->configs[0]['templates']['types']['list']['date']); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
tests/Fixtures/DependencyInjection/DummySonataAdminExtension.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
/* | ||
* This file is part of the Sonata Project package. | ||
* | ||
* (c) Thomas Rabaix <[email protected]> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace Sonata\AdminBundle\Tests\Fixtures\DependencyInjection; | ||
|
||
use Sonata\AdminBundle\DependencyInjection\AbstractSonataAdminExtension; | ||
use Symfony\Component\DependencyInjection\ContainerBuilder; | ||
|
||
class DummySonataAdminExtension extends AbstractSonataAdminExtension | ||
{ | ||
/** | ||
* @var array | ||
*/ | ||
public $configs; | ||
|
||
/** | ||
* @inheritDoc | ||
*/ | ||
public function load(array $configs, ContainerBuilder $container) | ||
{ | ||
$this->configs = $this->fixTemplatesConfiguration($configs, $container); | ||
} | ||
} |