Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tooManyAttempts method of RateLimiter class parameter fix #22197

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions src/Illuminate/Cache/RateLimiter.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,9 @@ public function __construct(Cache $cache)
*
* @param string $key
* @param int $maxAttempts
* @param float|int $decayMinutes
* @return bool
*/
public function tooManyAttempts($key, $maxAttempts, $decayMinutes = 1)
public function tooManyAttempts($key, $maxAttempts)
{
if ($this->attempts($key) >= $maxAttempts) {
if ($this->cache->has($key.':timer')) {
Expand Down
2 changes: 1 addition & 1 deletion src/Illuminate/Database/Query/Builder.php
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ class Builder
*/
public $operators = [
'=', '<', '>', '<=', '>=', '<>', '!=', '<=>',
'like', 'like binary', 'not like', 'between', 'ilike',
'like', 'like binary', 'not like', 'ilike',
'&', '|', '^', '<<', '>>',
'rlike', 'regexp', 'not regexp',
'~', '~*', '!~', '!~*', 'similar to',
Expand Down
2 changes: 1 addition & 1 deletion src/Illuminate/Database/Query/Grammars/PostgresGrammar.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class PostgresGrammar extends Grammar
*/
protected $operators = [
'=', '<', '>', '<=', '>=', '<>', '!=',
'like', 'not like', 'between', 'ilike',
'like', 'not like', 'ilike',
'&', '|', '#', '<<', '>>', '>>=', '=<<',
'@>', '<@', '?', '?|', '?&', '||', '-', '-', '#-',
];
Expand Down
2 changes: 1 addition & 1 deletion src/Illuminate/Database/Query/Grammars/SQLiteGrammar.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class SQLiteGrammar extends Grammar
*/
protected $operators = [
'=', '<', '>', '<=', '>=', '<>', '!=',
'like', 'not like', 'between', 'ilike',
'like', 'not like', 'ilike',
'&', '|', '<<', '>>',
];

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class SqlServerGrammar extends Grammar
*/
protected $operators = [
'=', '<', '>', '<=', '>=', '!<', '!>', '<>', '!=',
'like', 'not like', 'between', 'ilike',
'like', 'not like', 'ilike',
'&', '&=', '|', '|=', '^', '^=',
];

Expand Down
2 changes: 1 addition & 1 deletion src/Illuminate/Queue/Console/RetryCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class RetryCommand extends Command
*
* @var string
*/
protected $signature = 'queue:retry {id* : The ID of the failed job.}';
protected $signature = 'queue:retry {id* : The ID of the failed job or "all" to retry all jobs.}';

/**
* The console command description.
Expand Down
14 changes: 14 additions & 0 deletions tests/Database/DatabaseEloquentGlobalScopesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,26 @@

use Mockery as m;
use PHPUnit\Framework\TestCase;
use Illuminate\Database\Capsule\Manager as DB;
use Illuminate\Database\Eloquent\Model as Eloquent;

class DatabaseEloquentGlobalScopesTest extends TestCase
{
public function setUp()
{
parent::setUp();

tap(new DB)->addConnection([
'driver' => 'sqlite',
'database' => ':memory:',
])->bootEloquent();
}

public function tearDown()
{
m::close();

Eloquent::unsetConnectionResolver();
}

public function testGlobalScopeIsApplied()
Expand Down
1 change: 1 addition & 0 deletions tests/Database/DatabaseEloquentIntegrationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ public function tearDown()
}

Relation::morphMap([], false);
Eloquent::unsetConnectionResolver();
}

/**
Expand Down
11 changes: 11 additions & 0 deletions tests/Database/DatabaseEloquentModelTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,7 @@ public function testWithMethodCallsQueryBuilderCorrectly()
public function testWithoutMethodRemovesEagerLoadedRelationshipCorrectly()
{
$model = new EloquentModelWithoutRelationStub;
$this->addMockConnection($model);
$instance = $model->newInstance()->newQuery()->without('foo');
$this->assertEmpty($instance->getEagerLoads());
}
Expand Down Expand Up @@ -1832,6 +1833,16 @@ public function setIncrementing($value)
{
$this->incrementing = $value;
}

public function getConnection()
{
$mock = m::mock('Illuminate\Database\Connection');
$mock->shouldReceive('getQueryGrammar')->andReturn(m::mock('Illuminate\Database\Query\Grammars\Grammar'));
$mock->shouldReceive('getPostProcessor')->andReturn(m::mock('Illuminate\Database\Query\Processors\Processor'));
$mock->shouldReceive('getName')->andReturn('name');

return $mock;
}
}

class EloquentKeyTypeModelStub extends EloquentModelStub
Expand Down