forked from PHPSocialNetwork/phpfastcache
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathActOnAll.test.php
More file actions
53 lines (43 loc) · 1.59 KB
/
ActOnAll.test.php
File metadata and controls
53 lines (43 loc) · 1.59 KB
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
<?php
/**
* @author Khoa Bui (khoaofgod) <[email protected]> http://www.phpfastcache.com
* @author Georges.L (Geolim4) <[email protected]>
*/
use phpFastCache\CacheManager;
use phpFastCache\Entities\driverStatistic;
use phpFastCache\Exceptions\phpFastCacheDriverCheckException;
use phpFastCache\Helper\ActOnAll;
use phpFastCache\Helper\TestHelper;
chdir(__DIR__);
require_once __DIR__ . '/../vendor/autoload.php';
$testHelper = new TestHelper('ActOnAll helper');
$defaultDriver = (!empty($argv[1]) ? ucfirst($argv[1]) : 'Files');
/**
* Testing memcached as it is declared in .travis.yml
*/
try{
$filesInstance = CacheManager::getInstance('Files');
$RedisInstance = CacheManager::getInstance('Redis');
$MemcacheInstance = CacheManager::getInstance('Memcached');
}catch(phpFastCacheDriverCheckException $e){
$testHelper->printSkipText($e->getMessage())->terminateTest();
}
$actOnAll = new ActOnAll();
$statsAry = $actOnAll->getStats();
if(is_array($statsAry)){
if(count($statsAry) !== 3){
$testHelper->printFailText('Wrong count of driverStatistics objects: Got ' . count($statsAry) . " element(s), expected 3");
goto endOfTest;
}
foreach ($statsAry as $stat) {
if(!is_object($stat) || !($stat instanceof driverStatistic)){
$testHelper->printFailText('$statsAry contains one element that is not a driverStatistic object');
goto endOfTest;
}
}
$testHelper->printPassText('ActOnAll helper passed all tests');
}else{
$testHelper->printFailText('$statsAry is not an array');
}
endOfTest:
$testHelper->terminateTest();