The Updater classes could probably be tested to some degree. I don't know how useful they would be to unit test because they rely so heavily on the Drupal stack, but it is the closest thing to a testable piece of the Plugin Manager we've got, and at least exersizing the code in the template pattern could be useful.

Exercising the code by providing a Mock implementation will allow us to at least simulate an install and read out the expected operations and the directories they would affect.

Comments

dww’s picture

Issue tags: +Update manager

This should be a lot easier to test now that we have a FileTransferLocal class from #609728: Skip authorize.php step if webroot files are owned by the httpd user

JacobSingh’s picture

We actually had a FileTransferTest class and unit tests I wrote in part 1, but due to a PHP bug and lack of interest, they never got finalized in core AFAIK.
#395472: Plugin Manager in Core: Part 1 (backend)

modules/simpletest/tests/filetransfer.test

If I was to write a unit test for this, I'd write one for the Updaters in a similar fashion.

We could do actual file transfers too, but mocking might be easier to validate.

chx’s picture

Assigned: Unassigned » chx
chx’s picture

Component: update system » ajax system
Assigned: chx » Unassigned
Issue summary: View changes
dww’s picture

Component: ajax system » update.module

Status: Active » Closed (outdated)

Automatically closed because Drupal 7 security and bugfix support has ended as of 5 January 2025. If the issue verifiably applies to later versions, please reopen with details and update the version.