forked from hirethunk/verbs
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make Verbs Table Name Configurable (hirethunk#77)
* Make Verbs Table Name Configurable * Change Models/{MODEL} setTable() to Public * Create ConfigurableTableNamesTest * Fixed setTable Implementation * Fixed $expected_table_name * Set getTable() * Added Test Cases for Customized Table Names * Refactored and Simplified setTable in Models and Test * Refactor * Extract out a function --------- Co-authored-by: Chris Morrell <[email protected]>
- Loading branch information
Showing
8 changed files
with
116 additions
and
12 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
<?php | ||
|
||
use Thunk\Verbs\Models\VerbEvent; | ||
use Thunk\Verbs\Models\VerbSnapshot; | ||
use Thunk\Verbs\Models\VerbStateEvent; | ||
|
||
test('VerbEvent table name can be configured', function () { | ||
$expected_table_name = 'verb_events'; | ||
|
||
$verb_model = new VerbEvent(); | ||
$actual_table_name = $verb_model->getTable(); | ||
|
||
expect($expected_table_name)->toBe($actual_table_name); | ||
}); | ||
|
||
test('VerbEvent table name can be configured with different table name', function () { | ||
$expected_table_name = 'sys_verb_events'; | ||
|
||
config()->set('verbs.tables.events', $expected_table_name); | ||
|
||
$verb_model = new VerbEvent(); | ||
$actual_table_name = $verb_model->getTable(); | ||
|
||
expect($expected_table_name)->toBe($actual_table_name); | ||
}); | ||
|
||
test('VerbSnapshot table name can be configured', function () { | ||
$expected_table_name = 'verb_snapshots'; | ||
|
||
$verb_model = new VerbSnapshot(); | ||
$actual_table_name = $verb_model->getTable(); | ||
|
||
expect($expected_table_name)->toBe($actual_table_name); | ||
}); | ||
|
||
test('VerbSnapshot table name can be configured with different table name', function () { | ||
$expected_table_name = 'sys_verb_snapshots'; | ||
|
||
config(['verbs.tables.snapshots' => $expected_table_name]); | ||
|
||
$verb_model = new VerbSnapshot(); | ||
$actual_table_name = $verb_model->getTable(); | ||
|
||
expect($expected_table_name)->toBe($actual_table_name); | ||
}); | ||
|
||
test('VerbStateEvent table name can be configured', function () { | ||
$expected_table_name = 'verb_state_events'; | ||
|
||
$verb_model = new VerbStateEvent(); | ||
$actual_table_name = $verb_model->getTable(); | ||
|
||
expect($expected_table_name)->toBe($actual_table_name); | ||
}); | ||
|
||
test('VerbStateEvent table name can be configured with different table name', function () { | ||
$expected_table_name = 'sys_verb_state_events'; | ||
|
||
config(['verbs.tables.state_events' => $expected_table_name]); | ||
|
||
$verb_model = new VerbStateEvent(); | ||
$actual_table_name = $verb_model->getTable(); | ||
|
||
expect($expected_table_name)->toBe($actual_table_name); | ||
}); |