-
Notifications
You must be signed in to change notification settings - Fork 11k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[6.x] Fix infinite value for RedisStore (#31348)
* Fix infinite value for RedisStore * Let Redis store NAN values
- Loading branch information
1 parent
8a02955
commit fbf6f6c
Showing
2 changed files
with
52 additions
and
1 deletion.
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,51 @@ | ||
<?php | ||
|
||
namespace Illuminate\Tests\Integration\Cache; | ||
|
||
use Illuminate\Foundation\Testing\Concerns\InteractsWithRedis; | ||
use Illuminate\Support\Facades\Cache; | ||
use Illuminate\Tests\Integration\IntegrationTest; | ||
|
||
/** | ||
* @group integration | ||
*/ | ||
class RedisStoreTest extends IntegrationTest | ||
{ | ||
use InteractsWithRedis; | ||
|
||
protected function setUp(): void | ||
{ | ||
parent::setUp(); | ||
|
||
$this->setUpRedis(); | ||
} | ||
|
||
protected function tearDown(): void | ||
{ | ||
parent::tearDown(); | ||
|
||
$this->tearDownRedis(); | ||
} | ||
|
||
public function testItCanStoreInfinite() | ||
{ | ||
Cache::store('redis')->clear(); | ||
|
||
$result = Cache::store('redis')->put('foo', INF); | ||
$this->assertTrue($result); | ||
$this->assertSame(INF, Cache::store('redis')->get('foo')); | ||
|
||
$result = Cache::store('redis')->put('bar', -INF); | ||
$this->assertTrue($result); | ||
$this->assertSame(-INF, Cache::store('redis')->get('bar')); | ||
} | ||
|
||
public function testItCanStoreNan() | ||
{ | ||
Cache::store('redis')->clear(); | ||
|
||
$result = Cache::store('redis')->put('foo', NAN); | ||
$this->assertTrue($result); | ||
$this->assertNan(Cache::store('redis')->get('foo')); | ||
} | ||
} |