Completed
Branch master (097db7)
by Bill
02:15
created

FileSystemTest::removeTempFolder()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 7
rs 9.4285
c 0
b 0
f 0
cc 2
eloc 4
nc 2
nop 0
1
<?php
2
3
abstract class FileSystemTest extends PHPUnit_Framework_TestCase
4
{
5
6
	protected $path = __DIR__ . '/temp';
7
8
    protected function createTempFolder()
9
    {
10
        mkdir($this->path, 0700, true);
11
    }
12
13
    protected function removeTempFolder()
14
    {
15
        if (file_exists($this->path)) {
16
            array_map('unlink', glob($this->path . '/' . '{,.}[!.,!..]*',GLOB_MARK|GLOB_BRACE));
17
            rmdir($this->path);
18
        }
19
    }
20
21
    public function setup()
22
    {
23
    	parent::setup();
24
        $this->removeTempFolder();
25
        $this->createTempFolder();
26
    }
27
28
    public function teardown()
29
    {
30
    	parent::teardown();
31
        $this->removeTempFolder();
32
    }
33
}
34