Skip to content

Add #[SkipStaticDatabaseConnection] attribute#339

Merged
dmaicher merged 1 commit into
masterfrom
add_skip_attribute
Jan 18, 2026
Merged

Add #[SkipStaticDatabaseConnection] attribute#339
dmaicher merged 1 commit into
masterfrom
add_skip_attribute

Conversation

@dmaicher
Copy link
Copy Markdown
Owner

@dmaicher dmaicher commented Dec 30, 2025

Allows to skip the transactional database connection logic for individual tests by adding #[SkipStaticDatabaseConnection] to a test class or method.

Closes #182

Todos:

  • test on real app(s)
  • is SkipStaticDatabaseConnection a good name for the attribute?
  • add to readme

@dmaicher dmaicher force-pushed the add_skip_attribute branch 5 times, most recently from 196a006 to 46a62fd Compare December 30, 2025 21:49
@ram-fabian-heinrich
Copy link
Copy Markdown

I have successfully tested the attribute in one application by requiring this branch via Composer:

composer require --dev dama/doctrine-test-bundle dev-add_skip_attribute

My application uses PantherTestCase together with Foundry as follows:

#[SkipStaticDatabaseConnection]
class MyPantherTest extends PantherTestCase
{
    use ResetDatabase;
    ...
}

The attribute works as expected for me on both classes and methods.

@dmaicher dmaicher marked this pull request as ready for review January 18, 2026 09:28
@dmaicher dmaicher merged commit 1c1a500 into master Jan 18, 2026
7 checks passed
@dmaicher dmaicher deleted the add_skip_attribute branch January 18, 2026 09:29
@VincentLanglet
Copy link
Copy Markdown

Since the methods are skipTransaction why not something translation related in the name of the attribute ?

@dmaicher
Copy link
Copy Markdown
Owner Author

dmaicher commented Jan 18, 2026

Since the methods are skipTransaction why not something translation related in the name of the attribute ?

What would you suggest? SkipDatabaseTransaction? SkipTransaction?

I released it already but chances are low someone used it already. So I could still rename it. I don't have any strong opinion on the name 🤷‍♂️

edit: removed the release for now. So we can discuss it further.

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.

Trait or annotation to disable DAMA in some files

3 participants