-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
NGSTACK-816 add tests for configuration
- Loading branch information
1 parent
e7be506
commit 41ae780
Showing
3 changed files
with
102 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" colors="true" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.5/phpunit.xsd" cacheDirectory=".phpunit.cache"> | ||
<testsuites> | ||
<testsuite name="Dependency injection unit tests"> | ||
<directory suffix="Test.php">./tests/bundle/DependencyInjection</directory> | ||
</testsuite> | ||
</testsuites> | ||
</phpunit> |
83 changes: 83 additions & 0 deletions
83
tests/bundle/DependencyInjection/NetgenIbexaAdminUIExtraTest.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,83 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Netgen\IbexaAdminUIExtra\Tests\DependencyInjection; | ||
|
||
use Matthias\SymfonyDependencyInjectionTest\PhpUnit\AbstractExtensionTestCase; | ||
use Netgen\Bundle\IbexaAdminUIExtraBundle\DependencyInjection\NetgenIbexaAdminUIExtraExtension; | ||
|
||
final class NetgenIbexaAdminUIExtraTest extends AbstractExtensionTestCase | ||
{ | ||
protected function setUp(): void | ||
{ | ||
parent::setUp(); | ||
|
||
$this->setParameter('kernel.bundles', []); | ||
} | ||
|
||
public static function provideDefaultConfigurationCases(): iterable | ||
{ | ||
return [ | ||
[ | ||
[], | ||
], | ||
[ | ||
[ | ||
'show_external_siteaccess_urls' => false, | ||
], | ||
], | ||
]; | ||
} | ||
|
||
public static function provideShowExternalSiteaccessUrlsConfigurationCases(): iterable | ||
{ | ||
return [ | ||
[ | ||
[ | ||
'show_external_siteaccess_urls' => false, | ||
], | ||
false, | ||
], | ||
[ | ||
[ | ||
'show_external_siteaccess_urls' => true, | ||
], | ||
true, | ||
], | ||
]; | ||
} | ||
|
||
/** | ||
* @dataProvider provideDefaultConfigurationCases | ||
*/ | ||
public function testDefaultConfiguration(array $configuration): void | ||
{ | ||
$this->load($configuration); | ||
|
||
$this->assertContainerBuilderHasParameter( | ||
'netgen_ibexa_admin_ui_extra.show_external_siteaccess_urls', | ||
false, | ||
); | ||
} | ||
|
||
/** | ||
* @dataProvider provideShowExternalSiteaccessUrlsConfigurationCases | ||
*/ | ||
public function testShowExternalSiteaccessUrlsConfiguration(array $configuration, bool $expectedParameterValue): void | ||
{ | ||
$this->load($configuration); | ||
|
||
$this->assertContainerBuilderHasParameter( | ||
'netgen_ibexa_admin_ui_extra.show_external_siteaccess_urls', | ||
$expectedParameterValue, | ||
); | ||
} | ||
|
||
protected function getContainerExtensions(): array | ||
{ | ||
return [ | ||
new NetgenIbexaAdminUIExtraExtension(), | ||
]; | ||
} | ||
} |