-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathArangodb.test.php
47 lines (43 loc) · 1.6 KB
/
Arangodb.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
36
37
38
39
40
41
42
43
44
45
46
47
<?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) <contact@geolim4.com>
* @author Contributors https://github.com/PHPSocialNetwork/phpfastcache/graphs/contributors
*/
use Phpfastcache\CacheManager;
use Phpfastcache\Drivers\Arangodb\Config as ArangodbConfig;
use Phpfastcache\EventManager;
use Phpfastcache\Exceptions\PhpfastcacheDriverConnectException;
use Phpfastcache\Tests\Helper\TestHelper;
use Phpfastcache\Tests\Config\ConfigFactory;
chdir(__DIR__);
require_once __DIR__ . '/../vendor/autoload.php';
$testHelper = new TestHelper('Arangodb driver');
$configFileName = __DIR__ . '/Configs/' . ($argv[1] ?? 'github-actions') . '.php';
if (!file_exists($configFileName)) {
$configFileName = __DIR__ . '/Configs/github-actions.php';
}
try {
EventManager::getInstance()->on(['ArangodbConnection', 'ArangodbCollectionParams'], static function() use ($testHelper){
$args = func_get_args();
$eventName = $args[array_key_last($args)];
$testHelper->printDebugText(
sprintf(
'Arangodb db event "%s" has been triggered.',
$eventName
)
);
});
$cacheInstance = CacheManager::getInstance('Arangodb', include $configFileName);
$testHelper->runCRUDTests($cacheInstance);
} catch (PhpfastcacheDriverConnectException $e) {
$testHelper->assertSkip('Arangodb server unavailable: ' . $e->getMessage());
$testHelper->terminateTest();
}
$testHelper->terminateTest();