@@ 10-27 (lines=18) @@ | ||
7 | use ByJG\ApiTools\Exception\GenericSwaggerException; |
|
8 | use GuzzleHttp\GuzzleException; |
|
9 | ||
10 | abstract class ApiTestCase extends BaseTestCase |
|
11 | { |
|
12 | /** @var string|null */ |
|
13 | protected $filePath; |
|
14 | ||
15 | /** |
|
16 | * @throws GenericSwaggerException |
|
17 | */ |
|
18 | protected function setUp() |
|
19 | { |
|
20 | // load and configure the schema if a path is set |
|
21 | if (!empty($this->filePath)) { |
|
22 | $data = file_get_contents($this->filePath); |
|
23 | $schema = Schema::getInstance($data); |
|
24 | $this->setSchema($schema); |
|
25 | } |
|
26 | } |
|
27 | } |
|
28 |
@@ 15-32 (lines=18) @@ | ||
12 | * |
|
13 | * Use this class if you are using PHPUnit 8.5 or higher |
|
14 | */ |
|
15 | abstract class ApiTestCaseNew extends BaseTestCase |
|
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 |