Skip to content

Instantly share code, notes, and snippets.

@lstrojny
Created March 22, 2020 16:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lstrojny/a8675b47cc182101e088057ce8962122 to your computer and use it in GitHub Desktop.
Save lstrojny/a8675b47cc182101e088057ce8962122 to your computer and use it in GitHub Desktop.
SF functional test example
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();
}
@lstrojny
Copy link
Author

ServiceResetter during Kernel boot will clear the EM no matter what, so not too much one can do

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment