-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rename "Test\Attribute\KernelConfiguration" to "Attribute\ConfigureKe…
…rnel" and move its implementations from "Test\Attribute\" to "Attribute\Kernel\"
- Loading branch information
Showing
19 changed files
with
225 additions
and
84 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
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,11 @@ | ||
<?php | ||
declare(strict_types=1); | ||
|
||
namespace Neusta\Pimcore\TestingFramework\Attribute; | ||
|
||
use Neusta\Pimcore\TestingFramework\TestKernel; | ||
|
||
interface ConfigureKernel | ||
{ | ||
public function configure(TestKernel $kernel): void; | ||
} |
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,25 @@ | ||
<?php | ||
declare(strict_types=1); | ||
|
||
namespace Neusta\Pimcore\TestingFramework\Attribute\Kernel; | ||
|
||
use Neusta\Pimcore\TestingFramework\Attribute\ConfigureKernel; | ||
use Neusta\Pimcore\TestingFramework\TestKernel; | ||
use Symfony\Component\DependencyInjection\ContainerBuilder; | ||
|
||
#[\Attribute(\Attribute::TARGET_CLASS | \Attribute::TARGET_METHOD | \Attribute::IS_REPEATABLE)] | ||
final class ConfigureContainer implements ConfigureKernel | ||
{ | ||
/** | ||
* @param string|\Closure(ContainerBuilder):void $config path to a config file or a closure which gets the {@see ContainerBuilder} as its first argument | ||
*/ | ||
public function __construct( | ||
private readonly string|\Closure $config, | ||
) { | ||
} | ||
|
||
public function configure(TestKernel $kernel): void | ||
{ | ||
$kernel->addTestConfig($this->config); | ||
} | ||
} |
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,25 @@ | ||
<?php | ||
declare(strict_types=1); | ||
|
||
namespace Neusta\Pimcore\TestingFramework\Attribute\Kernel; | ||
|
||
use Neusta\Pimcore\TestingFramework\Attribute\ConfigureKernel; | ||
use Neusta\Pimcore\TestingFramework\TestKernel; | ||
|
||
#[\Attribute(\Attribute::TARGET_CLASS | \Attribute::TARGET_METHOD | \Attribute::IS_REPEATABLE)] | ||
final class ConfigureExtension implements ConfigureKernel | ||
{ | ||
/** | ||
* @param array<string, mixed> $extensionConfig | ||
*/ | ||
public function __construct( | ||
private readonly string $namespace, | ||
private readonly array $extensionConfig, | ||
) { | ||
} | ||
|
||
public function configure(TestKernel $kernel): void | ||
{ | ||
$kernel->addTestExtensionConfig($this->namespace, $this->extensionConfig); | ||
} | ||
} |
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,25 @@ | ||
<?php | ||
declare(strict_types=1); | ||
|
||
namespace Neusta\Pimcore\TestingFramework\Attribute\Kernel; | ||
|
||
use Neusta\Pimcore\TestingFramework\Attribute\ConfigureKernel; | ||
use Neusta\Pimcore\TestingFramework\TestKernel; | ||
use Symfony\Component\HttpKernel\Bundle\BundleInterface; | ||
|
||
#[\Attribute(\Attribute::TARGET_CLASS | \Attribute::TARGET_METHOD | \Attribute::IS_REPEATABLE)] | ||
final class RegisterBundle implements ConfigureKernel | ||
{ | ||
/** | ||
* @param class-string<BundleInterface> $bundle | ||
*/ | ||
public function __construct( | ||
private readonly string $bundle, | ||
) { | ||
} | ||
|
||
public function configure(TestKernel $kernel): void | ||
{ | ||
$kernel->addTestBundle($this->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,28 @@ | ||
<?php | ||
declare(strict_types=1); | ||
|
||
namespace Neusta\Pimcore\TestingFramework\Attribute\Kernel; | ||
|
||
use Neusta\Pimcore\TestingFramework\Attribute\ConfigureKernel; | ||
use Neusta\Pimcore\TestingFramework\TestKernel; | ||
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface; | ||
use Symfony\Component\DependencyInjection\Compiler\PassConfig; | ||
|
||
#[\Attribute(\Attribute::TARGET_CLASS | \Attribute::TARGET_METHOD | \Attribute::IS_REPEATABLE)] | ||
final class RegisterCompilerPass implements ConfigureKernel | ||
{ | ||
/** | ||
* @param PassConfig::TYPE_* $type | ||
*/ | ||
public function __construct( | ||
private readonly CompilerPassInterface $compilerPass, | ||
private readonly string $type = PassConfig::TYPE_BEFORE_OPTIMIZATION, | ||
private readonly int $priority = 0, | ||
) { | ||
} | ||
|
||
public function configure(TestKernel $kernel): void | ||
{ | ||
$kernel->addTestCompilerPass($this->compilerPass, $this->type, $this->priority); | ||
} | ||
} |
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
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
Oops, something went wrong.