Skip to content

Commit 94af429

Browse files
committed
Test: Improve FileHandler coverage
1 parent 2fb7133 commit 94af429

File tree

1 file changed

+19
-20
lines changed

1 file changed

+19
-20
lines changed

tests/system/Cache/Handlers/FileHandlerTest.php

Lines changed: 19 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,17 @@
11
<?php
22
namespace CodeIgniter\Cache\Handlers;
33

4-
set_error_handler(function (int $errno, string $errstr, string $errfile, int $errline, array $errcontext)
5-
{
4+
set_error_handler(function (int $errno, string $errstr, string $errfile, int $errline, array $errcontext) {
65
//throw new \ErrorException($errstr, $errno, 0, $errfile, $errline);
76
});
87

98
class FileHandlerTest extends \CIUnitTestCase
109
{
1110

1211
private static $directory = 'FileHandler';
13-
private static $key1 = 'key1';
14-
private static $key2 = 'key2';
15-
private static $key3 = 'key3';
12+
private static $key1 = 'key1';
13+
private static $key2 = 'key2';
14+
private static $key3 = 'key3';
1615

1716
private static function getKeyArray()
1817
{
@@ -32,10 +31,10 @@ protected function setUp()
3231
parent::setUp();
3332

3433
//Initialize path
35-
$this->config = new \Config\Cache();
34+
$this->config = new \Config\Cache();
3635
$this->config->storePath .= self::$directory;
3736

38-
if ( ! is_dir($this->config->storePath))
37+
if (! is_dir($this->config->storePath))
3938
{
4039
mkdir($this->config->storePath, 0777, true);
4140
}
@@ -80,7 +79,7 @@ public function testNewWithNonWritablePath()
8079
public function testSetDefaultPath()
8180
{
8281
//Initialize path
83-
$config = new \Config\Cache();
82+
$config = new \Config\Cache();
8483
$config->storePath = null;
8584

8685
$this->fileHandler = new FileHandler($config);
@@ -131,8 +130,8 @@ public function testDecrement()
131130
$this->fileHandler->save(self::$key1, 10);
132131
$this->fileHandler->save(self::$key2, 'value');
133132

134-
// Line following commented out to force the cache to add a zero entry for key3
135-
// $this->fileHandler->save(self::$key3, 0);
133+
// Line following commented out to force the cache to add a zero entry for key3
134+
// $this->fileHandler->save(self::$key3, 0);
136135

137136
$this->assertSame(9, $this->fileHandler->decrement(self::$key1, 1));
138137
$this->assertFalse($this->fileHandler->decrement(self::$key2, 1));
@@ -170,7 +169,7 @@ public function testGetCacheInfo()
170169

171170
$actual = $this->fileHandler->getCacheInfo();
172171
$this->assertArrayHasKey(self::$key1, $actual);
173-
$this->assertEquals(self::$key1,$actual[self::$key1]['name']);
172+
$this->assertEquals(self::$key1, $actual[self::$key1]['name']);
174173
$this->assertArrayHasKey('server_path', $actual[self::$key1]);
175174
}
176175

@@ -206,7 +205,7 @@ final class BaseTestFileHandler extends FileHandler
206205

207206
public function __construct()
208207
{
209-
$this->config = new \Config\Cache();
208+
$this->config = new \Config\Cache();
210209
$this->config->storePath .= self::$directory;
211210

212211
parent::__construct($this->config);
@@ -218,14 +217,14 @@ public function getFileInfoTest()
218217
stream_get_meta_data($tmp_handle)['uri'];
219218

220219
return $this->getFileInfo(stream_get_meta_data($tmp_handle)['uri'], [
221-
'name',
222-
'server_path',
223-
'size',
224-
'date',
225-
'readable',
226-
'writable',
227-
'executable',
228-
'fileperms',
220+
'name',
221+
'server_path',
222+
'size',
223+
'date',
224+
'readable',
225+
'writable',
226+
'executable',
227+
'fileperms',
229228
]);
230229
}
231230

0 commit comments

Comments
 (0)