If you try to sort the dblog messages ascendingly (admin/reports/dblog?sort=asc&order=Type), you will receive an error like this:

Fatal error: [] operator not supported for strings in /var/www/core/includes/tablesort.inc on line 84

This is because dblog.admin.inc tries to set the table cell class as a string rather than an array. Trivial fix. Patch to follow.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

TravisCarden’s picture

TravisCarden’s picture

Status: Active » Needs review
Berdir’s picture

Status: Needs review » Needs work
Issue tags: +Needs tests

Fix looks good.

Sounds like this needs a test.

marcingy’s picture

Status: Needs work » Needs review
FileSize
1.35 KB
841 bytes

Test and fix.

Status: Needs review » Needs work
Issue tags: -Needs tests, -Novice

The last submitted patch, fix-test-only.patch, failed testing.

Berdir’s picture

Status: Needs work » Needs review

#4: fix-test-only.patch queued for re-testing.

Status: Needs review » Needs work
Issue tags: +Needs tests, +Novice

The last submitted patch, fix-test-only.patch, failed testing.

marcingy’s picture

Status: Needs work » Needs review
FileSize
1.34 KB

Re-roll

Berdir’s picture

Status: Needs review » Needs work
+++ b/core/modules/dblog/lib/Drupal/dblog/Tests/DBLogTest.phpundefined
@@ -518,6 +518,10 @@ protected function testFilter() {
+    $this->drupalGet('admin/reports/dblog', array('query' => array('order' => 'Type')));
+    $this->assertResponse(200);
+    $this->assertText('Operations', 'Order by worked');

Operations should actually go through t().

I'm not sure if the assertion message here is necessary. They sometimes aren't that useful because they hide the string that we are actually looking for.

marcingy’s picture

Status: Needs work » Needs review
FileSize
1.29 KB
783 bytes

So locally I was getting a 200 for the inital test but the bot gets a 500 so this should work.

Berdir’s picture

Hm, might be a misunderstanding :)

I actually liked having the assertText() there because, as you figured out, the http response code depends on the php configuration. What I was talking about is just the assertion message, the "'Order by worked'" which essentially hides that we are looking for the Operations string. So you have to look at the code to understand what the assertion does.

marcingy’s picture

FileSize
1.35 KB

Ah my bad, take 2!

Berdir’s picture

Starting to feel bad :)

The assertion text message is optional. And if you leave it out, then the default message is almost exactly what you did there: "'"@text" found'". So all you need is assertText(t('Operations')) and then it's good to go :)

marcingy’s picture

Ok but that is not the approached used elsewhere in the test in question eg

$this->assertText(t('Database log cleared.'), 'Confirmation message found');

And also through out verifyReports() the optional string is always present. So I can change the patch but the tests for dblog look like they need a follow up if we are going down this approach because we lose consistency.

ParisLiakos’s picture

Assigned: TravisCarden » Unassigned
Status: Needs review » Reviewed & tested by the community

Lets keep it consistent me thinks

webchick’s picture

Status: Reviewed & tested by the community » Fixed

Yeah, let's get a minor follow-up for the assertion messages clean-up. For now, I agree with keeping things consistent.

Committed and pushed to 8.x. Thanks!

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