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 manual operations on static connections #203

Closed
wants to merge 1 commit into from
Closed

Allow manual operations on static connections #203

wants to merge 1 commit into from

Conversation

chriskaya
Copy link

These small changes allow me to handle specific cases like dependent tests (#151 ), or disabling DAMA for a specific class (#182 )

Here's how I use it:

public static function setUpBeforeClass(): void
{
    StaticDriver::setManualOperations(true);
    StaticDriver::beginTransaction();
}

public static function tearDownAfterClass(): void
{
    StaticDriver::rollBack();
    StaticDriver::setManualOperations(false);
}

But it could also be used just for a few tests, like this:

public function testOne(): void
{
    StaticDriver::setManualOperations(true);

    $this->assertTrue(false);
}

/**
 * @depends testOne
 */
public function testTwo(): void
{
    // ...

    StaticDriver::setManualOperations(false);
}

@dmaicher
Copy link
Owner

I would like to not change the public API of StaticDriver yet as there might be some changes coming anyway when trying to have an annotation with PHPUnit 10 to selectively disable it as mentioned here.

I guess for now if you need this feature you can create your own PHPUnit extension and not use the one provided by this bundle.

Thanks anyway for taking the time to look into it 👍

@dmaicher dmaicher closed this Feb 16, 2022
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.

2 participants