- 🇩🇪Germany jurgenhaas Gottmadingen
It's probably a bit late, but I have now incorporated your in-code comments from the MR and did also some code cleanup.
Wanted to start on the test but struggle with that and probably need your help. The challenge is that we need to have the module
json_api_book
on the server side of entity_share to inject the book related extra data which then needs to be tested on the client side.How would youy go about that for testing then?
- 🇫🇷France Grimreaper France 🇫🇷
Hi @jurgenhaas,
Glad to see your are still active on this issue.
You can add json_api_book in the require-dev of the composer.json.
In a dedicated test which could inherit of EntityShareClientFunctionalTestBase, enable json_api_book in addition in this test and take inspiration from BasicFieldsTest and/or TaxonomyEntityReferenceTest or other tests about entity reference fields to see how the setup and the tests are done.
See tests like EmbeddedEntityTest when configuring additional import processors and/or json api extras enhancers are required.
Are those guidelines ok for you?
- Assigned to jurgenhaas
- Issue was unassigned.
- 🇩🇪Germany jurgenhaas Gottmadingen
Thanks @Grimreaper this is great advise. But I still don't get it completely. I have an idea how you've built all those abstract classes to build your test data, but I don't easily find out how I should define my test data.
I'm sure you could do that fairly quickly with your knowledge of all that background. I've started building
\Drupal\Tests\entity_share_client\Functional\BookStructureImporterTest
in the MR and you can find the information of what is needed in\Drupal\Tests\entity_share_client\Functional\BookStructureImporterTest::getEntitiesDataArray
where I have included the data structure of the node, its parent node and its book node. If you could turn that into the correct data array, I may well get the rest of the test completed. - Assigned to Grimreaper
- 🇫🇷France Grimreaper France 🇫🇷
Thanks for your hard work and to have prepared the test class.
I will try to give it a look.
- Issue was unassigned.
- 🇫🇷France Grimreaper France 🇫🇷
Please check the structure of the nodes in getEntitiesDataArray if it is ok, especially the p* and depth.
The checker_callback methods have to be implemented like in ContentEntityReferenceTest or TaxonomyEntityReferenceTest.
If too time consuming, at least ensure the book data is ok and I will try to finish the test.
Thanks :)
- 🇩🇪Germany jurgenhaas Gottmadingen
I have checked and updated the data structure and also implemented the checker callback, hopefully in the right way? But the structure looks ok to me now.
The test is failing with this error:
The node with UUID book_root has been recreated. Failed asserting that false is true.
Would be great if you could get this fixed.
- Assigned to Grimreaper
- 🇫🇷France Grimreaper France 🇫🇷
Thanks!
Ok, I will try to test that and finish the test.
I am currently on 🐛 Infinite Loop in link field, block field and embedded entity importer plugins Fixed and will give a try here after.
- @grimreaper opened merge request.
- Issue was unassigned.
- Status changed to Needs review
almost 2 years ago 2:57pm 2 March 2023 - 🇫🇷France Grimreaper France 🇫🇷
Got it!
The problem was that during the entity creation, the book structure requires the entity ID while it does not exist yet.
So need to create the entities in prepareContent().I gave a look at the tests in the core Book module to see how to create a book structure programmatically.
I also made simplification of the plugin to only import the parent and by recursion it will be ok.
@jurgenhaas can you please give a look at the new MR (rebased) to see if it is ok for you?
Without response I will merge next week.
- Status changed to RTBC
almost 2 years ago 3:08pm 2 March 2023 - 🇩🇪Germany jurgenhaas Gottmadingen
This is looking great. Your simplication of the code is amazing, thanks a lot for that.
-
Grimreaper →
committed f34d178b on 8.x-3.x
Issue #3266530 by jurgenhaas, Grimreaper: Add support for book module
-
Grimreaper →
committed f34d178b on 8.x-3.x
- Status changed to Fixed
almost 2 years ago 3:18pm 2 March 2023 - 🇫🇷France Grimreaper France 🇫🇷
Thanks for the quick feedback.
Merged!
Only 📌 D10: update dev dependency Simple Oauth to ~5.2 Fixed before next release.
And 💬 Call to a member function getAlias on null Fixed before stable release.
- 🇩🇪Germany jurgenhaas Gottmadingen
That's amazing, great work!
We have a very complex environment with books where we run real tests asap again. They will run a couple of days just because of the volume, but we will quickly see if all books still come across properly. If there was any issue, I'd open a new one here to address it directly. But there shouldn't be any.
Automatically closed - issue fixed for 2 weeks with no activity.