There two problems with the CSV source tests:

  • They are not discovered by PHPUnit.
  • Once you get them running there is a failing test

The first problem is explained at https://www.drupal.org/node/2499239. Currently PHPUnit is only able to find tests that are located at the top level of the /modules folder. Submodules are not discoverable and that probably won't change. Even if you navigate to the submodule on the command line the tests don't appear. The solution is to add a phpunit.xml.dist and corresponding bootstrap.php file. With those added you can navigate to the module on the command line and you'll see and be able to run the tests.

The second problem is that once you get it working there are failing tests. The failures are because you can't test a protected function (getIterator). The fix for that is to add a reflection class to make the protected function testable.

Patch coming that fixes both problems.

CommentFileSizeAuthor
#3 2609048.patch5.03 KBKarenS
#2 2609048.patch0 bytesKarenS
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

KarenS created an issue. See original summary.

KarenS’s picture

Status: Active » Needs review
FileSize
0 bytes

Here's the patch.

KarenS’s picture

FileSize
5.03 KB

Oops, trying again.

heddn’s picture

Project: Migrate Plus » Migrate Source CSV
Version: 8.x-1.x-dev »
Component: Source plugins » Code

Re-assigning to new project name-space.

drumm’s picture

Version: » 8.x-1.x-dev

  • heddn committed 4af3fd6 on 8.x-1.x authored by KarenS
    Issue #2609048 by KarenS, heddn: CSV Plugin tests are broken
    
heddn’s picture

Status: Needs review » Fixed

I made some minor tweaks on commit. I think core changed the visibility for getIterator() while tests were in the broken state. I could be wrong, but calling initializeIterator() seems like a more simple solution than using reflection. For now, marking as fixed, but we can always re-add the reflection if that is the better direction to use.

Status: Fixed » Closed (fixed)

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