-
Notifications
You must be signed in to change notification settings - Fork 62
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
Trait or annotation to disable DAMA in some files #182
Comments
Feel free to look into it 👍 A workaround might be something like this (not tested): use DAMA\DoctrineTestBundle\Doctrine\DBAL\StaticDriver;
use PHPUnit\Framework\TestCase;
class MyTestWithoutDAMATransactionManagement extends TestCase
{
public static function setUpBeforeClass(): void
{
StaticDriver::setKeepStaticConnections(false);
}
public static function tearDownAfterClass(): void
{
StaticDriver::setKeepStaticConnections(true);
}
// your tests
} |
It seems to work ! Thank you very much ! |
I also recently had a use-case for this on one of my apps. I looked into it a bit and with the current PHPUnit Extensions this seems rather complicated to achieve as we don't have access to much in the Hooks. I would wait for the new PHPUnit 10 event system to achieve this. |
Awesome ! I can not wait to see it. I was a bit disturbed because with your fallback method we get a warning on each of the tests, because the AbstractStaticDriver is supposed to be internal |
That's a feature that would be also useful for me!!!! But don't forget here to call UpdateSolution works only in isolation of that class. Test-classes executed after |
My PR having been rejected by @dmaicher for reasons I totally understand, I'm now using a custom phpunit extension built on top of doctrine-test-bundle. If you need this, you may do the same: https://github.com/chriskaya/custom-dama-extension/blob/main/CustomDamaExtension.php BTW, thx @dmaicher for your work :) |
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
Just stumbled upon this by googling around – this should be mentioned in the doc IMO :) |
Hello, I am using DAMA for my tests.
This is useful for some tests, but not for End to End tests, since it does not support it.
But it gives me bugs because DAMA still manages to rollback certain transactions in the middle of my EndToEnd tests (those requiring that I initialize a record in the database. DAMA rollback directly)
It would be nice to have a trait or something that allows us to say in some files to disable DAMA support.
It forces me to create all the entities I need upstream, that's not cool
I found the previous issue : #171 but it doesn't seem to suit what i want
The text was updated successfully, but these errors were encountered: