Code Duplication    Length = 20-20 lines in 2 locations

tests/ProcessRegistryTest.php 2 locations

@@ 131-150 (lines=20) @@
128
     *
129
     * @return void
130
     */
131
    public function addOverMaxGlobalProcessesOnSameHost()
132
    {
133
        $pipes = [];
134
        $process = proc_open('sleep 10 &', self::getDevNullProcOpenDescriptors(), $pipes);
135
        $status = proc_get_status($process);
136
        if (!$status['running']) {
137
            $this->markTestSkipped('Unable to start sleep process.');
138
            return;
139
        }
140
141
        $initalTask = [
142
            '_id' => 'testId',
143
            'hosts' => [HOSTNAME => [$status['pid'] => time() + 60]],
144
            'version' => new ObjectID(),
145
        ];
146
147
        $this->collection->insertOne($initalTask);
148
149
        $this->assertFalse($this->registry->add($this->getProcess('testId', PHP_INT_MAX, 1, PHP_INT_MAX)));
150
    }
151
152
    /**
153
     * @test
@@ 158-177 (lines=20) @@
155
     *
156
     * @return void
157
     */
158
    public function addOverMaxHostProcesses()
159
    {
160
        $pipes = [];
161
        $process = proc_open('sleep 10 &', self::getDevNullProcOpenDescriptors(), $pipes);
162
        $status = proc_get_status($process);
163
        if (!$status['running']) {
164
            $this->markTestSkipped('Unable to start sleep process.');
165
            return;
166
        }
167
168
        $initalTask = [
169
            '_id' => 'testId',
170
            'hosts' => [HOSTNAME => [$status['pid'] => time() + 60]],
171
            'version' => new ObjectID(),
172
        ];
173
174
        $this->collection->insertOne($initalTask);
175
176
        $this->assertFalse($this->registry->add($this->getProcess('testId', PHP_INT_MAX, PHP_INT_MAX, 1)));
177
    }
178
179
    /**
180
     * @test