New Gozer tests, exposed methods for public usage (mainly for testing)

This commit is contained in:
Ismo Vuorinen
2017-08-27 19:04:42 +03:00
parent 3e9d7e8b06
commit 8aa4639b04
2 changed files with 59 additions and 9 deletions

View File

@@ -60,9 +60,7 @@ class Gozer extends Command
');
$tables = [];
$this->dbPrefix = $this->getDatabasePrefix();
$this->setDatabasePrefix($this->getDatabasePrefix());
$confirmationQuestion = 'Delete all of your database tables?';
if (!empty($this->dbPrefix)) {
@@ -139,7 +137,7 @@ class Gozer extends Command
/**
* @return bool|\Doctrine\DBAL\Schema\AbstractSchemaManager
*/
private function getConnection()
public function getConnection()
{
try {
/** @var \Doctrine\DBAL\Schema\AbstractSchemaManager $connection */
@@ -158,7 +156,7 @@ class Gozer extends Command
*
* @return array|bool
*/
private function getTables(\Doctrine\DBAL\Schema\AbstractSchemaManager $connection)
public function getTables(\Doctrine\DBAL\Schema\AbstractSchemaManager $connection)
{
try {
/** @var array $tables */
@@ -172,17 +170,27 @@ class Gozer extends Command
return $tables;
}
private function getDatabasePrefix()
public function getDatabasePrefix()
{
return trim(DB::getTablePrefix());
}
/**
* This is mainly for testing purposes
*
* @param string $prefix
*/
public function setDatabasePrefix($prefix = '')
{
$this->dbPrefix = $prefix;
}
/**
* @param array $tables
*
* @return \Illuminate\Support\Collection
*/
private function getFilteredTables($tables = [])
public function getFilteredTables($tables = [])
{
$prefix = $this->dbPrefix;