-
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.
Merge pull request #5 from 21TORR/next
Add proper autogeneration of aliases in `BundleExtension`
- Loading branch information
Showing
8 changed files
with
120 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,9 @@ | ||
2.1.0 | ||
===== | ||
|
||
* (feature) Add proper autogeneration of aliases in `BundleExtension`. | ||
|
||
|
||
2.0.0 | ||
===== | ||
|
||
|
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,26 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd" | ||
colors="true" | ||
bootstrap="vendor/autoload.php" | ||
> | ||
<php> | ||
<ini name="error_reporting" value="-1" /> | ||
<server name="APP_ENV" value="test" force="true" /> | ||
<server name="SHELL_VERBOSITY" value="-1" /> | ||
<server name="SYMFONY_PHPUNIT_REMOVE" value="" /> | ||
<server name="SYMFONY_PHPUNIT_VERSION" value="9.3" /> | ||
<env name="SYMFONY_DEPRECATIONS_HELPER" value="max[direct]=0"/> | ||
</php> | ||
|
||
<testsuites> | ||
<testsuite name="Bundle tests"> | ||
<directory>tests</directory> | ||
<exclude>tests/fixtures</exclude> | ||
</testsuite> | ||
</testsuites> | ||
|
||
<listeners> | ||
<listener class="Symfony\Bridge\PhpUnit\SymfonyTestsListener" /> | ||
</listeners> | ||
</phpunit> |
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,7 @@ | ||
<?php declare(strict_types=1); | ||
|
||
namespace Torr\BundleHelpers\Exception; | ||
|
||
final class BundleHelpersException extends \Exception | ||
{ | ||
} |
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,36 @@ | ||
<?php declare(strict_types=1); | ||
|
||
namespace Tests\Torr\BundleHelpers\Bundle; | ||
|
||
use PHPUnit\Framework\TestCase; | ||
use Tests\Torr\BundleHelpers\Fixtures\ExampleBundle; | ||
use Tests\Torr\BundleHelpers\Fixtures\OtherExample; | ||
use Torr\BundleHelpers\Bundle\BundleExtension; | ||
use Torr\BundleHelpers\Exception\BundleHelpersException; | ||
|
||
final class BundleExtensionTest extends TestCase | ||
{ | ||
/** | ||
* | ||
*/ | ||
public function testAliasGeneration () : void | ||
{ | ||
$extension = new BundleExtension(new ExampleBundle()); | ||
$extensionOverwritten = new BundleExtension(new ExampleBundle(), "overwritten"); | ||
|
||
self::assertSame("example", $extension->getAlias()); | ||
self::assertSame("overwritten", $extensionOverwritten->getAlias()); | ||
} | ||
|
||
/** | ||
* | ||
*/ | ||
public function testInvalidAliasGeneration () : void | ||
{ | ||
$this->expectException(BundleHelpersException::class); | ||
$this->expectExceptionMessage("The bundle does not follow the naming convention; you must pass an explicit alias."); | ||
|
||
$extension = new BundleExtension(new OtherExample()); | ||
$extension->getAlias(); | ||
} | ||
} |
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,9 @@ | ||
<?php declare(strict_types=1); | ||
|
||
namespace Tests\Torr\BundleHelpers\Fixtures; | ||
|
||
use Symfony\Component\HttpKernel\Bundle\Bundle; | ||
|
||
final class ExampleBundle extends Bundle | ||
{ | ||
} |
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,12 @@ | ||
<?php declare(strict_types=1); | ||
|
||
namespace Tests\Torr\BundleHelpers\Fixtures; | ||
|
||
use Symfony\Component\HttpKernel\Bundle\Bundle; | ||
|
||
/** | ||
* Should specifically not end in "bundle" | ||
*/ | ||
final class OtherExample extends Bundle | ||
{ | ||
} |