Proyectos de Subversion Moodle

Rev

Rev 1 | Mostrar el archivo completo | | | Autoría | Ultima modificación | Ver Log |

Rev 1 Rev 1441
Línea 14... Línea 14...
14
// You should have received a copy of the GNU General Public License
14
// You should have received a copy of the GNU General Public License
15
// along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
15
// along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
Línea 16... Línea 16...
16
 
16
 
Línea 17... Línea 17...
17
namespace cachestore_redis;
17
namespace cachestore_redis;
-
 
18
 
18
 
19
use core_cache\definition;
19
use cache_definition;
20
use core_cache\helper;
Línea 20... Línea 21...
20
use cache_store;
21
use core_cache\store;
Línea 21... Línea 22...
21
use cachestore_redis;
22
use cachestore_redis;
Línea 41... Línea 42...
41
 * @copyright 2017 Catalyst IT Australia {@link http://www.catalyst-au.net}
42
 * @copyright 2017 Catalyst IT Australia {@link http://www.catalyst-au.net}
42
 * @license   http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
43
 * @license   http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
43
 *
44
 *
44
 * @coversDefaultClass \cachestore_redis
45
 * @coversDefaultClass \cachestore_redis
45
 */
46
 */
46
class cachestore_cluster_redis_test extends \advanced_testcase {
47
final class cachestore_cluster_redis_test extends \advanced_testcase {
47
    /**
48
    /**
48
     * Create a cache store for testing the Redis cluster.
49
     * Create a cache store for testing the Redis cluster.
49
     *
50
     *
50
     * @param string|null $seed The redis cluster servers.
51
     * @param string|null $seed The redis cluster servers.
51
     * @return cachestore_redis The created cache store instance.
52
     * @return cachestore_redis The created cache store instance.
52
     */
53
     */
53
    public function create_store(?string $seed = null): cachestore_redis {
54
    public function create_store(?string $seed = null): cachestore_redis {
54
        global $DB;
55
        global $DB;
Línea 55... Línea 56...
55
 
56
 
56
        $definition = cache_definition::load_adhoc(
57
        $definition = definition::load_adhoc(
57
            mode: cache_store::MODE_APPLICATION,
58
            mode: store::MODE_APPLICATION,
58
            component: 'cachestore_redis',
59
            component: 'cachestore_redis',
59
            area: 'phpunit_test',
60
            area: 'phpunit_test',
Línea 60... Línea 61...
60
        );
61
        );
Línea 86... Línea 87...
86
 
87
 
87
    /**
88
    /**
88
     * Set up the test environment.
89
     * Set up the test environment.
89
     */
90
     */
-
 
91
    public function setUp(): void {
90
    public function setUp(): void {
92
        parent::setUp();
91
        if (!cachestore_redis::are_requirements_met()) {
93
        if (!cachestore_redis::are_requirements_met()) {
92
            $this->markTestSkipped('Could not test cachestore_redis with cluster, missing requirements.');
94
            $this->markTestSkipped('Could not test cachestore_redis with cluster, missing requirements.');
93
        } else if (!\cache_helper::is_cluster_available()) {
95
        } else if (!helper::is_cluster_available()) {
94
            $this->markTestSkipped('Could not test cachestore_redis with cluster, class RedisCluster is not available.');
96
            $this->markTestSkipped('Could not test cachestore_redis with cluster, class RedisCluster is not available.');
95
        } else if (!defined('TEST_CACHESTORE_REDIS_SERVERSCLUSTER')) {
97
        } else if (!defined('TEST_CACHESTORE_REDIS_SERVERSCLUSTER')) {
96
            $this->markTestSkipped('Could not test cachestore_redis with cluster, missing configuration. ' .
98
            $this->markTestSkipped('Could not test cachestore_redis with cluster, missing configuration. ' .
97
                                  "Example: define('TEST_CACHESTORE_REDIS_SERVERSCLUSTER', " .
99
                                  "Example: define('TEST_CACHESTORE_REDIS_SERVERSCLUSTER', " .