Skip to content

Commit

Permalink
Added test not to overwrite config file
Browse files Browse the repository at this point in the history
  • Loading branch information
ItsMurumba committed Mar 2, 2023
1 parent ecad06b commit ac1169d
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions tests/Unit/InstallHostpinnaclePackageTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,27 @@ public function the_install_command_copies_the_configuration()

$this->assertTrue(File::exists(config_path('hostpinnacle.php')));
}

/**
*
*
* @return void
*/
public function when_a_config_file_is_present_users_can_choose_not_to_overwrite_it()
{
File::put(config_path('hostpinnacle.php'), 'test contents');
$this->assertTrue(File::exists(config_path('hostpinnacle.php')));

$command = $this->artisan('hostpinnacle:install');

$command->expectsConfirmation(
'Config file already exists. Do you want to overwrite it?',
'no'
);

$command->expectsOutput('Exiting. Hostpinnacle configuration was not overwritten');
$this->assertEquals('test contents', file_get_contents(config_path('hostpinnacle.php')));

unlink(config_path('hostpinnacle.php'));
}
}

0 comments on commit ac1169d

Please sign in to comment.