Is there a standard way to clear your database before (or after) each test when testing with Symfony2 / PHPUnit? There seems to be a standard, obvious way to do this in Rails, but I have not found an analogue in the Symfony community.
You can clear the tables with Doctrine data purger or rebuild the schema before each test.
Purger is included in the data package: https://github.com/doctrine/data-fixtures
I once wrote KernelAwareTest, which rebuilds the circuit before each test: https://gist.github.com/1319290
If you use the LiipFunctionalTestBundle , the database is cleared every time the fixtures are loaded. If you do not need any loadable appliances, you can still call $this->loadFixtures(array()); ("download without attachments") to clear the database.
$this->loadFixtures(array());
Source: https://habr.com/ru/post/1434942/More articles:Net :: SMTPAuthenticationError (530 5.7.0 The STARTTLS command should be executed first - ruby-on-rails-3.2Uploading a file to the server and saving the path to the database in Ruby on Rails - ruby | fooobar.comHow to crop a section of a PDF file into PNG using Ghostscript - phpGlobal template data - goProject + for nbactions.xml developers? - gitImport module with name similar to grandparent package - pythonGetting output to win the console when throwing an exception containing a unicode literal (u "\ u0410") - pythonjQuery mobile: applying style after reloading content - javascriptConvert tuple to string - pythonWhy can't I lazily initialize a static long array like this in java? - javaAll Articles