Skip to content

3.11.0

Latest

Choose a tag to compare

@TavoNiievez TavoNiievez released this 04 Sep 08:45
53c37cc

What's Changed

20 new methods. No breaking changes, no new configuration options, no new traits.
PHP ^8.2 · Symfony 5.4 · 6.4 · 7.4 · 8.1

🗄️ Doctrine

Method
grabEntityManager() The EntityManager on the Actor, honouring em_service.
resetDoctrineManager() Reopens an EntityManager closed by a failed flush(). Clears it if still open.
seeDoctrineSchemaIsValid() In-process doctrine:schema:validate.
seeNumQueriesIsLessThan() N+1 guard.
dontSeeDuplicateQueries() N+1 guard.
$I->amOnPage('/register');
$I->resetDoctrineManager();
$I->seeNumRecords(1, User::class);

🧩 Services

Method
grabContainer() The test container — private services included.
mockService() / unmockService() Swap a service for a double. Survives kernel reboots.
$I->mockService('http_client', new MockHttpClient($responses));

🔐 Security

Method
seeUserIsGranted() / dontSeeUserIsGranted() Runs the app's voters — with a subject.
$I->seeUserIsGranted('EDIT', $post);

📨 Messenger

Note

Requires symfony/messenger >= 6.3.

Method
grabMessengerTransport() The in-memory transport itself.
seeMessengerTransportContains() A message class is queued.
seeMessengerQueueCount() Pending count — sent minus acknowledged or rejected.
consumeMessengerMessages() Handles queued envelopes in-process.
$I->seeMessengerQueueCount(1, 'async');
$I->consumeMessengerMessages('async');

🖥️ Console

Note

Requires Symfony 8.1. runSymfonyConsoleCommand() is unchanged and remains the path for earlier versions.

Method
runCommand() Returns an ExecutionResult: status code, stdout and stderr separately.
assertCommandIsSuccessful()
assertCommandFailed()
assertCommandIsInvalid()
assertCommandResultEquals()
$result = $I->runCommand('app:import', ['--dry-run' => true]);
$I->assertCommandIsSuccessful($result);

🔔 Session

Method
assertSessionHasFlashMessage() Non-destructive — reads the flash bag with peek().
$I->assertSessionHasFlashMessage('success', 'Your changes were saved.');

🛠️ Also

  • _getEntityManager() reopens a closed manager, so one failed write no longer cascades through the test.
  • Clearer failure when the em_service service is missing or is the wrong type.
  • Internal-domain lookup is now O(N) instead of O(N²).

#246 · #247 · #248 — Full changelog