Test Failed
Push — main ( bf77ba...401323 )
by Teodoro
03:31 queued 41s
created

TaskTest::isTerminated()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 4
nc 1
nop 0
dl 0
loc 7
rs 10
c 1
b 0
f 0
1
<?php
2
3
namespace Tleckie\Async\Tests;
4
5
use PHPUnit\Framework\MockObject\MockObject;
6
use PHPUnit\Framework\TestCase;
7
use Symfony\Component\Process\Process;
8
use Tleckie\Async\Encoder;
9
use Tleckie\Async\Task;
10
11
/**
12
 * Class TaskTest
13
 *
14
 * @package Tleckie\Async\Tests
15
 * @author  Teodoro Leckie Westberg <[email protected]>
16
 */
17
class TaskTest extends TestCase
18
{
19
    /** @var Task */
20
    private Task $task;
21
22
    /** @var Process|MockObject */
23
    private Process $processMock;
24
25
26
    public function setUp(): void
27
    {
28
        $this->processMock = $this->createMock(Process::class);
29
30
        $this->task = new Task(
31
            $this->processMock,
32
            new Encoder(),
33
            1
34
        );
35
    }
36
37
    /**
38
     * @test
39
     */
40
    public function isRunning(): void
41
    {
42
        $this->processMock->expects(static::once())
1 ignored issue
show
Bug introduced by
The method expects() does not exist on Symfony\Component\Process\Process. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

42
        $this->processMock->/** @scrutinizer ignore-call */ 
43
                            expects(static::once())

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
43
            ->method('isRunning')
44
            ->willReturn(true);
45
46
        static::assertTrue($this->task->isRunning());
47
    }
48
49
    /**
50
     * @test
51
     */
52
    public function isSuccessful(): void
53
    {
54
        $this->processMock->expects(static::once())
55
            ->method('isSuccessful')
56
            ->willReturn(true);
57
58
        static::assertTrue($this->task->isSuccessful());
59
    }
60
61
    /**
62
     * @test
63
     */
64
    public function isTerminated(): void
65
    {
66
        $this->processMock->expects(static::once())
67
            ->method('isTerminated')
68
            ->willReturn(true);
69
70
        static::assertTrue($this->task->isTerminated());
71
    }
72
}