forked from TruCopilot/phpfastcache
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathFirestore.test.php
More file actions
45 lines (37 loc) · 1.37 KB
/
Firestore.test.php
File metadata and controls
45 lines (37 loc) · 1.37 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
<?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\Core\Pool\ExtendedCacheItemPoolInterface;
use Phpfastcache\Drivers\Firestore\Config as FirestoreConfig;
use Phpfastcache\Exceptions\PhpfastcacheDriverConnectException;
use Phpfastcache\Tests\Helper\TestHelper;
chdir(__DIR__);
require_once __DIR__ . '/../vendor/autoload.php';
$testHelper = new TestHelper('Google Firestore driver');
/**
* This driver awaits some fixes on Google side related to psr/cache version
*
* @see https://github.com/googleapis/google-auth-library-php/pull/364
* @see https://github.com/googleapis/google-auth-library-php/issues/363
*/
$config = new FirestoreConfig();
try {
$config->setItemDetailedDate(true);
$config->setCollection('phpfastcache');
$cacheInstance = CacheManager::getInstance('Firestore', $config);
$testHelper->runCRUDTests($cacheInstance);
} catch (PhpfastcacheDriverConnectException $e) {
$testHelper->assertSkip('Firestore server unavailable: ' . $e->getMessage());
$testHelper->terminateTest();
}
$testHelper->terminateTest();