Skip to content

Commit 9a53bb2

Browse files
committed
fix(main): fix tests
1 parent 547bde5 commit 9a53bb2

File tree

2 files changed

+18
-17
lines changed

2 files changed

+18
-17
lines changed

tests/PapiMethodsFileTest.php

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@ protected function setUp(): void
1717

1818
public function testValidFilePath()
1919
{
20-
$this->assertTrue(PapiMethods::validFilePath($this->papi_dir.'/phpunit.xml'));
21-
$this->assertFalse(PapiMethods::validFilePath($this->papi_dir.'/app'));
22-
$this->assertFalse(PapiMethods::validFilePath($this->papi_dir.'/unknown'));
20+
$this->assertTrue(PapiMethods::validFilePath($this->papi_dir . '/phpunit.xml'));
21+
$this->assertFalse(PapiMethods::validFilePath($this->papi_dir . '/app'));
22+
$this->assertFalse(PapiMethods::validFilePath($this->papi_dir . '/unknown'));
2323
}
2424

2525
public function testSpecTestDirectory()
@@ -34,7 +34,7 @@ public function testSpecTestDirectory()
3434

3535
public function testScanDirRecursively()
3636
{
37-
$files = PapiMethods::scandirRecursively(getcwd().'/bin');
37+
$files = PapiMethods::scandirRecursively(getcwd() . '/bin');
3838

3939
$this->assertCount(1, $files);
4040
$this->assertEquals($files[0], 'papi');
@@ -67,19 +67,19 @@ public function testValidExtension()
6767

6868
public function testSpecFilesInDir()
6969
{
70-
$examples_dir = $this->papi_dir.'/examples';
70+
$examples_dir = $this->papi_dir . '/examples';
7171

72-
$files = PapiMethods::specFilesInDir($examples_dir.'/reference/PetStore', 'json');
73-
$this->assertCount(2, $files);
72+
$files = PapiMethods::specFilesInDir($examples_dir . '/reference/PetStore', 'json');
73+
$this->assertCount(3, $files);
7474

75-
$files = PapiMethods::specFilesInDir($examples_dir.'/reference/PetStore', 'js');
75+
$files = PapiMethods::specFilesInDir($examples_dir . '/reference/PetStore', 'js');
7676
$this->assertCount(0, $files);
7777
}
7878

7979
public function testSpecNameAndVersion()
8080
{
81-
$spec_file = $this->papi_dir.'/examples/reference/PetStore/PetStore.2021-07-23.json';
82-
81+
$spec_file = $this->papi_dir . '/examples/reference/PetStore/PetStore.2021-07-23.json';
82+
8383
$results = PapiMethods::specNameAndVersion($spec_file);
8484

8585
$this->assertEquals($results[0], 'PetStore');

tests/PapiMethodsMiscTest.php

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
namespace Tests;
44

55
use App\Methods\PapiMethods;
6-
use cebe\openapi\spec\OpenApi;
76
use PHPUnit\Framework\TestCase;
7+
use cebe\openapi\spec\OpenApi;
88

99
class PapiMethodsMiscTest extends TestCase
1010
{
@@ -75,7 +75,7 @@ public function testMatchingOperationKeys()
7575
]
7676
]
7777
]);
78-
78+
7979
$results = [];
8080

8181
foreach (PapiMethods::matchingOperationKeys($openapi_a, $openapi_b) as $index => $result) {
@@ -109,7 +109,7 @@ public function testFullyQualifiedClassName()
109109

110110
public function testModels()
111111
{
112-
$models_dir = $this->papi_dir.'/examples/models/2021-07-23';
112+
$models_dir = $this->papi_dir . '/examples/models/2021-07-23';
113113

114114
$results = PapiMethods::models($models_dir, 'json');
115115

@@ -120,7 +120,7 @@ public function testModels()
120120

121121
public function testOperations()
122122
{
123-
$spec_file = $this->papi_dir.'/examples/reference/PetStore/PetStore.2021-07-23.json';
123+
$spec_file = $this->papi_dir . '/examples/reference/PetStore/PetStore.2021-07-23.json';
124124

125125
$results = PapiMethods::operationsKeys($spec_file);
126126

@@ -217,20 +217,21 @@ public function testSpecPathToSegments()
217217

218218
public function testVersionsEqualToOrBelow()
219219
{
220-
$spec_dir = $this->papi_dir.'/examples/reference/PetStore';
220+
$spec_dir = $this->papi_dir . '/examples/reference/PetStore';
221221

222222
$this->assertEquals(
223223
[
224224
'2021-07-24',
225-
'2021-07-23'
225+
'2021-07-23',
226+
'2021-07-23-changed'
226227
],
227228
PapiMethods::versionsEqualToOrBelow($spec_dir, '2021-07-24', 'json')
228229
);
229230
}
230231

231232
public function testVersionsBetween()
232233
{
233-
$spec_dir = $this->papi_dir.'/examples/reference/PetStore';
234+
$spec_dir = $this->papi_dir . '/examples/reference/PetStore';
234235

235236
$this->assertEquals(
236237
[],

0 commit comments

Comments
 (0)