Skip to content
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

Merged
merged 26 commits into from
Dec 2, 2024
Merged

Add factory tests #68

merged 26 commits into from
Dec 2, 2024

Conversation

KonstantinLapkovsky
Copy link

Issue #49

# Conflicts:
#	phpunit.xml
#	tests/Support/NovaTestMockTrait.php
@KonstantinLapkovsky KonstantinLapkovsky changed the base branch from 49-cover-entity-generator-with-tests to master January 17, 2024 12:10
@KonstantinLapkovsky KonstantinLapkovsky changed the base branch from master to 49-cover-entity-generator-with-tests January 17, 2024 12:11
@AZabolotnikov AZabolotnikov changed the base branch from 49-cover-entity-generator-with-tests to master November 19, 2024 06:57
# Conflicts:
#	phpunit.xml
#	tests/Support/NovaTestMockTrait.php
#	tests/TestCase.php
@AZabolotnikov AZabolotnikov changed the base branch from master to 49-cover-entity-generator-with-tests November 19, 2024 07:30
@AZabolotnikov AZabolotnikov changed the base branch from 49-cover-entity-generator-with-tests to master November 20, 2024 07:51
@AZabolotnikov AZabolotnikov requested review from DenTray and removed request for DenTray November 20, 2024 09:15
@AZabolotnikov AZabolotnikov self-assigned this Nov 20, 2024
@@ -84,13 +94,9 @@ protected function generateToGenericClass(): string
return $createMessage;
}

public function generate(): void
protected function allowedToCreateFactoryInSeparateClass(): bool
Copy link
Collaborator

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

@pirs1337 pirs1337 assigned DenTray and unassigned pirs1337 and AZabolotnikov Nov 27, 2024

use Exception;

class FakerMethodNotFound extends Exception
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
class FakerMethodNotFound extends Exception
class FakerMethodNotFoundException extends Exception

tests/FactoryGeneratorTest.php Show resolved Hide resolved
{
use GeneratorMockTrait, MockTrait;

public function getFactoryGeneratorMockForExistingFactory(): void
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
public function getFactoryGeneratorMockForExistingFactory(): void
public function mockFactoryGenerator(...$functionCalls): void

public function getFactoryGeneratorMockForExistingFactory(): void
{
$this->mockClass(FactoryGenerator::class, [
[
Copy link
Collaborator

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',
Copy link
Collaborator

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'),
Copy link
Collaborator

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?

@DenTray DenTray assigned pirs1337 and unassigned DenTray Nov 27, 2024
@pirs1337 pirs1337 assigned DenTray and unassigned pirs1337 Nov 28, 2024
tests/Support/Factory/FactoryMockTrait.php Outdated Show resolved Hide resolved
Copy link
Collaborator

@DenTray DenTray left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please resolve conflicts

@DenTray DenTray assigned pirs1337 and unassigned DenTray Dec 2, 2024
@pirs1337 pirs1337 assigned DenTray and unassigned pirs1337 Dec 2, 2024
@DenTray DenTray merged commit cc994cd into master Dec 2, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants