-
-
Notifications
You must be signed in to change notification settings - Fork 3
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 #14 from TheDragonCode/2.x
Changed behavior when caching is disabled
- Loading branch information
Showing
24 changed files
with
1,188 additions
and
23 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,27 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace DragonCode\Cache\Services\Storages; | ||
|
||
class Disabled extends Store | ||
{ | ||
public function get(string $key, $default = null) | ||
{ | ||
return $this->call($default); | ||
} | ||
|
||
public function put(string $key, $value, int $seconds) | ||
{ | ||
return $this->get($key, $value); | ||
} | ||
|
||
public function forget(string $key): void | ||
{ | ||
} | ||
|
||
public function has(string $key): bool | ||
{ | ||
return false; | ||
} | ||
} |
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
56 changes: 56 additions & 0 deletions
56
tests/Cache/NotWhen/Arrayables/Many/Arr/DragonCodeTest.php
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,56 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Tests\Cache\NotWhen\Arrayables\Many\Arr; | ||
|
||
use Tests\Cache\NotWhen\BaseTest; | ||
use Tests\Fixtures\Many\DragonCodeArrayable; | ||
|
||
class DragonCodeTest extends BaseTest | ||
{ | ||
protected $value = [ | ||
'foo' => 'Foo', | ||
'bar' => 'Bar', | ||
'baz' => [ | ||
'foo' => 'Foo', | ||
'bar' => 'Bar', | ||
], | ||
]; | ||
|
||
public function testGet() | ||
{ | ||
$this->assertNull($this->cache()->get()); | ||
|
||
$this->cache()->put(new DragonCodeArrayable()); | ||
|
||
$this->assertNull($this->cache()->get()); | ||
} | ||
|
||
public function testPut() | ||
{ | ||
$this->assertSame($this->value, $this->cache()->put(new DragonCodeArrayable())); | ||
|
||
$this->assertNull($this->cache()->get()); | ||
} | ||
|
||
public function testForget() | ||
{ | ||
$this->assertNull($this->cache()->get()); | ||
|
||
$this->cache()->put(new DragonCodeArrayable()); | ||
|
||
$this->cache()->forget(); | ||
|
||
$this->assertNull($this->cache()->get()); | ||
} | ||
|
||
public function testHas() | ||
{ | ||
$this->assertFalse($this->cache()->has()); | ||
|
||
$this->cache()->put(new DragonCodeArrayable()); | ||
|
||
$this->assertFalse($this->cache()->has()); | ||
} | ||
} |
56 changes: 56 additions & 0 deletions
56
tests/Cache/NotWhen/Arrayables/Many/Arr/IlluminateTest.php
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,56 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Tests\Cache\NotWhen\Arrayables\Many\Arr; | ||
|
||
use Tests\Cache\NotWhen\BaseTest; | ||
use Tests\Fixtures\Many\IlluminateArrayable; | ||
|
||
class IlluminateTest extends BaseTest | ||
{ | ||
protected $value = [ | ||
'foo' => 'Foo', | ||
'bar' => 'Bar', | ||
'baz' => [ | ||
'foo' => 'Foo', | ||
'bar' => 'Bar', | ||
], | ||
]; | ||
|
||
public function testGet() | ||
{ | ||
$this->assertNull($this->cache()->get()); | ||
|
||
$this->cache()->put(new IlluminateArrayable()); | ||
|
||
$this->assertNull($this->cache()->get()); | ||
} | ||
|
||
public function testPut() | ||
{ | ||
$this->assertSame($this->value, $this->cache()->put(new IlluminateArrayable())); | ||
|
||
$this->assertNull($this->cache()->get()); | ||
} | ||
|
||
public function testForget() | ||
{ | ||
$this->assertNull($this->cache()->get()); | ||
|
||
$this->cache()->put(new IlluminateArrayable()); | ||
|
||
$this->cache()->forget(); | ||
|
||
$this->assertNull($this->cache()->get()); | ||
} | ||
|
||
public function testHas() | ||
{ | ||
$this->assertFalse($this->cache()->has()); | ||
|
||
$this->cache()->put(new IlluminateArrayable()); | ||
|
||
$this->assertFalse($this->cache()->has()); | ||
} | ||
} |
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,60 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Tests\Cache\NotWhen\Arrayables\Many\Arr; | ||
|
||
use Tests\Cache\NotWhen\BaseTest; | ||
use Tests\Fixtures\Many\MixedArrayable; | ||
|
||
class MixedTest extends BaseTest | ||
{ | ||
protected $value = [ | ||
'foo' => 'Foo', | ||
'bar' => 'Bar', | ||
'baz' => [ | ||
'foo' => 'Foo', | ||
'bar' => 'Bar', | ||
], | ||
'baq' => [ | ||
'foo' => 'Foo', | ||
'bar' => 'Bar', | ||
], | ||
]; | ||
|
||
public function testGet() | ||
{ | ||
$this->assertNull($this->cache()->get()); | ||
|
||
$this->cache()->put(new MixedArrayable()); | ||
|
||
$this->assertNull($this->cache()->get()); | ||
} | ||
|
||
public function testPut() | ||
{ | ||
$this->assertSame($this->value, $this->cache()->put(new MixedArrayable())); | ||
|
||
$this->assertNull($this->cache()->get()); | ||
} | ||
|
||
public function testForget() | ||
{ | ||
$this->assertNull($this->cache()->get()); | ||
|
||
$this->cache()->put(new MixedArrayable()); | ||
|
||
$this->cache()->forget(); | ||
|
||
$this->assertNull($this->cache()->get()); | ||
} | ||
|
||
public function testHas() | ||
{ | ||
$this->assertFalse($this->cache()->has()); | ||
|
||
$this->cache()->put(new MixedArrayable()); | ||
|
||
$this->assertFalse($this->cache()->has()); | ||
} | ||
} |
58 changes: 58 additions & 0 deletions
58
tests/Cache/NotWhen/Arrayables/Many/Files/DragonCodeTest.php
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,58 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Tests\Cache\NotWhen\Arrayables\Many\Files; | ||
|
||
use Tests\Cache\NotWhen\BaseTest; | ||
use Tests\Fixtures\Many\DragonCodeArrayable; | ||
|
||
class DragonCodeTest extends BaseTest | ||
{ | ||
protected $cache = 'file'; | ||
|
||
protected $value = [ | ||
'foo' => 'Foo', | ||
'bar' => 'Bar', | ||
'baz' => [ | ||
'foo' => 'Foo', | ||
'bar' => 'Bar', | ||
], | ||
]; | ||
|
||
public function testGet() | ||
{ | ||
$this->assertNull($this->cache()->get()); | ||
|
||
$this->cache()->put(new DragonCodeArrayable()); | ||
|
||
$this->assertNull($this->cache()->get()); | ||
} | ||
|
||
public function testPut() | ||
{ | ||
$this->assertSame($this->value, $this->cache()->put(new DragonCodeArrayable())); | ||
|
||
$this->assertNull($this->cache()->get()); | ||
} | ||
|
||
public function testForget() | ||
{ | ||
$this->assertNull($this->cache()->get()); | ||
|
||
$this->cache()->put(new DragonCodeArrayable()); | ||
|
||
$this->cache()->forget(); | ||
|
||
$this->assertNull($this->cache()->get()); | ||
} | ||
|
||
public function testHas() | ||
{ | ||
$this->assertFalse($this->cache()->has()); | ||
|
||
$this->cache()->put(new DragonCodeArrayable()); | ||
|
||
$this->assertFalse($this->cache()->has()); | ||
} | ||
} |
Oops, something went wrong.