Completed
Push — 2.0-dev ( 13430b...59c481 )
by George
07:19
created

MemcachedTest::setUp()   B

Complexity

Conditions 5
Paths 9

Size

Total Lines 35
Code Lines 18

Duplication

Lines 0
Ratio 0 %

Importance

Changes 4
Bugs 0 Features 0
Metric Value
c 4
b 0
f 0
dl 0
loc 35
rs 8.439
cc 5
eloc 18
nc 9
nop 0
1
<?php
2
/**
3
 * @copyright  Copyright (C) 2005 - 2015 Open Source Matters, Inc. All rights reserved.
4
 * @license    GNU General Public License version 2 or later; see LICENSE
5
 */
6
7
namespace Joomla\Cache\Tests;
8
9
use Joomla\Cache;
10
11
/**
12
 * Tests for the Joomla\Cache\Memcached class.
13
 *
14
 * @since  1.0
15
 */
16
class MemcachedTest extends CacheTest
17
{
18
	/**
19
	 * Setup the tests.
20
	 *
21
	 * @return  void
22
	 *
23
	 * @since   1.0
24
	 */
25
	public function setUp()
26
	{
27
		if (!class_exists('Memcached'))
28
		{
29
			$this->markTestSkipped(
30
				'The Memcached class does not exist.'
31
			);
32
33
			return;
34
		}
35
36
		$options = $this->cacheOptions;
37
38
		if (!$options)
39
		{
40
			$options = array();
41
		}
42
43
		if (!is_array($options))
44
		{
45
			$options = array($options);
46
		}
47
48
		if (!isset($options['memcache.servers']))
49
		{
50
			$server = new \stdClass;
51
			$server->host = 'localhost';
52
			$server->port = '11211';
53
			$options['memcache.servers'] = array($server);
54
		}
55
56
		$this->cacheOptions = $options;
57
		$this->cacheClass = 'Joomla\\Cache\\Memcached';
58
		parent::setUp();
59
	}
60
}
61