Following the trend in #2735005: Convert all Simpletest web tests to BrowserTestBase (or UnitTestBase/KernelTestBase), this issue is about replacing the deprecated SimpleTests by the new, PHPUnit functionnal tests. Here's a first stab at it. More work needed but I'd like some feedback on the approach as well.T

Comments

anavarre created an issue. See original summary.

anavarre’s picture

Issue summary: View changes
anavarre’s picture

StatusFileSize
new8.63 KB
new3.52 KB

Few coding standards.

dom.’s picture

  1. +++ b/tests/src/Functional/ReadOnlyConfigTest.php
    @@ -0,0 +1,144 @@
    +  public $message = 'This form will not be saved because the configuration active store is read-only.';
    

    Should be protected.

  2. +++ b/tests/src/Functional/ReadOnlyConfigTest.php
    @@ -0,0 +1,144 @@
    +    $this->adminUser = $this->createUser([], NULL, TRUE);
    

    I would rather advice not to use so "unrestricted" permissions.

  3. +++ b/tests/src/Functional/ReadOnlyConfigTest.php
    @@ -0,0 +1,144 @@
    +    $module_url = Url::fromRoute('system.modules_list');
    

    Why not this as a class variable and initialize this in setUp() method ?

  4. +++ b/tests/src/Functional/ReadOnlyConfigTest.php
    @@ -0,0 +1,144 @@
    +    $this->drupalPostForm($module_url, $edit, t('Install'));
    

    I would suggest not to use t() method here. This method is in bootstrap.inc and is functionnal not OOP. Plus, the test runs in minimal profile installed with not translation module anyway, so useless here.

  5. +++ b/tests/src/Functional/ReadOnlyConfigTest.php
    @@ -0,0 +1,144 @@
    +//    $install_button = isset($elements[0]) && $elements[0] instanceof \SimpleXMLElement ? $elements[0]-> attributes() : FALSE;
    +//    self::assertTrue($install_button !== FALSE, 'Found the install form submit button.');
    +//    self::assertTrue((string) $install_button['disabled'] == 'disabled', 'The install modules form button is disabled.');
    

    Do not let commented lines.

dom.’s picture

StatusFileSize
new8.63 KB

Here is a patch to correct point 5.
Points 1 and 4 corrected too.

anavarre’s picture

StatusFileSize
new1.75 KB

Thanks, Dom.!

anavarre’s picture

+++ b/tests/src/Functional/ReadOnlyConfigTest.php
@@ -31,7 +32,7 @@
+  private $message = 'This form will not be saved because the configuration active store is read-only.';

protected

anavarre’s picture

StatusFileSize
new8.63 KB
new492 bytes
manuel garcia’s picture

Assigned: anavarre » Unassigned
StatusFileSize
new614 bytes
new8.62 KB

Patch would not apply, so I rerolled it.

Also fixed how testModulePages was enabling the action module as it was incorrect (see testModulePages-fix.txt).

manuel garcia’s picture

Issue tags: +D9 readiness
StatusFileSize
new5.06 KB
new13.68 KB

We should also port ReadOnlyConfigWhitelistTest to PHPUnit, doing so in this patch.

Also this is a blocker for D9.

suzymasri’s picture

Status: Needs review » Reviewed & tested by the community

#10 tested, looks good to me. Marking it as RTBC.

As @Manuel Garcia mentioned, this is a blocker for #3042822: Drupal 9 Deprecated Code Report, would be helpful if we can have it merged.

pwolanin’s picture

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

Thanks!

Status: Fixed » Closed (fixed)

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

kristen pol’s picture

Issue tags: -D9 readiness +Drupal 9 compatibility

Fixing outdated tag.