Problem/Motivation

We've had ResourceTestBase for exactly a year now (since #2737719: EntityResource: Provide comprehensive test coverage: for every entity type, every format, every method).

In working on #2893804: Remove rest.module BC layers, it became clear that DbLogResourceTest was still using the deprecated base test class. In fact, this issue blocks that issue.

Proposed resolution

Update DbLogResourceTest.

Remaining tasks

None.

User interface changes

None.

API changes

None.

Data model changes

None.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Wim Leers created an issue. See original summary.

Wim Leers’s picture

Wim Leers’s picture

diff --git a/core/modules/dblog/src/Tests/Rest/DbLogResourceTest.php b/core/modules/dblog/tests/src/Functional/DbLogResourceTest.php
similarity index 31%
rename from core/modules/dblog/src/Tests/Rest/DbLogResourceTest.php
rename to core/modules/dblog/tests/src/Functional/DbLogResourceTest.php
index 44dbe99..e202823 100644
--- a/core/modules/dblog/src/Tests/Rest/DbLogResourceTest.php
+++ b/core/modules/dblog/tests/src/Functional/DbLogResourceTest.php
@@ -4,26 +4,51 @@
 
 use Drupal\Component\Serialization\Json;
 use Drupal\Core\Url;
-use Drupal\rest\Tests\RESTTestBase;
+use Drupal\Tests\rest\Functional\CookieResourceTestTrait;

I did not update the namespace despite moving the file. My bad.

dawehner’s picture

Issue tags: +phpunit initiative

The last submitted patch, 2: 2927758-2.patch, failed testing. View results

Status: Needs review » Needs work

The last submitted patch, 3: 2927758-3.patch, failed testing. View results

Wim Leers’s picture

Issue tags: +Novice, +php-novice
+++ b/core/modules/dblog/tests/src/Functional/DbLogResourceTest.php
@@ -36,30 +61,66 @@ public function testWatchdog() {
+    $this->assertResourceResponse(200, FALSE, $response, ['config:rest.resource.dblog', 'http_response'], ['user.permissions'], FALSE, 'MISS');

This is missing 'config:rest.settings'. Then it should be green.

dagmar’s picture

Status: Needs work » Needs review
FileSize
5.28 KB
979 bytes

Thanks for working on this! I had to create this patch using git diff -C -M20% since there were so many changes and git wasn't able to detect the renamed file.

Status: Needs review » Needs work

The last submitted patch, 8: 2927758-8.patch, failed testing. View results

Wim Leers’s picture

+++ b/core/modules/dblog/src/Tests/Rest/DbLogResourceTest.php
@@ -1,54 +1,29 @@
-class DbLogResourceTest extends ResourceTestBase {
...
+class DbLogResourceTest extends RESTTestBase {

Looks like your diff is going the wrong direction? :D

dagmar’s picture

Status: Needs work » Needs review
FileSize
5.28 KB

Hah. Yes. Sorry for that.

Wim Leers’s picture

I'd RTBC, but I've created most of this patch. @dagmar made a trivial change in #8. As the maintainer of this component, I think he's eligible to RTBC this patch.

dagmar’s picture

The patch looks good for me.

There is only one coding standard issue here:

+++ b/core/modules/dblog/tests/src/Functional/DbLogResourceTest.php
@@ -36,30 +61,66 @@ public function testWatchdog() {
+      default:
+        throw new \UnexpectedValueException();
+    }
+  }
+  /**
+   * {@inheritdoc}
+   */
Wim Leers’s picture

Fixed!

dagmar’s picture

Status: Needs review » Reviewed & tested by the community

Thanks!

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 14: 2927758-14.patch, failed testing. View results

Anonymous’s picture

Status: Needs work » Reviewed & tested by the community

Random fail with memory.

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 14: 2927758-14.patch, failed testing. View results

Wim Leers’s picture

Status: Needs work » Reviewed & tested by the community

  • larowlan committed 1aab6ab on 8.5.x
    Issue #2927758 by Wim Leers, dagmar: Update DbLogResourceTest to use the...

  • larowlan committed 28b52c3 on 8.4.x
    Issue #2927758 by Wim Leers, dagmar: Update DbLogResourceTest to use the...
larowlan’s picture

Version: 8.5.x-dev » 8.4.x-dev
Status: Reviewed & tested by the community » Fixed

Committed as 1aab6ab and pushed to 8.5.x.
Cheerily-picked as 28b52c3 and pushed to 8.4.x.

Thanks! the march continues simpletest-countdown.org

Wim Leers’s picture

#22: hah! :D Thanks for that URL btw, I was trying to find it last week, but couldn't!

Status: Fixed » Closed (fixed)

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