refactor: explicitly boot Foundry in ResetDatabase#1049
refactor: explicitly boot Foundry in ResetDatabase#1049nikophil merged 1 commit intozenstruck:2.xfrom
Conversation
1b8495f to
a2a65d5
Compare
|
@HypeMC would this do the trick? |
|
@nikophil Thank you, I'll give it a try right away. |
| $kernel = $createKernel(); | ||
|
|
There was a problem hiding this comment.
@nikophil Unfortunately, this change sees to break the following case:
class SomeTest extends WebTestCase
{
use Factories;
use ResetDatabase;
public function testMyCode(): void
{
$client = self::createClient();
// ...
}LogicException: Booting the kernel before calling "Symfony\Bundle\FrameworkBundle\Test\WebTestCase::createClient()" is not supported, the kernel should only be booted once.
There was a problem hiding this comment.
Damn... I'll add this use case to our test suite right now! A test using WebTestCase already exists, but it does not use ResetDatabase trait
There was a problem hiding this comment.
@HypeMC mind to test this new version, please?
I added a test to ensure ResetDatabase does not mess with self::createClient()
There was a problem hiding this comment.
@nikophil Sadly, this reintroduces the original issue:
Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException: The "kernel" service is synthetic, it needs to be set at boot time before it can be used.
There was a problem hiding this comment.
but the test you introduced in #993 is still green, we'll have to figure out why, I guess
There was a problem hiding this comment.
I'll look into it tonight, and try to figure it out.
There was a problem hiding this comment.
super nice, thanks. Sorry to come back on this stuff but this would unlock an easy way to integrate Foundry with Behat, which is one of the next things I'd like to see in foundry
There was a problem hiding this comment.
@nikophil Apologies for the late response, I couldn't find the time yesterday. Long story short, one test failed because it didn't use Factories. Once that was added, everything passed. So this fix is actually good. Thank you for investigating this and sorry for the false alert.
There was a problem hiding this comment.
ok thanks, this is very nice.
This kind of problem won't exist anymore once we have deprecated Factories trait 😄
a2a65d5 to
0c44b18
Compare
0c44b18 to
f286f3a
Compare
related to #1034