Passed
Pull Request — master (#33)
by Joao
01:37
created

ApiTestCaseNew::setUp()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 9

Duplication

Lines 9
Ratio 100 %

Importance

Changes 0
Metric Value
dl 9
loc 9
rs 9.9666
c 0
b 0
f 0
cc 2
nc 2
nop 0
1
<?php
2
3
namespace ByJG\ApiTools;
4
5
use ByJG\ApiTools\Base\BaseTestCase;
6
use ByJG\ApiTools\Base\Schema;
7
use ByJG\ApiTools\Exception\GenericSwaggerException;
8
use GuzzleHttp\GuzzleException;
9
10
/**
11
 * Class ApiTestCaseNew
12
 *
13
 * Use this class if you are using PHPUnit 8.5 or higher
14
 */
15 View Code Duplication
abstract class ApiTestCaseNew extends BaseTestCase
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
16
{
17
    /** @var string|null */
18
    protected $filePath;
19
20
    /**
21
     * @throws GenericSwaggerException
22
     */
23
    protected function setUp(): void
24
    {
25
        // load and configure the schema if a path is set
26
        if (!empty($this->filePath)) {
27
            $data = file_get_contents($this->filePath);
28
            $schema = Schema::getInstance($data);
29
            $this->setSchema($schema);
30
        }
31
    }
32
}
33