There are a few minor issues with tests in this project:

a) from andypost: setup should return void and modules property protected in tests/src/Functional/LangCodeTest

b) from megachriz: In tests/src/Unit/Porter2Pecl1.php the following line:
$this->assertTrue(TRUE, 'No PECL stem library found, Aborting test.');
It would be better to use a markTestSkipped() call.
https://phpunit.readthedocs.io/en/9.0/incomplete-and-skipped-tests.html#...

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

jhodgdon created an issue. See original summary.

anisha.challa’s picture

Assigned: Unassigned » anisha.challa
dastan56’s picture

anisha.challa’s picture

Status: Active » Needs review
FileSize
3.35 KB

Hi,

I have added the patch for review. I haven't replaced the public static of modules property to protected as it is a static property.

Please review the patch.

jhodgdon’s picture

Status: Needs review » Needs work

Thanks for the patch!

I think the calls to markTestSkipped are incorrect:
https://phpunit.readthedocs.io/en/9.0/incomplete-and-skipped-tests.html#...
It looks like it wants just one parameter (message string).

Also regarding $modules, the base class this derives from declares it as

protected static $modules = [];

so we should do the same thing.

sanjayk’s picture

Assigned: anisha.challa » sanjayk
sanjayk’s picture

Status: Needs work » Needs review
FileSize
4.9 KB

@jhodgdon Made changes as suggested please review

sanjayk’s picture

FileSize
6.08 KB
sanjayk’s picture

Assigned: sanjayk » Unassigned
FileSize
3.96 KB

Fixed the issue in patch

jhodgdon’s picture

Status: Needs review » Needs work

This patch in #9 is not correct -- it is not calling markTestSkipped() any more, and it should be. Neither is the patch in #7.

We need to go back to the patch in #4 and fix the problems noted in #5.

The first fix about the declaration of $modules is correct, but what needs to happen to markTestSkipped() is you need to look up the function signature of that in the phpUnit documentation (try a Google or other web search to find it), and make the calls be correct. Namely, this function has only 1 parameter, but the calls in the patch in #4 passed in 2 parameters.

sanjayk’s picture

Assigned: Unassigned » sanjayk
sanjayk’s picture

Status: Needs work » Needs review
FileSize
3.99 KB

Sorry I missed it. Now I fixed.

jhodgdon’s picture

Status: Needs review » Needs work

Looks good, thanks!

After applying the patch, I looked for $modules, setUp() and the aborted test string in the tests, and it all looks right, except that I found one more place that needs a similar fix:

tests/src/Unit/PorterPeclBase.php:  protected function setUp() {
sanjayk’s picture

FileSize
4.56 KB

@jhodgdon fixed #13 in new patch please review.

sanjayk’s picture

Assigned: sanjayk » Unassigned
Status: Needs work » Needs review
FileSize
4.44 KB

Please ignore #14

sanjayk’s picture

@jhodgdon I have already fixed same changes in two "protected static $modules". You can check in patch #12 and it was in files tests/src/Unit/PorterPeclBase.php and tests/src/Functional/LangCodeTest.php.

jhodgdon’s picture

Status: Needs review » Needs work

I think you misunderstood #13. I meant to say that the setUp() function is not having the :void typehint in PorterPeclBase. You are correct that the $modules variable is correct.

sanjayk’s picture

Status: Needs work » Needs review
FileSize
4.27 KB

@jhodgdon thanks, now fixed #17 please review.

jhodgdon’s picture

It really helps if you make an interdiff file whenever you upload a new patch on an issue, thanks! It makes it much easier for someone to see whether you have addressed feedback.

sanjayk’s picture

FileSize
3.42 KB

@jhodgdon Sorry, I was forgot to upload interdiff file. Test cases already passed please ignore current one #20.

jhodgdon’s picture

Status: Needs review » Fixed

Thanks! The patch looks good now, and I've committed it.

  • jhodgdon committed 17c7155 on 8.x-1.x
    Issue #3130380 by sanjayk, anisha.challa, jhodgdon: Minor test fix-ups
    

Status: Fixed » Closed (fixed)

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