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

WincacheTest   A

Complexity

Total Complexity 8

Size/Duplication

Total Lines 123
Duplicated Lines 0 %

Coupling/Cohesion

Components 2
Dependencies 3

Importance

Changes 6
Bugs 0 Features 0
Metric Value
wmc 8
c 6
b 0
f 0
lcom 2
cbo 3
dl 0
loc 123
rs 10
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\Wincache class.
13
 *
14
 * @since  1.0
15
 */
16
class WincacheTest extends \PHPUnit_Framework_TestCase
17
{
18
	/**
19
	 * @var    Cache\Wincache
20
	 * @since  1.0
21
	 */
22
	private $instance;
23
24
	/**
25
	 * Tests for the correct Psr\Cache return values.
26
	 *
27
	 * @return  void
28
	 *
29
	 * @coversNothing
30
	 * @since   1.0
31
	 */
32
	public function testPsrCache()
33
	{
34
		$this->assertInternalType('boolean', $this->instance->clear(), 'Checking clear.');
35
		$this->assertInstanceOf('\Psr\Cache\CacheItemInterface', $this->instance->getItem('foo'), 'Checking get.');
36
		$this->assertInternalType('array', $this->instance->getItems(array('foo')), 'Checking getMultiple.');
37
		$this->assertInternalType('boolean', $this->instance->deleteItem('foo'), 'Checking remove.');
38
		$this->assertInternalType('array', $this->instance->deleteItems(array('foo')), 'Checking removeMultiple.');
39
40
		// Create a stub for the CacheItemInterface class.
41
		$stub = $this->getMockBuilder('\\Psr\\Cache\\CacheItemInterface')
42
			->getMock();
43
44
		$stub->method('get')
45
			->willReturn('bar');
46
47
		$stub->method('getKey')
48
			->willReturn('foo');
49
50
		$this->assertInternalType('boolean', $this->instance->save($stub), 'Checking save.');
51
	}
52
53
	/**
54
	 * Tests the Joomla\Cache\Wincache::clear method.
55
	 *
56
	 * @return  void
57
	 *
58
	 * @covers  Joomla\Cache\Wincache::clear
59
	 * @since   1.0
60
	 */
61
	public function testClear()
62
	{
63
		$this->markTestIncomplete();
64
	}
65
66
	/**
67
	 * Tests the Joomla\Cache\Wincache::hasItem method.
68
	 *
69
	 * @return  void
70
	 *
71
	 * @covers  Joomla\Cache\Wincache::hasItem
72
	 * @since   1.0
73
	 */
74
	public function testHasItem()
75
	{
76
		$this->markTestIncomplete();
77
	}
78
79
	/**
80
	 * Tests the Joomla\Cache\Wincache::getItem method.
81
	 *
82
	 * @return  void
83
	 *
84
	 * @covers  Joomla\Cache\Wincache::getItem
85
	 * @since   1.0
86
	 */
87
	public function testGetItem()
88
	{
89
		$this->markTestIncomplete();
90
	}
91
92
	/**
93
	 * Tests the Joomla\Cache\Wincache::deleteItem method.
94
	 *
95
	 * @return  void
96
	 *
97
	 * @covers  Joomla\Cache\Wincache::deleteItem
98
	 * @since   1.0
99
	 */
100
	public function testDeleteItem()
101
	{
102
		$this->markTestIncomplete();
103
	}
104
105
	/**
106
	 * Tests the Joomla\Cache\Wincache::set method.
107
	 *
108
	 * @return  void
109
	 *
110
	 * @covers  Joomla\Cache\Wincache::set
111
	 * @since   1.0
112
	 */
113
	public function testSet()
114
	{
115
		$this->markTestIncomplete();
116
	}
117
118
	/**
119
	 * Setup the tests.
120
	 *
121
	 * @return  void
122
	 *
123
	 * @since   1.0
124
	 */
125
	protected function setUp()
126
	{
127
		parent::setUp();
128
129
		try
130
		{
131
			$this->instance = new Cache\Wincache;
132
		}
133
		catch (\Exception $e)
134
		{
135
			$this->markTestSkipped();
136
		}
137
	}
138
}
139