-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #11 from Laravel-Lang/1.x
Added helper for accessing parameter names
- Loading branch information
Showing
7 changed files
with
72 additions
and
8 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 |
---|---|---|
@@ -0,0 +1,36 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace LaravelLang\Routes\Helpers; | ||
|
||
use LaravelLang\Config\Data\Shared\RouteNameData; | ||
use LaravelLang\Config\Facades\Config; | ||
|
||
class Name | ||
{ | ||
public static function all(): RouteNameData | ||
{ | ||
return Config::shared()->routes->names; | ||
} | ||
|
||
public static function parameter(): string | ||
{ | ||
return static::all()->parameter; | ||
} | ||
|
||
public static function header(): string | ||
{ | ||
return static::all()->header; | ||
} | ||
|
||
public static function cookie(): string | ||
{ | ||
return static::all()->cookie; | ||
} | ||
|
||
public static function session(): string | ||
{ | ||
return static::all()->session; | ||
} | ||
} |
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 |
---|---|---|
|
@@ -4,4 +4,4 @@ | |
|
||
uses(Tests\TestCase::class) | ||
->beforeEach(fn () => Event::fake()) | ||
->in('Feature'); | ||
->in('Feature', 'Unit'); |
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,30 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
use LaravelLang\Config\Enums\Name as NameEnum; | ||
use LaravelLang\Routes\Helpers\Name; | ||
|
||
test('parameter', function () { | ||
expect(Name::parameter())->toBe( | ||
config(NameEnum::Shared() . '.routes.names.parameter') | ||
); | ||
}); | ||
|
||
test('header', function () { | ||
expect(Name::header())->toBe( | ||
config(NameEnum::Shared() . '.routes.names.header') | ||
); | ||
}); | ||
|
||
test('cookie', function () { | ||
expect(Name::cookie())->toBe( | ||
config(NameEnum::Shared() . '.routes.names.cookie') | ||
); | ||
}); | ||
|
||
test('session', function () { | ||
expect(Name::session())->toBe( | ||
config(NameEnum::Shared() . '.routes.names.session') | ||
); | ||
}); |