Support from Acquia helps fund testing for Drupal Acquia logo

Comments

DamienMcKenna created an issue. See original summary.

DamienMcKenna’s picture

Status: Active » Needs review
FileSize
3.24 KB

WIP.

Status: Needs review » Needs work

The last submitted patch, 2: scanner-n3214129-2.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

mariacha1’s picture

Since I'm just learning about writing tests, I thought I'd give this one a quick review! Couple things that came up:

  1. +++ b/tests/src/Functional/SearchTest.php
    @@ -0,0 +1,63 @@
    +    $user = $this->createUser(['perform search only']);
    

    The permission to get to the admin/content/scanner page is 'administer nodes', so the test user should have this permission as well.

  2. +++ b/tests/src/Functional/SearchTest.php
    @@ -0,0 +1,63 @@
    +    $session_assert->fieldExists('replace');
    

    The 'replace' field only shows up if you have the permission 'perform search and replace', so either we need that permission on the createUser line above, or the "replace" field needs to be checked with a different user setup.

mariacha1’s picture

Status: Needs work » Needs review
FileSize
3.32 KB
545 bytes

Here's the updated patch (and interdiff) with just that one difference to the user setup.

joseph.olstad’s picture

hmendes’s picture

Status: Needs review » Needs work

Changing this to Needs Work because it isn't testing the functionality yet.

DamienMcKenna’s picture

hmendes’s picture

Status: Needs work » Needs review
FileSize
4.56 KB

Improving the tests and fixing a few deprecation notices.

hmendes’s picture

Status: Needs review » Needs work

Oh, actually, i just saw that there are separated issues for each test. The patch i sent was testing the replacement, sorry, changing back to needs work. I'll send the path in #3214130: Test coverage for the replacement process

hmendes’s picture

joseph.olstad’s picture

@hmendes, great work on the tests.

hmendes’s picture

Status: Needs work » Needs review
FileSize
2.7 KB

Thanks @joseph.olstad. Adding a patch testing the "Search" functionality.

The tests are giving some errors regarding the problem in #3252911: Undefined index: count, Undefined index: entities in Drupal\scanner\Form\ScannerForm::batchSearch() (line 264.
I also didn't fixed the phpcs problems as they are already being fixed on #3214130: Test coverage for the replacement process, although i actually rather fix them in a separate issue.

  • DamienMcKenna committed 1ddf133 on 8.x-1.x
    Issue #3214129 by hmendes, mariacha1, DamienMcKenna, joseph.olstad: Test...
DamienMcKenna’s picture

Status: Needs review » Fixed

Committed. Thanks everyone.

Status: Fixed » Closed (fixed)

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