Skip to content

Commit

Permalink
feat: remove useless code
Browse files Browse the repository at this point in the history
refs: #49
  • Loading branch information
pirs1337 committed Nov 27, 2024
1 parent 0e1496b commit 7aa73ba
Showing 1 changed file with 17 additions and 5 deletions.
22 changes: 17 additions & 5 deletions tests/FactoryGeneratorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,25 +16,37 @@ class FactoryGeneratorTest extends TestCase

public function testModelNotExists()
{
$this->expectException(ClassNotExistsException::class);
$this->expectExceptionMessage("Cannot create PostFactory cause Post Model does not exists. "
. "Create a Post Model by itself or run command 'php artisan make:entity Post --only-model'.");
Event::fake();

$this->assertExceptionThrew(
className: ClassNotExistsException::class,
message: "Cannot create PostFactory cause Post Model does not exists. "
. "Create a Post Model by itself or run command 'php artisan make:entity Post --only-model'."
);

app(FactoryGenerator::class)
->setModel('Post')
->generate();

Event::assertNothingDispatched();
}

public function testFactoryClassExists()
{
$this->expectException(ClassAlreadyExistsException::class);
$this->expectExceptionMessage("Cannot create PostFactory cause PostFactory already exists. Remove PostFactory.");
Event::fake();

$this->assertExceptionThrew(
className: ClassAlreadyExistsException::class,
message: "Cannot create PostFactory cause PostFactory already exists. Remove PostFactory.",
);

$this->getFactoryGeneratorMockForExistingFactory();

app(FactoryGenerator::class)
->setModel('Post')
->generate();

Event::assertNothingDispatched();
}

public function testProcessUnknownFieldType()
Expand Down

0 comments on commit 7aa73ba

Please sign in to comment.