Skip to content

Commit

Permalink
fix: incorrect default prefix class name
Browse files Browse the repository at this point in the history
  • Loading branch information
bensherred committed Nov 28, 2023
1 parent f6e16d7 commit bf82c01
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion config/sqids.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,6 @@
|
*/

'prefix_class' => \RedExplosion\Sqids\Prefixes\ConstantPrefix::class,
'prefix_class' => \RedExplosion\Sqids\Prefixes\ConsonantPrefix::class,

];
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@
use Illuminate\Support\Str;
use RedExplosion\Sqids\Contracts\Prefix;

class ConstantPrefix implements Prefix
class ConsonantPrefix implements Prefix
{
/**
* Use the first 3 constants as the model prefix.
* Use the first 3 consonants as the model prefix.
*
* @param class-string<Model> $model
* @return string
Expand Down
4 changes: 2 additions & 2 deletions tests/Prefixes/ConstantPrefixTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@

declare(strict_types=1);

use RedExplosion\Sqids\Prefixes\ConstantPrefix;
use RedExplosion\Sqids\Prefixes\ConsonantPrefix;
use Workbench\App\Models\Charge;
use Workbench\App\Models\Customer;

it(description: 'can generate a prefix without vowels', closure: function (): void {
expect(new ConstantPrefix())
expect(new ConsonantPrefix())
->prefix(model: Customer::class)
->toBe(expected: 'cst')
->prefix(model: Charge::class)
Expand Down
4 changes: 2 additions & 2 deletions tests/Support/ConfigTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types=1);

use RedExplosion\Sqids\Prefixes\ConstantPrefix;
use RedExplosion\Sqids\Prefixes\ConsonantPrefix;
use RedExplosion\Sqids\Prefixes\SimplePrefix;
use RedExplosion\Sqids\Support\Config;

Expand Down Expand Up @@ -55,7 +55,7 @@
});

it('can get the prefix class', function (): void {
expect(Config::prefixClass())->toBeInstanceOf(ConstantPrefix::class);
expect(Config::prefixClass())->toBeInstanceOf(ConsonantPrefix::class);

config()->set('sqids.prefix_class', SimplePrefix::class);

Expand Down

0 comments on commit bf82c01

Please sign in to comment.