Code Duplication    Length = 21-23 lines in 2 locations

tests/unit/PoolTest.php 1 location

@@ 131-151 (lines=21) @@
128
        $this->assertEquals($this->process, $run->getProcess());
129
    }
130
131
    public function testSuccessfulRun()
132
    {
133
        $run = Mockery::mock(RunInterface::class);
134
        $run->shouldReceive('isRunning')
135
            ->andReturn(false);
136
        $run->shouldReceive('poll')
137
            ->andReturn(true, false);
138
        $run->shouldReceive('hasStarted')
139
            ->andReturn(true);
140
        $run->shouldReceive('isSuccessful')
141
            ->andReturn(true);
142
143
        $pool = new Pool([$run]);
144
145
        $run->shouldReceive('start');
146
        $pool->run(0);
147
148
        $this->assertTrue($pool->hasStarted());
149
        $this->assertFalse($pool->isRunning());
150
        $this->assertTrue($pool->isSuccessful());
151
    }
152
153
    /**
154
     * @expectedException \Graze\ParallelProcess\Exceptions\NotRunningException

tests/unit/RunTest.php 1 location

@@ 89-111 (lines=23) @@
86
        $this->assertFalse($run->isSuccessful());
87
    }
88
89
    public function testRun()
90
    {
91
        $process = Mockery::mock(Process::class);
92
        $process->shouldReceive('stop');
93
94
        $run = new Run($process);
95
96
        $process->shouldReceive('isRunning')
97
                ->andReturn(false, true, false);
98
99
        $process->shouldReceive('start');
100
        $run->start();
101
102
        $process->shouldReceive('isStarted')
103
                ->andReturn(true);
104
        $process->shouldReceive('isSuccessful')
105
                ->andReturn(true);
106
107
        $this->assertTrue($run->poll());
108
        $this->assertFalse($run->poll());
109
        $this->assertTrue($run->isSuccessful());
110
        $this->assertTrue($run->hasStarted());
111
    }
112
113
    public function testOnSuccess()
114
    {