Skip to content

Commit c66e17f

Browse files
committed
refact: fill temp file
1 parent d4e2519 commit c66e17f

File tree

3 files changed

+26
-15
lines changed

3 files changed

+26
-15
lines changed

tests/SwaggerServiceTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,12 @@
1515
use RonasIT\AutoDoc\Tests\Support\Mock\TestNotificationSetting;
1616
use RonasIT\AutoDoc\Tests\Support\Mock\TestRequest;
1717
use RonasIT\AutoDoc\Tests\Support\Traits\SwaggerServiceMockTrait;
18+
use RonasIT\AutoDoc\Tests\Support\Traits\SwaggerServiceTestingTrait;
1819
use stdClass;
1920

2021
class SwaggerServiceTest extends TestCase
2122
{
22-
use SwaggerServiceMockTrait;
23+
use SwaggerServiceMockTrait, SwaggerServiceTestingTrait;
2324

2425
public function testConstructorInvalidConfigVersion()
2526
{

tests/support/Traits/SwaggerServiceMockTrait.php

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -68,18 +68,4 @@ protected function mockDriverSaveData($driverClass = LocalDriver::class): void
6868
$this->functionCall('saveData'),
6969
]);
7070
}
71-
72-
protected function fillTempFile(string $content): void
73-
{
74-
file_put_contents(getcwd() . '/storage/temp_documentation.json', $content);
75-
}
76-
77-
protected function assertTempFileEqualsFixture(string $fixture): void
78-
{
79-
$fixture = $this->prepareFixtureName($fixture);
80-
81-
$path = $this->generateFixturePath($fixture);
82-
83-
$this->assertFileEquals($path, getcwd() . '/storage/temp_documentation.json');
84-
}
8571
}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<?php
2+
3+
namespace RonasIT\AutoDoc\Tests\Support\Traits;
4+
5+
use RonasIT\Support\Traits\MockTrait;
6+
7+
trait SwaggerServiceTestingTrait
8+
{
9+
use MockTrait;
10+
11+
protected function fillTempFile(string $content): void
12+
{
13+
file_put_contents(getcwd() . '/storage/temp_documentation.json', $content);
14+
}
15+
16+
protected function assertTempFileEqualsFixture(string $fixture): void
17+
{
18+
$fixture = $this->prepareFixtureName($fixture);
19+
20+
$path = $this->generateFixturePath($fixture);
21+
22+
$this->assertFileEquals($path, getcwd() . '/storage/temp_documentation.json');
23+
}
24+
}

0 commit comments

Comments
 (0)