Problem/Motivation

As https://www.drupal.org/node/2513326 is headed for contrib, I am shaving off the core bits.

Proposed resolution

Add an empty additionalAssertCRUD() to PhpStorageTestBase. The method is empty so zero core change.

Beta phase evaluation

Reference: https://www.drupal.org/core/beta-changes
Issue category Task, because it helps contrib
Issue priority normal, because there aren't that many contrib modules using that.
Unfrozen changes Unfrozen because it only changes tests
CommentFileSizeAuthor
phpstorage.patch1.3 KBchx

Comments

chx created an issue. See original summary.

dawehner’s picture

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

Let's make it easy for contrib

alexpott’s picture

Status: Reviewed & tested by the community » Fixed

Test only change permitted in beta. Committed e2ff6e8 and pushed to 8.0.x. Thanks!

diff --git a/core/tests/Drupal/Tests/Component/PhpStorage/PhpStorageTestBase.php b/core/tests/Drupal/Tests/Component/PhpStorage/PhpStorageTestBase.php
index d3ad513..0c90019 100644
--- a/core/tests/Drupal/Tests/Component/PhpStorage/PhpStorageTestBase.php
+++ b/core/tests/Drupal/Tests/Component/PhpStorage/PhpStorageTestBase.php
@@ -49,6 +49,8 @@ public function assertCRUD($php) {
     $this->assertTrue($success, 'Saved php file');
     $php->load($name);
     $this->assertTrue($GLOBALS[$random], 'File saved correctly with correct value');
+
+    // Run additional asserts.
     $this->additionalAssertCRUD($php, $name);
 
     // If the file was successfully loaded, it must also exist, but ensure the
@@ -74,7 +76,8 @@ public function assertCRUD($php) {
    *   The name of an object. It should exist in the storage.
    */
   protected function additionalAssertCRUD(PhpStorageInterface $php, $name) {
-
+    // By default do not do any additional asserts. This is a way of extending
+    // tests in contrib.
   }
 
 }

Added some documentation on commit.

  • alexpott committed e2ff6e8 on 8.0.x
    Issue #2550311 by chx: Allow extending PhpStorageTestBase
    

Status: Fixed » Closed (fixed)

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