Skip to content

Commit 694ee92

Browse files
committed
refactor: tests
refs: #49
1 parent 14abfa0 commit 694ee92

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

tests/ModelGeneratorTest.php

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,10 @@ public function testModelAlreadyExists()
1616
{
1717
$this->mockGeneratorForExistingModel();
1818

19-
$this->expectException(ClassAlreadyExistsException::class);
20-
$this->expectExceptionMessage('Cannot create Post Model cause Post Model already exists. Remove Post Model.');
19+
$this->assertExceptionThrew(
20+
className: ClassAlreadyExistsException::class,
21+
message: 'Cannot create Post Model cause Post Model already exists. Remove Post Model.',
22+
);
2123

2224
app(ModelGenerator::class)
2325
->setModel('Post')
@@ -26,9 +28,11 @@ public function testModelAlreadyExists()
2628

2729
public function testRelationModelMissing()
2830
{
29-
$this->expectException(ClassNotExistsException::class);
30-
$this->expectExceptionMessage("Cannot create Post Model cause relation model Comment does not exist. "
31-
. "Create the Comment Model by himself or run command 'php artisan make:entity Comment --only-model'.");
31+
$this->assertExceptionThrew(
32+
className: ClassNotExistsException::class,
33+
message: "Cannot create Post Model cause relation model Comment does not exist. "
34+
. "Create the Comment Model by himself or run command 'php artisan make:entity Comment --only-model'.",
35+
);
3236

3337
app(ModelGenerator::class)
3438
->setModel('Post')

0 commit comments

Comments
 (0)