Skip to content

Commit b2d06d2

Browse files
committed
refactor: use TestingTrait from helpers
1 parent 322c173 commit b2d06d2

File tree

6 files changed

+11
-21
lines changed

6 files changed

+11
-21
lines changed

composer.lock

Lines changed: 6 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tests/AutoDocControllerTest.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,9 @@
44

55
use Illuminate\Http\Response;
66
use phpmock\phpunit\PHPMock;
7-
use RonasIT\Support\Traits\MockTrait;
87

98
class AutoDocControllerTest extends TestCase
109
{
11-
use MockTrait;
1210
use PHPMock;
1311

1412
protected static array $documentation;

tests/LocalDriverTest.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -126,9 +126,7 @@ public function testGetDocumentation()
126126

127127
public function testGetDocumentationFileNotExists()
128128
{
129-
$this->expectException(FileNotFoundException::class);
130-
131-
$this->expectExceptionMessageMatches('/^Documentation file not found not_exists_file$/');
129+
$this->assertExceptionThrew(FileNotFoundException::class, 'Documentation file not found not_exists_file');
132130

133131
config(['auto-doc.drivers.local.production_path' => 'not_exists_file']);
134132

tests/RemoteDriverTest.php

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,9 @@
55
use RonasIT\AutoDoc\Drivers\RemoteDriver;
66
use RonasIT\AutoDoc\Exceptions\MissedRemoteDocumentationUrlException;
77
use RonasIT\AutoDoc\Exceptions\FileNotFoundException;
8-
use RonasIT\Support\Traits\MockTrait;
98

109
class RemoteDriverTest extends TestCase
1110
{
12-
use MockTrait;
13-
1411
protected static array $tmpData;
1512
protected static RemoteDriver $remoteDriverClass;
1613
protected static string $tmpDocumentationFilePath;
@@ -151,9 +148,7 @@ public function testGetDocumentation()
151148

152149
public function testGetDocumentationNoFile()
153150
{
154-
$this->expectException(FileNotFoundException::class);
155-
156-
$this->expectExceptionMessageMatches('/^Documentation file not found $/');
151+
$this->assertExceptionThrew(FileNotFoundException::class, 'Documentation file not found ');
157152

158153
config(['auto-doc.drivers.remote.key' => 'mocked_key']);
159154
config(['auto-doc.drivers.remote.url' => 'mocked_url']);

tests/StorageDriverTest.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -120,9 +120,7 @@ public function testGetDocumentation()
120120

121121
public function testGetDocumentationFileNotExists()
122122
{
123-
$this->expectException(FileNotFoundException::class);
124-
125-
$this->expectExceptionMessageMatches('/^Documentation file not found documentation.json$/');
123+
$this->assertExceptionThrew(FileNotFoundException::class, 'Documentation file not found documentation.json');
126124

127125
self::$storageDriverClass->getDocumentation();
128126
}

tests/TestCase.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,10 @@
1313
use RonasIT\AutoDoc\Tests\Support\Mock\TestController;
1414
use Symfony\Component\HttpFoundation\Request as SymfonyRequest;
1515
use Symfony\Component\HttpFoundation\Response;
16-
16+
use RonasIT\Support\Traits\TestingTrait;
1717
class TestCase extends BaseTest
1818
{
19+
use TestingTrait;
1920
protected bool $globalExportMode = false;
2021

2122
public function setUp(): void

0 commit comments

Comments
 (0)