-
Notifications
You must be signed in to change notification settings - Fork 56
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Console test && empty function (#54)
- Loading branch information
Showing
15 changed files
with
166 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,7 @@ php: | |
- 7.1 | ||
- 7.2 | ||
- 7.3 | ||
- 7.4 | ||
|
||
before_script: | ||
- composer selfupdate | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
<?php | ||
|
||
namespace Glorand\Model\Settings\Tests; | ||
|
||
class CreateSettingsFieldForModelConsoleTest extends TestCase | ||
{ | ||
private $table = 'users_with_field'; | ||
private $fieldName = 'custom_settings_field'; | ||
private $alreadyExistsFieldName = 'settings'; | ||
|
||
public function testEmptyTable() | ||
{ | ||
$this->artisan('model-settings:model-settings-field') | ||
->expectsQuestion('What is the name of the table?', '') | ||
->assertExitCode(1); | ||
} | ||
|
||
public function testMissingTable() | ||
{ | ||
$this->artisan('model-settings:model-settings-field') | ||
->expectsQuestion('What is the name of the table?', $this->table . '_wrong') | ||
->assertExitCode(2); | ||
} | ||
|
||
public function testAlreadyExistsField() | ||
{ | ||
$this->artisan('model-settings:model-settings-field') | ||
->expectsQuestion('What is the name of the table?', $this->table) | ||
->expectsQuestion('What is the name of the settings field name?', $this->alreadyExistsFieldName) | ||
->assertExitCode(3); | ||
} | ||
|
||
public function testCreateMigrationFile() | ||
{ | ||
$this->artisan('model-settings:model-settings-field') | ||
->expectsQuestion('What is the name of the table?', $this->table) | ||
->expectsQuestion('What is the name of the settings field name?', $this->fieldName) | ||
->assertExitCode(0); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
<?php | ||
|
||
namespace Glorand\Model\Settings\Tests; | ||
|
||
use Illuminate\Support\Facades\Schema; | ||
|
||
class CreateSettingsTableConsoleTest extends TestCase | ||
{ | ||
public function testEmptyTable() | ||
{ | ||
config()->set('model_settings.settings_table_name', null); | ||
$this->assertEquals(null, config('model_settings.settings_table_name')); | ||
$this->artisan('model-settings:model-settings-table') | ||
->assertExitCode(1); | ||
} | ||
|
||
public function testAlreadyExistsTable() | ||
{ | ||
config()->set('model_settings.settings_table_name', 'model_settings'); | ||
$this->artisan('model-settings:model-settings-table') | ||
->assertExitCode(2); | ||
} | ||
|
||
public function testCreateMigration() | ||
{ | ||
config()->set('model_settings.settings_table_name', 'model_settings'); | ||
Schema::dropIfExists(config('model_settings.settings_table_name')); | ||
$this->artisan('model-settings:model-settings-table') | ||
->assertExitCode(0); | ||
} | ||
|
||
public function testWithUpdateConfig() | ||
{ | ||
$this->assertEquals('model_settings', config('model_settings.settings_table_name')); | ||
$newTableName = 'custom_table_settings'; | ||
config()->set('model_settings.settings_table_name', $newTableName); | ||
$this->assertEquals($newTableName, config('model_settings.settings_table_name')); | ||
Schema::dropIfExists($newTableName); | ||
$this->artisan('model-settings:model-settings-table') | ||
->assertExitCode(0); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters