Skip to content

Conversation

@artengin
Copy link
Contributor

Refs: #221

@DenTray DenTray requested a review from Copilot November 4, 2025 09:54
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds conditional creation of DatabaseSeeder.php and updates test fixtures to handle both scenarios: when the DatabaseSeeder file already exists and when it needs to be created from scratch.

  • Added a file existence check before creating DatabaseSeeder
  • Created new test case for when DatabaseSeeder already exists
  • Replaced outdated documentation reference to removed config path

Reviewed Changes

Copilot reviewed 6 out of 7 changed files in this pull request and generated no comments.

Show a summary per file
File Description
src/Generators/SeederGenerator.php Added conditional check to only create DatabaseSeeder if it doesn't exist
tests/SeederGeneratorTest.php Switched from RepositoryMockTrait to SeederGeneratorMockTrait and added test for existing DatabaseSeeder scenario
tests/Support/Seeder/SeederGeneratorMockTrait.php New trait to mock filesystem with existing DatabaseSeeder for testing
tests/fixtures/SeederGeneratorTest/database_seeder_created.php Fixture representing newly created DatabaseSeeder with PostSeeder
tests/fixtures/SeederGeneratorTest/database_seeder_existing.php Fixture representing existing DatabaseSeeder with AuthorSeeder
tests/fixtures/SeederGeneratorTest/database_seeder_modified.php Fixture representing existing DatabaseSeeder modified to include both AuthorSeeder and PostSeeder
ReadMe.md Removed outdated 'seeds' path config reference

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@DenTray DenTray assigned artengin and unassigned DenTray Nov 4, 2025
@DenTray DenTray requested a review from Copilot November 4, 2025 10:02
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

Copilot reviewed 6 out of 7 changed files in this pull request and generated 1 comment.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@artengin artengin assigned DenTray and unassigned artengin Nov 4, 2025
@DenTray DenTray requested a review from Copilot November 10, 2025 03:53
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

Copilot reviewed 6 out of 7 changed files in this pull request and generated no new comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +14 to +26
$structure = [
'database' => [
'seeders' => [],
],
];

$root = vfsStream::setup('root', null, $structure);

$databaseSeederContent = file_get_contents(getcwd() . '/tests/fixtures/SeederGeneratorTest/existed_database_seeder.php');

vfsStream::newFile('database/seeders/DatabaseSeeder.php')
->at($root)
->setContent($databaseSeederContent);
Copy link
Collaborator

Choose a reason for hiding this comment

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

could we use an already implemented way?

        $fileSystemMock = new FileSystemMock();
        $fileSystemMock->seeders = [
            'DatabaseSeeder.php' => file_get_contents(getcwd() . '/tests/fixtures/SeederGeneratorTest/existed_database_seeder.php'),
        ];

        $fileSystemMock->setStructure();

@DenTray DenTray assigned artengin and unassigned DenTray Nov 10, 2025
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.

4 participants