Problem/Motivation

This issue was fixed on #2417333: Add support for user-path: scheme to Url class but no test were added for dblog. This issue add the tests for that fix.

Proposed resolution

Add the tests for the fix defined on #2417333: Add support for user-path: scheme to Url class.

Remaining tasks

None

User interface changes

None

API changes

None

Data model changes

None

Original report by @eosrei

The dblog detail pages contain links to Location and Referrer, but they are broken.

Example on fresh install: /admin/reports/dblog/event/24

Type 	user
Date 	Wednesday, November 19, 2014 - 17:27
User 	Anonymous (not verified)
Location 	http://d8.local/core/install.php/?langcode=en&profile=standard
Referrer 	http://d8.local/core/install.php?langcode=en&profile=standard
Message 	Session opened for root.
Severity 	Notice
Hostname 	127.0.0.1
Operations

In the example above:

http://d8.local/core/install.php/?langcode=en&profile=standard

links to:

http://d8.local/http%3A//d8.local/core/install.php/%3Flangcode%3Den%26profile%3Dstandard

The attached patch removes the extra 'base://':

$this->l($dblog->location, $dblog->location ? Url::fromUri('base://' . $dblog->location) : Url::fromRoute('<none>')),

Beta phase evaluation

Reference: https://www.drupal.org/core/beta-changes
Issue category Bug
Unfrozen changes Unfrozen because it only changes a broken UI in the dblog module
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

13rac1’s picture

Title: Log Details link to » Log Details link to bad URL
jhedstrom’s picture

Issue summary: View changes
Status: Needs review » Reviewed & tested by the community
FileSize
122.57 KB

I looked into why there isn't a test for this already. The issue is that the link will change based on where/how the test is run (from the UI, they'll be batch page urls, from the script or drush I'm not sure what they'd be set to, but they'd be different).

The attached patch fixes the issue in manual testing.

I also added a beta phase evaluation to the summary.

Status: Reviewed & tested by the community » Needs work

The last submitted patch, dblog-detail-links.patch, failed testing.

jhedstrom queued dblog-detail-links.patch for re-testing.

jsobiecki’s picture

Status: Needs work » Needs review

I'm not sure why issue is in "Needs work" state. After re-testing all tests are green.
Patch applies cleanly (at least for today) and fixes visible problem.

Changes are quite minor, and (IMHO) make sense.

+1 From me.

jhedstrom’s picture

Status: Needs review » Reviewed & tested by the community

This is back to RTBC--I'd missed that the testbot falsely marked this as needs work.

alexpott’s picture

Status: Reviewed & tested by the community » Needs work
Issue tags: +Needs tests

This looks very testable.

jhedstrom’s picture

Status: Needs work » Needs review
Issue tags: -Needs tests
FileSize
1.43 KB
2.51 KB

Re: #7 you're totally right, not sure what I was thinking in #2.

Attached is a patch with tests for these links.

Note that I didn't use assertLinkByHref() since that was passing without the fix since it only looks for links that *contain* rather than match exactly.

The last submitted patch, 8: dblog-detail-links-2378617-08-TEST-ONLY.patch, failed testing.

Status: Needs review » Needs work

The last submitted patch, 8: dblog-detail-links-2378617-08.patch, failed testing.

jhedstrom’s picture

Interesting, so when the tests are run via run-tests.sh, the referer/location links are empty as mentioned in #2. I'll pursue a path of just injecting some fake data into the watchdog table that will be independent of testing environment.

jhedstrom’s picture

Status: Needs work » Needs review
FileSize
2.7 KB
1.68 KB
2.76 KB

I added a separate test method for verifying the detail page. There is a bit of overlap with the existing verifyReports() method, but as mentioned above, relying on the actual values in the report doesn't work since they change based on how the test is run. This test injects known data and tests against that.

The last submitted patch, 12: dblog-detail-links-2378617-12-TEST-ONLY.patch, failed testing.

Status: Needs review » Needs work

The last submitted patch, 12: dblog-detail-links-2378617-12.patch, failed testing.

jhedstrom’s picture

Status: Needs work » Needs review
FileSize
1.68 KB

Reroll of #12.

mgifford’s picture

Re-uploading for bots.

alexpott’s picture

Status: Needs review » Needs work
Issue tags: +Needs issue summary update

The fact this is a test only patch implies this has been fixed by another issue and the issue summary is out of date... did the issue that fixed it add a test or is a test only issue relevant?

jhedstrom’s picture

The issue that fixed it is #2417333: Add support for user-path: scheme to Url class, and, as far as I can tell, did not add tests for the db log, so this could still be relevant.

mgifford’s picture

Version: 8.0.x-dev » 8.1.x-dev

Drupal 8.0.6 was released on April 6 and is the final bugfix release for the Drupal 8.0.x series. Drupal 8.0.x will not receive any further development aside from security fixes. Drupal 8.1.0-rc1 is now available and sites should prepare to update to 8.1.0.

Bug reports should be targeted against the 8.1.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.2.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

dagmar’s picture

Version: 8.1.x-dev » 8.2.x-dev
Issue summary: View changes
Status: Needs work » Needs review
Issue tags: -Needs issue summary update
FileSize
1.69 KB

This patch looks good. I updated the issue summary and just wrapped a long comment line to 80 characters.

dagmar’s picture

FileSize
707 bytes
dagmar’s picture

Status: Needs review » Reviewed & tested by the community

Moving to RTBC since #22 is almost identical to #17. The issue summary has been updated to reflect why this patch only provides tests.

alexpott’s picture

Title: Log Details link to bad URL » Add test for Log Details links
alexpott’s picture

Status: Reviewed & tested by the community » Fixed

Committed e598c06 and pushed to 8.1.x and 8.2.x. Thanks!

  • alexpott committed 49e2b0e on 8.2.x
    Issue #2378617 by jhedstrom, dagmar, eosrei, mgifford: Add test for Log...

  • alexpott committed e598c06 on 8.1.x
    Issue #2378617 by jhedstrom, dagmar, eosrei, mgifford: Add test for Log...

Status: Fixed » Closed (fixed)

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