File tree Expand file tree Collapse file tree
tests/WebFiori/Framework/Tests/Cli Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2020 * @author Ibrahim
2121 */
2222class IntegrationAllCommandsTest extends CLITestCase {
23+
24+ private function cleanupTestFiles () {
25+ $ cleanupPaths = [
26+ APP_PATH . 'Database ' . DIRECTORY_SEPARATOR . 'Migrations ' . DIRECTORY_SEPARATOR . 'CreateUsersTable*.php ' ,
27+ APP_PATH . 'Database ' . DIRECTORY_SEPARATOR . 'Seeders ' . DIRECTORY_SEPARATOR . 'SeedUsers*.php ' ,
28+ APP_PATH . 'Infrastructure ' . DIRECTORY_SEPARATOR . 'Schema ' . DIRECTORY_SEPARATOR . 'TestTable*.php ' ,
29+ APP_PATH . 'Domain ' . DIRECTORY_SEPARATOR . 'UserEntity*.php ' ,
30+ APP_PATH . 'Infrastructure ' . DIRECTORY_SEPARATOR . 'Repository ' . DIRECTORY_SEPARATOR . 'TestRepo*.php ' ,
31+ APP_PATH . 'Apis ' . DIRECTORY_SEPARATOR . 'Test*Service.php '
32+ ];
33+
34+ foreach ($ cleanupPaths as $ pattern ) {
35+ foreach (glob ($ pattern ) as $ file ) {
36+ unlink ($ file );
37+ }
38+ }
39+ }
40+
2341 /**
2442 * @test
2543 */
2644 public function testAddDBConnection00 () {
45+ // Clean up any leftover migration/seeder files from previous test runs
46+ $ this ->cleanupTestFiles ();
47+
2748 //Step 1: Add DB Connection
2849 $ connName = 'db-connection- ' .(count (App::getConfig ()->getDBConnections ()) + 1 );
2950 $ output = $ this ->executeSingleCommand (new AddDbConnectionCommand (), [], [
You can’t perform that action at this time.
0 commit comments