forked from TruCopilot/phpfastcache
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathClusterRandomReplication.test.php
More file actions
38 lines (31 loc) · 1.35 KB
/
ClusterRandomReplication.test.php
File metadata and controls
38 lines (31 loc) · 1.35 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
<?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\Cluster\AggregatorInterface;
use Phpfastcache\Cluster\ClusterAggregator;
use Phpfastcache\Drivers\Files\Config as FilesConfig;
use Phpfastcache\Drivers\Sqlite\Config as SqliteConfig;
use Phpfastcache\Tests\Helper\TestHelper;
chdir(__DIR__);
require_once __DIR__ . '/../vendor/autoload.php';
require_once __DIR__ . '/mock/Autoload.php';
$testHelper = new TestHelper('Master/Slave Replication Cluster');
CacheManager::clearInstances();
$clusterAggregator = new ClusterAggregator('test_20');
$clusterAggregator->aggregateDriver(CacheManager::getInstance('Redis'));
$clusterAggregator->aggregateDriver(CacheManager::getInstance('Sqlite', new SqliteConfig(['securityKey' => 'unit_tests'])));
$clusterAggregator->aggregateDriver(CacheManager::getInstance('Files', new FilesConfig(['securityKey' => 'unit_tests'])));
$cluster = $clusterAggregator->getCluster(AggregatorInterface::STRATEGY_RANDOM_REPLICATION);
$cluster->clear();
$testHelper->runCRUDTests($cluster);
$testHelper->terminateTest();