Created
March 22, 2020 16:52
-
-
Save lstrojny/a8675b47cc182101e088057ce8962122 to your computer and use it in GitHub Desktop.
SF functional test example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public function testSomething(): void | |
{ | |
$client = static::createClient(); | |
$entity = self::$container->get('em')->find(…, 1); | |
$entity->setState(1); | |
self::$container->get('em')->persist($entity); | |
self::$container->get('em')->flush(); | |
$client->request(…, …); | |
$entity->setState(2); | |
self::$container->get('em')->persist($entity); | |
self::$container->get('em')->persist($entity); | |
// Boom | |
self::$container->get('em')->flush(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
ServiceResetter
during Kernel boot will clear the EM no matter what, so not too much one can do