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

Allow kernel configuration via attributes #11

Merged
merged 1 commit into from
Mar 19, 2024

Conversation

jdreesen
Copy link
Member

This is a followup of #8 and improves it by adding attributes that allow to configure the kernel instead of passing a closure to createKernel().

use Neusta\Pimcore\TestingFramework\Test\Attribute\ConfigureContainer;
use Neusta\Pimcore\TestingFramework\Test\Attribute\ConfigureExtension;
use Neusta\Pimcore\TestingFramework\Test\Attribute\RegisterBundle;
use Neusta\Pimcore\TestingFramework\Test\Attribute\RegisterCompilerPass;
use Neusta\Pimcore\TestingFramework\Test\ConfigurableKernelTestCase;

#[RegisterBundle(SomeBundle::class)]
class SomeTest extends ConfigurableKernelTestCase 
{
    #[ConfigureContainer(__DIR__ . '/Fixtures/some_config.yaml')]
    #[ConfigureExtension('some_extension', ['config' => 'values'])]
    #[RegisterCompilerPass(new SomeCompilerPass())]
    public function test_something(): void
    {
        self::bootKernel();

        // test something
    }
}

All attributes are usable on the class and test methods.

@jdreesen jdreesen force-pushed the configurable-kernel-via-attributes branch from c10f76c to 4873a54 Compare March 19, 2024 15:09
@jdreesen jdreesen merged commit 8782d66 into main Mar 19, 2024
4 checks passed
@jdreesen jdreesen deleted the configurable-kernel-via-attributes branch March 19, 2024 17:42
Copy link
Member

@yariksheptykin yariksheptykin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a great feature. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants