Skip to content

Commit a935e78

Browse files
committed
Fix once and for all HHVM tests
1 parent bd18a09 commit a935e78

File tree

2 files changed

+14
-6
lines changed

2 files changed

+14
-6
lines changed

lib/Phpfastcache/Helper/TestHelper.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,7 @@ public function accessInaccessibleMember($obj, $prop)
255255
*/
256256
public function exceptionHandler(\Throwable $exception)
257257
{
258-
if ($exception instanceof PhpfastcacheDriverCheckException || $exception->getPrevious() instanceof PhpfastcacheDriverCheckException) {
258+
if ($exception instanceof PhpfastcacheDriverCheckException) {
259259
$this->printSkipText('A driver could not be initialized due to missing requirement: ' . $exception->getMessage());
260260
$this->exitCode = 0;
261261
} else {

tests/Mongodb.test.php

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,25 @@
77

88
use Phpfastcache\CacheManager;
99
use Phpfastcache\Drivers\Mongodb\Config;
10+
use Phpfastcache\Exceptions\PhpfastcacheDriverCheckException;
1011
use Phpfastcache\Exceptions\phpFastCacheDriverException;
1112
use Phpfastcache\Helper\TestHelper;
1213

1314
chdir(__DIR__);
1415
require_once __DIR__ . '/../vendor/autoload.php';
1516
$testHelper = new TestHelper('Mongodb driver');
16-
$cacheInstance = CacheManager::getInstance('Mongodb', new Config([
17-
'databaseName' => 'pfc_test',
18-
'username' => 'travis',
19-
'password' => 'test',
20-
]));
17+
18+
try{
19+
$cacheInstance = CacheManager::getInstance('Mongodb', new Config([
20+
'databaseName' => 'pfc_test',
21+
'username' => 'travis',
22+
'password' => 'test',
23+
]));
24+
}catch(PhpfastcacheDriverCheckException $exception){
25+
$testHelper->exceptionHandler($exception);
26+
$testHelper->terminateTest();
27+
}
28+
2129

2230
$cacheKey = str_shuffle(uniqid('pfc', true));
2331
$cacheValue = str_shuffle(uniqid('pfc', true));

0 commit comments

Comments
 (0)