Closed curtisdelicata closed 3 months ago
5d000d447a
)[!TIP] I'll email you at genealogysoftwareuk@gmail.com when I complete this pull request!
Here are the GitHub Actions logs prior to making any changes:
91b21b2
Checking composer.json for syntax errors... ✅ composer.json has no syntax errors!
1/1 ✓Checking composer.json for syntax errors... ✅ composer.json has no syntax errors!
Sandbox passed on the latest main
, so sandbox checks will be enabled for this issue.
I found the following snippets in your repository. I will now analyze these snippets and come up with a plan.
tests/Unit/GedcomParserTest.php
✓ https://github.com/liberu-genealogy/laravel-gedcom/commit/e20629370e3f5694c940943cdf37050c7eb746a4 Edit
Create tests/Unit/GedcomParserTest.php with contents:
• Create a new PHPUnit test case class `GedcomParserTest` in the `tests/Unit` directory.
• This class will contain methods to test the parsing of GEDCOM files by the `GedcomParser` class.
• Each method within `GedcomParserTest` should test a specific aspect of the GEDCOM parsing process, such as handling individual records, family records, notes, and media objects.
• Use mock GEDCOM files stored in `tests/Fixtures` to provide input for parsing tests.
• Assert that the parsed data matches expected outcomes, focusing on the integrity of the data structure and the correctness of the parsed information.
tests/Unit/GedcomParserTest.php
✓ Edit
Check tests/Unit/GedcomParserTest.php with contents:
Ran GitHub Actions for e20629370e3f5694c940943cdf37050c7eb746a4:
tests/Unit/GedcomExporterTest.php
✓ https://github.com/liberu-genealogy/laravel-gedcom/commit/db75b73d3998544ab64bfb5faddcdf324dd57cd4 Edit
Modify tests/Unit/GedcomExporterTest.php with contents:
• Create a new PHPUnit test case class `GedcomExporterTest` in the `tests/Unit` directory.
• This class will test the functionality of the `GedcomExporter` class, ensuring that it correctly exports data into GEDCOM format.
• Include tests for exporting individuals, families, notes, and media objects, verifying that the output matches the GEDCOM standard.
• Utilize data providers to supply various data scenarios to the exporter and assert the correctness of the resulting GEDCOM content.
--- +++ @@ -58,3 +58,38 @@ } } ]]> + /** + * @dataProvider exportDataProvider + */ + public function testExportingData($data, $expected) + { + DB::shouldReceive('table')->andReturnSelf(); + View::shouldReceive('make')->andReturnSelf()->shouldReceive('render')->andReturn($expected); + + $this->artisan('gedcom:export', ['filename' => 'exportTest'])->assertExitCode(0); + + Storage::disk('local')->assertExists('public/gedcom/exported/exportTest.GED'); + $this->assertStringContainsString($expected, Storage::disk('local')->get('public/gedcom/exported/exportTest.GED')); + } + + public function exportDataProvider() + { + return [ + 'individuals' => [ + ['type' => 'individuals', 'data' => ['name' => 'John Doe']], + "0 @I1@ INDI\n1 NAME John Doe\n" + ], + 'families' => [ + ['type' => 'families', 'data' => ['id' => 'F1']], + "0 @F1@ FAM\n" + ], + 'notes' => [ + ['type' => 'notes', 'data' => ['content' => 'Note for individual']], + "0 @N1@ NOTE Note for individual\n" + ], + 'media' => [ + ['type' => 'media_objects', 'data' => ['title' => 'Photo of John Doe']], + "0 @M1@ OBJE\n1 TITL Photo of John Doe\n" + ], + ]; + }
tests/Unit/GedcomExporterTest.php
✓ Edit
Check tests/Unit/GedcomExporterTest.php with contents:
Ran GitHub Actions for db75b73d3998544ab64bfb5faddcdf324dd57cd4:
tests/Unit/ImporterTests.php
✓ https://github.com/liberu-genealogy/laravel-gedcom/commit/caa1e305403f070887f675d4f28b996d5d5fc704 Edit
Create tests/Unit/ImporterTests.php with contents:
• Create a PHPUnit test case class `ImporterTests` in the `tests/Unit` directory to test all importer utility classes within the `src/Utils/Importer` directory.
• For each importer class (e.g., `Note.php`, `Obje.php`, `Repo.php`), write specific test methods that verify the correct importation of data from GEDCOM format into the application's data structures.
• Use mock data and assert that the import process correctly populates the models or data structures used within the application.
tests/Unit/ImporterTests.php
✓ Edit
Check tests/Unit/ImporterTests.php with contents:
Ran GitHub Actions for caa1e305403f070887f675d4f28b996d5d5fc704:
composer.json
✓ https://github.com/liberu-genealogy/laravel-gedcom/commit/ed6a6fa4fbc54376a8c35709570b26c6fdfbae5e Edit
Modify composer.json with contents:
• Update the `require-dev` section of `composer.json` to include `"phpunit/phpunit": "^11.0"` to upgrade PHPUnit to version 11.
• This modification ensures that the test suite is compatible with the latest PHPUnit features and functionalities.
• Run `composer update` to update the `composer.lock` file and install PHPUnit 11.
--- +++ @@ -22,6 +22,7 @@ }, "require-dev": { "rector/rector": "*", - "driftingly/rector-laravel": "^0.25.0" + "driftingly/rector-laravel": "^0.25.0", + "phpunit/phpunit": "^11.0" } }
composer.json
✓ Edit
Check composer.json with contents:
Ran GitHub Actions for ed6a6fa4fbc54376a8c35709570b26c6fdfbae5e:
phpunit.xml
✓ https://github.com/liberu-genealogy/laravel-gedcom/commit/c1de5bb16589cc7f0c8782f9574cae571704909a Edit
Create phpunit.xml with contents:
• Create or modify the `phpunit.xml` configuration file to define the test suite configurations.
• Configure PHPUnit to automatically discover test classes within the `tests/Unit` directory.
• Set up any necessary bootstrap files, environment variables, and other configurations required for running the tests.
phpunit.xml
✓ Edit
Check phpunit.xml with contents:
Ran GitHub Actions for c1de5bb16589cc7f0c8782f9574cae571704909a:
I have finished reviewing the code for completeness. I did not find errors for sweep/write_full_tests_a0726
.
💡 To recreate the pull request edit the issue title or description. To tweak the pull request, leave a comment on the pull request.Something wrong? Let us know.
This is an automated message generated by Sweep AI.
Write tests for the whole project using phpunit 11
Checklist
- [X] Create `tests/Unit/GedcomParserTest.php` ✓ https://github.com/liberu-genealogy/laravel-gedcom/commit/e20629370e3f5694c940943cdf37050c7eb746a4 [Edit](https://github.com/liberu-genealogy/laravel-gedcom/edit/sweep/write_full_tests_a0726/tests/Unit/GedcomParserTest.php) - [X] Running GitHub Actions for `tests/Unit/GedcomParserTest.php` ✓ [Edit](https://github.com/liberu-genealogy/laravel-gedcom/edit/sweep/write_full_tests_a0726/tests/Unit/GedcomParserTest.php) - [X] Modify `tests/Unit/GedcomExporterTest.php` ✓ https://github.com/liberu-genealogy/laravel-gedcom/commit/db75b73d3998544ab64bfb5faddcdf324dd57cd4 [Edit](https://github.com/liberu-genealogy/laravel-gedcom/edit/sweep/write_full_tests_a0726/tests/Unit/GedcomExporterTest.php) - [X] Running GitHub Actions for `tests/Unit/GedcomExporterTest.php` ✓ [Edit](https://github.com/liberu-genealogy/laravel-gedcom/edit/sweep/write_full_tests_a0726/tests/Unit/GedcomExporterTest.php) - [X] Create `tests/Unit/ImporterTests.php` ✓ https://github.com/liberu-genealogy/laravel-gedcom/commit/caa1e305403f070887f675d4f28b996d5d5fc704 [Edit](https://github.com/liberu-genealogy/laravel-gedcom/edit/sweep/write_full_tests_a0726/tests/Unit/ImporterTests.php) - [X] Running GitHub Actions for `tests/Unit/ImporterTests.php` ✓ [Edit](https://github.com/liberu-genealogy/laravel-gedcom/edit/sweep/write_full_tests_a0726/tests/Unit/ImporterTests.php) - [X] Modify `composer.json` ✓ https://github.com/liberu-genealogy/laravel-gedcom/commit/ed6a6fa4fbc54376a8c35709570b26c6fdfbae5e [Edit](https://github.com/liberu-genealogy/laravel-gedcom/edit/sweep/write_full_tests_a0726/composer.json#L1-L1) - [X] Running GitHub Actions for `composer.json` ✓ [Edit](https://github.com/liberu-genealogy/laravel-gedcom/edit/sweep/write_full_tests_a0726/composer.json#L1-L1) - [X] Create `phpunit.xml` ✓ https://github.com/liberu-genealogy/laravel-gedcom/commit/c1de5bb16589cc7f0c8782f9574cae571704909a [Edit](https://github.com/liberu-genealogy/laravel-gedcom/edit/sweep/write_full_tests_a0726/phpunit.xml) - [X] Running GitHub Actions for `phpunit.xml` ✓ [Edit](https://github.com/liberu-genealogy/laravel-gedcom/edit/sweep/write_full_tests_a0726/phpunit.xml)