Code Duplication    Length = 21-21 lines in 2 locations

src/Kunstmaan/AdminBundle/Tests/unit/Helper/VersionCheck/VersionCheckTest.php 2 locations

@@ 182-202 (lines=21) @@
179
     * @throws \Kunstmaan\AdminBundle\Helper\VersionCheck\Exception\ParseException
180
     * @throws \ReflectionException
181
     */
182
    public function testCheckGetPackagesThrowsExceptionWhenNoPackagesInLock()
183
    {
184
        $currentPath = getcwd();
185
        if(strpos($currentPath, 'src') !== false) {
186
            $currentPath = strstr($currentPath, 'src', true);
187
        }
188
        $path = realpath($currentPath.'/src/Kunstmaan/AdminBundle/Tests/Helper/VersionCheck');
189
        $this->expectException(Exception::class);
190
        $trans = $this->createMock(Translator::class);
191
        $kernel = $this->createMock(Kernel::class);
192
        $trans->expects($this->any())->method('trans')->willReturn('algo en una differente idioma');
193
        $kernel->expects($this->once())->method('getRootDir')->willReturn($path);
194
        $this->container->expects($this->any())->method('get')->will(
195
            $this->onConsecutiveCalls($trans, $kernel)
196
        );
197
198
        $mirror = new ReflectionClass(VersionChecker::class);
199
        $method = $mirror->getMethod('getPackages');
200
        $method->setAccessible(true);
201
        $method->invoke($this->object);
202
    }
203
204
    /**
205
     * @throws \Kunstmaan\AdminBundle\Helper\VersionCheck\Exception\ParseException
@@ 208-228 (lines=21) @@
205
     * @throws \Kunstmaan\AdminBundle\Helper\VersionCheck\Exception\ParseException
206
     * @throws \ReflectionException
207
     */
208
    public function testCheckGetPackagesThrowsExceptionWithBadJson()
209
    {
210
        $currentPath = getcwd();
211
        if(strpos($currentPath, 'src') !== false) {
212
            $currentPath = strstr($currentPath, 'src', true);
213
        }
214
        $path = realpath($currentPath.'/src/Kunstmaan/AdminBundle/Tests/Helper');
215
        $this->expectException(Exception::class);
216
        $trans = $this->createMock(Translator::class);
217
        $kernel = $this->createMock(Kernel::class);
218
        $trans->expects($this->any())->method('trans')->willReturn('algo en una differente idioma');
219
        $kernel->expects($this->once())->method('getRootDir')->willReturn($path);
220
        $this->container->expects($this->any())->method('get')->will(
221
            $this->onConsecutiveCalls($trans, $kernel)
222
        );
223
224
        $mirror = new ReflectionClass(VersionChecker::class);
225
        $method = $mirror->getMethod('getPackages');
226
        $method->setAccessible(true);
227
        $method->invoke($this->object);
228
    }
229
}
230