- prepare the project files structure
mkdir coding_test
cd coding_test
mkdir src tests
touch composer.json
- update the
composer.jsonwith the following content:
// sample code in test cases to reset/truncate all test tables
$connection = static::$entityManager->getConnection();
$platform = $connection->getDatabasePlatform();
foreach (self::getMetadataOfClasses() as $classMetadata) {
$truncateSql = $platform->getTruncateTableSql($classMetadata->getTableName());
$connection->executeUpdate($truncateSql);
}