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

[MAINTENANCE] Add tests for Common package #953

Merged
merged 10 commits into from
Dec 5, 2023

Conversation

oliver-stoehr
Copy link
Contributor

No description provided.

@oliver-stoehr oliver-stoehr force-pushed the CommonTest branch 2 times, most recently from 5ca0c7e to 5e2c8de Compare May 19, 2023 13:40
@sebastian-meyer sebastian-meyer changed the title Add tests for Common package [MAINTENANCE] Add tests for Common package May 24, 2023
@sebastian-meyer sebastian-meyer self-requested a review May 24, 2023 19:17
@sebastian-meyer sebastian-meyer added 🛠 maintenance A task to keep the code up-to-date and manageable. ⭐ development fund 2022 A candidate for the Kitodo e.V. development fund. labels May 24, 2023
*/
public function canPrepareAndSubmit()
{
$this->markTestSkipped('Does not work in combination with other tests.');
Copy link
Member

Choose a reason for hiding this comment

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

Hm, a skipped test is quite useless... There should be a way to make this work even in combination with the other tests. Where exactly does the test fail?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I reenabled the test. It fails on line 55 at the first assert using the SolrSearch object from line 53. I could not find any difference in any variables accesses in the tested SolrSearch::prepare method.
I also switched to a different Solr core, but that didn't change the result.
However I'm not sure about the DocumentRepository passed to the constructor of the SolrSearch – I'm don't fully understand how the DocumentRepository object is created (or maybe reused?).

Copy link
Member

Choose a reason for hiding this comment

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

I am sorry, but I can't help you with that. Maybe @beatrycze-volk can give more insight into using the DocumentRepository correctly?

Copy link
Collaborator

Choose a reason for hiding this comment

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

I am sorry, but I can't help you with that. Maybe @beatrycze-volk can give more insight into using the DocumentRepository correctly?

Actually more suitable person to answer this question would be @chrizzor as he has implemented this class.

@sebastian-meyer
Copy link
Member

I fixed the PHPStan issue in master. It should disappear as soon as you update your branch.

@oliver-stoehr
Copy link
Contributor Author

oliver-stoehr commented Dec 4, 2023

I fixed the test. It looks like some database query were cached, that were necessary to determine the correct solr core. The solr cores are now determined more directly.

Copy link
Member

@sebastian-meyer sebastian-meyer left a comment

Choose a reason for hiding this comment

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

Great job! Thank you very much!

@sebastian-meyer
Copy link
Member

Now you only need to update your branch to master and then I can merge it!

@sebastian-meyer sebastian-meyer merged commit 10248c5 into kitodo:master Dec 5, 2023
6 checks passed
@oliver-stoehr oliver-stoehr deleted the CommonTest branch December 5, 2023 16:17
@sebastian-meyer sebastian-meyer linked an issue Feb 1, 2024 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
⭐ development fund 2022 A candidate for the Kitodo e.V. development fund. 🛠 maintenance A task to keep the code up-to-date and manageable.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[FUND] Add tests and significantly improve test coverage
3 participants