Comments

David_Rothstein created an issue. See original summary.

David_Rothstein’s picture

Issue summary: View changes
David_Rothstein’s picture

Here is a patch. The one that should fail includes a partial revert of #2426969: Dynamic redirects are no longer possible in the batch API (breaks updating existing modules or themes with the Update Manager) to demonstrate that the tests are working as intended.

webchick’s picture

Status: Needs review » Reviewed & tested by the community

Huh, InfoParserDynamic is quite a clever hack. :)

We desperately need test coverage for this stuff, and I don't see anything to complain about here, so RTBC. I'll commit this in a day or two if no concerns have been raised.

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 3: update-manager-update-tests-2548511-3.patch, failed testing.

Status: Needs work » Needs review
webchick’s picture

Previous result: FAILED: [[SimpleTest]]: [PHP 5.5 MySQL] Repository checkout: failed to checkout from [git://git.drupal.org/project/drupal.git].

Re-testing. It was green a couple mins ago.

Status: Needs review » Needs work

The last submitted patch, 3: update-manager-update-tests-2548511-3.patch, failed testing.

David_Rothstein’s picture

Status: Needs work » Reviewed & tested by the community
StatusFileSize
new17.29 KB

Thanks! Just needed a completely trivial reroll following #1885564: theme.maintenance.inc (authorize.php) - Convert theme_ functions to Twig, so I'm putting this straight back to RTBC.

andypost’s picture

just nits, also wondered DRUPAL_ROOT usage

+++ b/core/lib/Drupal/Core/Updater/Module.php
@@ -18,26 +18,27 @@ class Module extends Updater implements UpdaterInterface {
     else {
-      $relative_path = $this->getRootDirectoryRelativePath();
+      // When installing a new module, prepend the requested root directory.
+      return $this->root . '/' . $this->getRootDirectoryRelativePath();
     }
-    return $this->root . '/' . $relative_path;

+++ b/core/lib/Drupal/Core/Updater/Theme.php
@@ -18,26 +18,27 @@ class Theme extends Updater implements UpdaterInterface {
     else {
-      $relative_path = $this->getRootDirectoryRelativePath();
+      // When installing a new theme, prepend the requested root directory.
+      return $this->root . '/' . $this->getRootDirectoryRelativePath();
     }
-    return $this->root . '/' . $relative_path;

else becomes unneeded

webchick’s picture

Status: Reviewed & tested by the community » Needs review

Sounds like that could use feedback from David. Though my inclination is to commit this anyway so we have the test coverage which we ever-so-desperately need, and then do any clean-ups in a follow-up issue.

David_Rothstein’s picture

I personally prefer the "else" there, since I think it makes it more clear that this return statement happens under opposite conditions from the first one. But I don't care that much and am willing to change it if necessary.

Regarding the DRUPAL_ROOT, that was actually there already until a little over a week ago - we just removed it as part of #2042447: Install a module user interface does not install modules (or themes) but in fact, it turns out this one instance should not have been removed. Effectively, the Update Manager has some built in assumptions (pre-dating this issue) that you can't update a module unless it's somewhere within the Drupal root directory, but I think that is not so bad :)

webchick’s picture

Status: Needs review » Reviewed & tested by the community

That sounds good. Back to RTBC.

webchick’s picture

Status: Reviewed & tested by the community » Fixed

In another episode of "things I swore I committed weeks ago.." ;)

Committed and pushed to 8.0.x. Thanks!

  • webchick committed 445b4cd on 8.0.x
    Issue #2548511 by David_Rothstein: Write tests for the Update Manager...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.