-
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.
- Loading branch information
Showing
11 changed files
with
206 additions
and
65 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<?php | ||
|
||
namespace SPie\LaravelJWT\Events; | ||
|
||
/** | ||
* Trait IpAddress | ||
* | ||
* @package SPie\LaravelJWT\Events | ||
*/ | ||
trait IpAddress | ||
{ | ||
/** | ||
* @var string|null | ||
*/ | ||
private $ipAddress; | ||
|
||
/** | ||
* @return string|null | ||
*/ | ||
public function getIpAddress(): ?string | ||
{ | ||
return $this->ipAddress; | ||
} | ||
} |
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,16 @@ | ||
<?php | ||
|
||
namespace SPie\LaravelJWT\Events; | ||
|
||
/** | ||
* Interface IpAddressable | ||
* | ||
* @package SPie\LaravelJWT\Events | ||
*/ | ||
interface IpAddressable | ||
{ | ||
/** | ||
* @return string|null | ||
*/ | ||
public function getIpAddress(): ?string; | ||
} |
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,44 @@ | ||
<?php | ||
|
||
namespace SPie\LaravelJWT\Test; | ||
|
||
use Illuminate\Http\Request; | ||
use Mockery as m; | ||
use Mockery\MockInterface; | ||
|
||
/** | ||
* Trait RequestHelper | ||
* | ||
* @package SPie\LaravelJWT\Test | ||
*/ | ||
trait RequestHelper | ||
{ | ||
//region Mocks | ||
|
||
/** | ||
* @return Request|MockInterface | ||
*/ | ||
private function createRequest(): Request | ||
{ | ||
return m::mock(Request::class) | ||
->shouldAllowMockingProtectedMethods() | ||
->makePartial(); | ||
} | ||
|
||
/** | ||
* @param Request|MockInterface $request | ||
* @param string|null $ipAddress | ||
* | ||
* @return $this | ||
*/ | ||
private function mockRequestIp(MockInterface $request, ?string $ipAddress) | ||
{ | ||
$request | ||
->shouldReceive('ip') | ||
->andReturn($ipAddress); | ||
|
||
return $this; | ||
} | ||
|
||
//endregion | ||
} |
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
Oops, something went wrong.