Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Problem/Motivation
Simple tests will likely require common functionality, such as generating a user with necessary permissions and generating test keys. We should define a base class to share that functionality.
Proposed resolution
Add a EncryptTestBase class with common functionality. EncryptTest should extend the base class.
Comment | File | Size | Author |
---|---|---|---|
#11 | 2692387-11.patch | 605 bytes | svendecabooter |
| |||
#7 | 2692387-7.patch | 6.44 KB | svendecabooter |
#5 | 2692387-5.patch | 6.4 KB | svendecabooter |
#4 | 2692387-4.patch | 6.02 KB | rlhawk |
| |||
#2 | 2692387-2.patch | 6.01 KB | rlhawk |
Comments
Comment #2
rlhawkHere's a patch that adds a base class and extends it.
Comment #4
rlhawkNew patch to address failing test.
Comment #5
svendecabooterThis could be useful for the field_encrypt module, which currently creates keys and encryption profiles as part of the general setup.
Instead, the field_encrypt module tests could extend EncryptTestBase, and leverage the setup that's done there.
I have updated this patch:
* The creation of keys can be done programmatically, rather then through the UI, because the UI case is already covered by Key module's KeyServiceTest.
* 2 test encryption profiles are being created programmatically by EncryptTestBase. They are not used in EncryptTest, because that test tests the addition of encryption profiles through the UI, and sets assertions for that. Instead, this setup logic is aimed for other tests extending the base test, such as the aforementioned field_encrypt tests.
Comment #7
svendecabooterUpdate for failing test.
Comment #8
rlhawkTerrific, thanks. The only issue I came across was that simpletest attempted to instantiate the abstract base class, resulting in an error. I removed the base class from the encrypt
@group
and now it's all good.Comment #10
rlhawkComment #11
svendecabooterI spotted an error in the definition of the 256 bit key. Probably doesn't result into an error, since 256 is the default value.
Patch attached to clean this up.
Comment #12
rlhawkThanks.
Comment #14
rlhawk