$this->loadFixtures([LoadUserData::class]); $user = $this->getReference(LoadUserData::USER);
In order to refresh database just use RefreshDatabase trait. This trait will create the database schema on test setUp and purge it on tearDown.
use Gricob\SymfonyWebTestBundle\Testing\RefreshDatabase; class FunctionalTest extends WebTestCase { use RefreshDatabase; }
Assert that an entity in the database contains the given data.
$this->assertDatabaseHas(User::class, ['username' => 'john']);
Assert that an entity in the database does not contain the given data.
$this->assertDatabaseMissing(User::class, ['username' => 'john']);
There was an error while loading. Please reload this page.
Documentation