-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Possible fix for #56 * Changed property visibility * Changed some unit test * Some more testing * set proper assertions * Anotha fix * Rate limiting by using file cache * Fixed missing classes * Fixed missing carbon class * Added rate limiting test * debug * Attempt to fix cache * Now uses cache default config setting * Missing use statement! * Fixed unit test loop * removed debug * updated readme and changelogs * Added config value for ratelimiting
- Loading branch information
1 parent
9b83ff4
commit 105c9d3
Showing
11 changed files
with
130 additions
and
13 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
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 @@ | |
|
||
use Tylercd100\LERN\Components\Recorder; | ||
use Tylercd100\LERN\Exceptions\RecorderFailedException; | ||
use Tylercd100\LERN\Exceptions\NotifierFailedException; | ||
use Exception; | ||
use Illuminate\Support\Facades\Input; | ||
|
||
|
@@ -80,6 +81,13 @@ public function testRecordShouldReturnFalseWhenPassedRecorderFailedException() | |
$this->assertEquals(false, $result); | ||
} | ||
|
||
public function testRecordShouldReturnTrueWhenPassedNotifierFailedException() | ||
{ | ||
$recorder = new Recorder; | ||
$result = $recorder->record(new NotifierFailedException); | ||
$this->assertInstanceOf(\Tylercd100\LERN\Models\ExceptionModel::class, $result); | ||
} | ||
|
||
public function testGetDataFunction() | ||
{ | ||
$data = ['user'=>['email','[email protected]','password'=>'foobar','name'=>'Foo Bar'],'status'=>200]; | ||
|
@@ -90,4 +98,19 @@ public function testGetDataFunction() | |
$this->assertArrayNotHasKey('password', $result['user']); | ||
$this->assertArrayNotHasKey('email', $result['user']); | ||
} | ||
|
||
public function testRateLimiting() | ||
{ | ||
$recorder = new Recorder; | ||
$result = $recorder->record(new Exception); | ||
$this->assertInstanceOf(\Tylercd100\LERN\Models\ExceptionModel::class, $result); | ||
|
||
$result = $recorder->record(new Exception); | ||
$this->assertEquals(false, $result); | ||
|
||
sleep(config("lern.ratelimit")+2); | ||
|
||
$result = $recorder->record(new Exception); | ||
$this->assertInstanceOf(\Tylercd100\LERN\Models\ExceptionModel::class, $result); | ||
} | ||
} |
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