Skip to content

Conversation

@oliver-stoehr
Copy link
Contributor

@oliver-stoehr oliver-stoehr commented Apr 28, 2023

Tests for CalendarController will be added in a separate pull request.
Update: Added tests for CalendarController in another commit.

@sebastian-meyer sebastian-meyer changed the title Add tests for Controller package [MAINTENANCE] Add tests for Controller 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
@sebastian-meyer sebastian-meyer linked an issue Feb 1, 2024 that may be closed by this pull request
Co-authored-by: Sebastian Meyer <[email protected]>
foreach ($databaseFixtures as $filePath) {
$this->importCSVDataSet($filePath);
}
$this->persistenceManager = $this->objectManager->get(PersistenceManager::class);
Copy link
Member

Choose a reason for hiding this comment

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

This seems to be the problem why the tests fail. $this->objectManager->get() throws the error Call to a member function get() on null, so $this->objectManager isn't initialized.

Copy link
Collaborator

Choose a reason for hiding this comment

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

This fails because as of version 12 the GeneralUtilityManager is used to get an instance of a class. However, if I change this, all tests fail. The response only contains an empty string. This must be related to the changes to version 12.
$this->persistenceManager = GeneralUtility::makeInstance(PersistenceManager::class);

Copy link
Member

Choose a reason for hiding this comment

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

Yes, this fixed the issue. Now the tests are running for both, v11 and v12. Unfortunately, some of the tests fail...

@sebastian-meyer sebastian-meyer changed the base branch from master to tests-controller October 22, 2024 11:14
@sebastian-meyer sebastian-meyer changed the base branch from tests-controller to master October 22, 2024 11:15
@sebastian-meyer sebastian-meyer marked this pull request as draft October 22, 2024 11:16
@stweil
Copy link
Member

stweil commented Mar 12, 2025

More tests would be really useful. Therefore I appreciate this pull request.

@oliver-stoehr, are you still working on it?

I suggest to squash some of the commits (each commit should be complete and produce a working software). A rebase on main would be helpful, too.

@chrizzor
Copy link
Collaborator

Tests created for:

  • Classes/Controller/AbstractController.php (Abstract, therefore tested through the other, implementing controllers)
  • Classes/Controller/AudioPlayerController.php
  • Classes/Controller/CalendarController.php
  • Classes/Controller/CollectionController.php
  • Classes/Controller/FeedsController.php
  • Classes/Controller/ListViewController.php
  • Classes/Controller/MetadataController.php
  • Classes/Controller/NavigationController.php
  • Classes/Controller/PageGridController.php
  • Classes/Controller/PageViewController.php
  • Classes/Controller/SearchController.php
  • Classes/Controller/StatisticsController.php
  • Classes/Controller/TableOfContentsController.php
  • Classes/Controller/ToolboxController.php

In the StatisticsController in the MainAction, the test has so far failed because there was an error in the action. The remaining tests have otherwise passed. However, the problem now is that the new Typo3 version has changed the handling of the response objects. The interface \Psr\Http\Message\ServerRequestInterface is now used. This means that calling the actions in the PR is no longer compatible with the current presentation code. The attempt to rebuild the controllers according to the mentioned interface unfortunately did not work with reasonable effort. In principle, the tests should work if the problem with the request/response objects is resolved.

@sebastian-meyer
Copy link
Member

Successor: #1708

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

5 participants