-
-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[#13439] - Cache tests and Session refactoring
- Loading branch information
Showing
43 changed files
with
2,607 additions
and
78 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,88 @@ | ||
<?php | ||
declare(strict_types=1); | ||
|
||
/** | ||
* This file is part of the Phalcon Framework. | ||
* | ||
* (c) Phalcon Team <[email protected]> | ||
* | ||
* For the full copyright and license information, please view the LICENSE.txt | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace Phalcon\Test\Unit\Cache\Adapter\Apcu; | ||
|
||
use Phalcon\Cache\Adapter\Apcu; | ||
use Phalcon\Test\Fixtures\Traits\ApcuTrait; | ||
use UnitTester; | ||
|
||
/** | ||
* Class ClearCest | ||
*/ | ||
class ClearCest | ||
{ | ||
use ApcuTrait; | ||
|
||
/** | ||
* Tests Phalcon\Cache\Adapter\Apcu :: clear() | ||
* | ||
* @param UnitTester $I | ||
* | ||
* @author Phalcon Team <[email protected]> | ||
* @since 2019-03-31 | ||
*/ | ||
public function storageAdapterApcuClear(UnitTester $I) | ||
{ | ||
$I->wantToTest('Cache\Adapter\Apcu - clear()'); | ||
$adapter = new Apcu(); | ||
|
||
$key1 = uniqid(); | ||
$key2 = uniqid(); | ||
$adapter->set($key1, 'test'); | ||
$actual = $adapter->has($key1); | ||
$I->assertTrue($actual); | ||
|
||
$adapter->set($key2, 'test'); | ||
$actual = $adapter->has($key2); | ||
$I->assertTrue($actual); | ||
|
||
$actual = $adapter->clear(); | ||
$I->assertTrue($actual); | ||
|
||
$actual = $adapter->has($key1); | ||
$I->assertFalse($actual); | ||
|
||
$actual = $adapter->has($key2); | ||
$I->assertFalse($actual); | ||
} | ||
|
||
/** | ||
* Tests Phalcon\Cache\Adapter\Apcu :: clear() - twice | ||
* | ||
* @param UnitTester $I | ||
* | ||
* @author Phalcon Team <[email protected]> | ||
* @since 2019-03-31 | ||
*/ | ||
public function storageAdapterApcuClearTwice(UnitTester $I) | ||
{ | ||
$I->wantToTest('Cache\Adapter\Apcu - clear() - twice'); | ||
$adapter = new Apcu(); | ||
|
||
$key1 = uniqid(); | ||
$key2 = uniqid(); | ||
$adapter->set($key1, 'test'); | ||
$actual = $adapter->has($key1); | ||
$I->assertTrue($actual); | ||
|
||
$adapter->set($key2, 'test'); | ||
$actual = $adapter->has($key2); | ||
$I->assertTrue($actual); | ||
|
||
$actual = $adapter->clear(); | ||
$I->assertTrue($actual); | ||
|
||
$actual = $adapter->clear(); | ||
$I->assertTrue($actual); | ||
} | ||
} |
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,46 @@ | ||
<?php | ||
declare(strict_types=1); | ||
|
||
/** | ||
* This file is part of the Phalcon Framework. | ||
* | ||
* (c) Phalcon Team <[email protected]> | ||
* | ||
* For the full copyright and license information, please view the LICENSE.txt | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace Phalcon\Test\Unit\Cache\Adapter\Apcu; | ||
|
||
use Phalcon\Cache\Adapter\Apcu; | ||
use Phalcon\Storage\Adapter\AdapterInterface; | ||
use Phalcon\Test\Fixtures\Traits\ApcuTrait; | ||
use UnitTester; | ||
|
||
/** | ||
* Class ConstructCest | ||
*/ | ||
class ConstructCest | ||
{ | ||
use ApcuTrait; | ||
|
||
/** | ||
* Tests Phalcon\Cache\Adapter\Apcu :: __construct() | ||
* | ||
* @param UnitTester $I | ||
* | ||
* @author Phalcon Team <[email protected]> | ||
* @since 2019-04-09 | ||
*/ | ||
public function storageAdapterApcuConstruct(UnitTester $I) | ||
{ | ||
$I->wantToTest('Cache\Adapter\Apcu - __construct()'); | ||
$adapter = new Apcu(); | ||
|
||
$class = Apcu::class; | ||
$I->assertInstanceOf($class, $adapter); | ||
|
||
$class = AdapterInterface::class; | ||
$I->assertInstanceOf($class, $adapter); | ||
} | ||
} |
Oops, something went wrong.