Passed
Push — main ( bedd05...a09f23 )
by Siad
06:47
created

StopwatchTaskTest   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Importance

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

3 Methods

Rating   Name   Duplication   Size   Complexity  
A setUp() 0 7 2
A testStopwatch() 0 3 1
A testStopwatchFails() 0 3 1
1
<?php
2
3
/**
4
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
5
 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
6
 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
7
 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
8
 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
9
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
10
 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
11
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
12
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
13
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
14
 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
15
 *
16
 * This software consists of voluntary contributions made by many individuals
17
 * and is licensed under the LGPL. For more information please see
18
 * <http://phing.info>.
19
 */
20
21
namespace Phing\Test\Task\Optional;
22
23
use Phing\Test\Support\BuildFileTest;
24
use Symfony\Component\Stopwatch\Stopwatch;
25
26
/**
27
 * Test for StopwatchTask
28
 * @author Siad Ardroumli <[email protected]>
29
 */
30
class StopwatchTaskTest extends BuildFileTest
31
{
32
    /**
33
     * Sets up the fixture.
34
     * @throws \Phing\Io\IOException
35
     */
36
    public function setUp(): void
37
    {
38
        if (!class_exists('Symfony\\Component\\Stopwatch\\Stopwatch')) {
39
            $this->markTestSkipped('Need stopwatch installed to test');
40
        }
41
42
        $this->configureProject(PHING_TEST_BASE . '/etc/tasks/ext/StopwatchTaskTest.xml');
43
    }
44
45
    public function testStopwatch()
46
    {
47
        $this->expectLogContaining(__FUNCTION__, 'Category:   test-cat');
48
    }
49
50
    public function testStopwatchFails()
51
    {
52
        $this->expectBuildExceptionContaining(__FUNCTION__, 'method does not exists', 'Method foo does not exist');
53
    }
54
}
55