-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add factory tests #68
Conversation
# Conflicts: # phpunit.xml # tests/Support/NovaTestMockTrait.php
# Conflicts: # phpunit.xml # tests/Support/NovaTestMockTrait.php # tests/TestCase.php
src/Generators/FactoryGenerator.php
Outdated
@@ -84,13 +94,9 @@ protected function generateToGenericClass(): string | |||
return $createMessage; | |||
} | |||
|
|||
public function generate(): void | |||
protected function allowedToCreateFactoryInSeparateClass(): bool |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we can fully remove this logic as now package requires Laravel 11
|
||
use Exception; | ||
|
||
class FakerMethodNotFound extends Exception |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
class FakerMethodNotFound extends Exception | |
class FakerMethodNotFoundException extends Exception |
{ | ||
use GeneratorMockTrait, MockTrait; | ||
|
||
public function getFactoryGeneratorMockForExistingFactory(): void |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
public function getFactoryGeneratorMockForExistingFactory(): void | |
public function mockFactoryGenerator(...$functionCalls): void |
public function getFactoryGeneratorMockForExistingFactory(): void | ||
{ | ||
$this->mockClass(FactoryGenerator::class, [ | ||
[ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please use special helpers for this as it using inside the controller generator test
'app' => [ | ||
'Models' => [ | ||
'Post.php' => file_get_contents(getcwd() . '/tests/Support/Factory/Post.php'), | ||
'User.php' => '<?php', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please use special helper for it as it implemented in ControllerGenerator mock trait
$structure = [ | ||
'app' => [ | ||
'Models' => [ | ||
'Post.php' => file_get_contents(getcwd() . '/tests/Support/Factory/Post.php'), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is it necessary to use real content? or we can use any php content as in the model?
refs: #49
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please resolve conflicts
# Conflicts: # src/Generators/FactoryGenerator.php
refs: #49
Issue #49