Passed
Push — main ( 58ef3e...be0a65 )
by Michiel
07:16
created

HasFreeSpaceConditionTest   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 6
eloc 9
dl 0
loc 32
rs 10
c 1
b 0
f 0

6 Methods

Rating   Name   Duplication   Size   Complexity  
A testInvalidPartition() 0 3 1
A testNeededNotSet() 0 3 1
A testNotEnoughSpace() 0 4 1
A testPartitionNotSet() 0 3 1
A testEnoughSpace() 0 4 1
A setUp() 0 3 1
1
<?php
2
3
namespace Phing\Task\System\Condition;
4
5
use Phing\Test\Support\BuildFileTest;
6
7
class HasFreeSpaceConditionTest extends BuildFileTest
8
{
9
    public function setUp(): void
10
    {
11
        $this->configureProject(PHING_TEST_BASE . '/etc/tasks/system/HasFreeSpaceConditionTest.xml');
12
    }
13
14
    public function testPartitionNotSet()
15
    {
16
        $this->expectBuildExceptionContaining(__FUNCTION__, __FUNCTION__, 'Please set the partition attribute.');
17
    }
18
19
    public function testNeededNotSet()
20
    {
21
        $this->expectBuildExceptionContaining(__FUNCTION__, __FUNCTION__, 'Please set the needed attribute.');
22
    }
23
24
    public function testInvalidPartition()
25
    {
26
        $this->expectBuildExceptionContaining(__FUNCTION__, __FUNCTION__, 'disk_free_space(): No such file or directory');
27
    }
28
29
    public function testEnoughSpace()
30
    {
31
        $this->executeTarget(__FUNCTION__);
32
        $this->assertInLogs('HasFreeSpaceConditionTest: Enough space in disk.');
33
    }
34
35
    public function testNotEnoughSpace()
36
    {
37
        $this->executeTarget(__FUNCTION__);
38
        $this->assertInLogs('HasFreeSpaceConditionTest: Not enough space in disk.');
39
    }
40
}
41