forked from PHPSocialNetwork/phpfastcache
-
Notifications
You must be signed in to change notification settings - Fork 1
/
NewCacheInstance.test.php
35 lines (29 loc) · 1.15 KB
/
NewCacheInstance.test.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
<?php
/**
*
* This file is part of Phpfastcache.
*
* @license MIT License (MIT)
*
* For full copyright and license information, please see the docs/CREDITS.txt and LICENCE files.
*
* @author Georges.L (Geolim4) <[email protected]>
* @author Contributors https://github.com/PHPSocialNetwork/phpfastcache/graphs/contributors
*/
use Phpfastcache\Core\Pool\ExtendedCacheItemPoolInterface;
use Phpfastcache\CacheManager;
use Phpfastcache\Tests\Helper\TestHelper;
chdir(__DIR__);
require_once __DIR__ . '/../vendor/autoload.php';
$testHelper = new TestHelper('New cache instance');
$defaultDriver = (!empty($argv[1]) ? ucfirst($argv[1]) : 'Files');
/**
* Testing memcached as it is declared in .travis.yml
*/
$driverInstance = CacheManager::getInstance($defaultDriver);
if (!is_object($driverInstance) || !($driverInstance instanceof ExtendedCacheItemPoolInterface)) {
$testHelper->assertFail('CacheManager::getInstance() returned wrong data hint:' . gettype($driverInstance));
} else {
$testHelper->assertPass('CacheManager::getInstance() returned an expected object that implements ExtendedCacheItemPoolInterface');
}
$testHelper->terminateTest();