Page MenuHomePhabricator

PHPUnit: Cover NULL cases for getPluralLicenseInfo() in MobileFrontendSkinHooks class
Closed, ResolvedPublic

Description

The test method for getPluralLicenseInfo() in MobileFrontendSkinHooks class doesn't cover the null cases. According to the code coverage report, the current test for this method doesn't execute that code. Covering it.

Code snippet

else {
    $delimiterMsg = wfMessage( 'and' );
}

Acceptance Criteria

  • Code coverage has gone up (getPluralLicenseInfo() method covered 100%)
  • Else code path covered
  • Null cases covered

Event Timeline

xSavitar triaged this task as Medium priority.Nov 17 2018, 2:18 PM
xSavitar created this task.

Change 474462 had a related patch set uploaded (by D3r1ck01; owner: Alangi Derick):
[mediawiki/extensions/MobileFrontend@master] Cover the NULL in MobileFrontendSkinHooksTest

https://gerrit.wikimedia.org/r/474462

xSavitar updated the task description. (Show Details)Nov 17 2018, 2:24 PM
xSavitar updated the task description. (Show Details)Nov 17 2018, 2:34 PM
xSavitar moved this task from Doing [WIP] to Completed (To be Resolved) on the User-xSavitar board.

Change 474462 merged by jenkins-bot:
[mediawiki/extensions/MobileFrontend@master] Cover the NULL cases in getPluralLicenseInfo() unit test

https://gerrit.wikimedia.org/r/474462

phuedx added a subscriber: phuedx.Nov 19 2018, 2:25 PM

Code coverage has gone up

Finding coverage difference in cb0bc3bfb9f946caf90755345928d80135638182
$ php7.0 -d zend_extension=xdebug.so "$MW_INSTALL_PATH"/tests/phpunit/phpunit.php --coverage-clover /tmp/clovertu70If --filter '/MobileFrontend\.skin\.hooksTest/'
Using PHP 7.0.30-0+deb9u1
PHPUnit 6.5.13 by Sebastian Bergmann and contributors.



Time: 10.34 seconds, Memory: 308.00MB

No tests executed!

Generating code coverage report in Clover XML format ... done
$ php7.0 -d zend_extension=xdebug.so "$MW_INSTALL_PATH"/tests/phpunit/phpunit.php --coverage-clover /tmp/cloveryxI6tH --filter '/MobileFrontend\.skin\.hooksTest/'
Using PHP 7.0.30-0+deb9u1
PHPUnit 6.5.13 by Sebastian Bergmann and contributors.



Time: 10.16 seconds, Memory: 308.00MB

No tests executed!

Generating code coverage report in Clover XML format ... done
No coverage changes found.

It looks like the test (tests/phpunit/MobileFrontend.skin.hooksTest.php) is actually filtered out.

Pulling out of sprint, but this is not completed yet.

xSavitar removed xSavitar as the assignee of this task.Nov 23 2018, 3:39 PM

Will pick this up again soonish :)

xSavitar raised the priority of this task from Medium to Needs Triage.Dec 22 2018, 6:10 PM

Change 486248 had a related patch set uploaded (by D3r1ck01; owner: Derick Alangi):
[mediawiki/extensions/MobileFrontend@master] MobileFrontend.skin.hooks: Cover getPluralLicenseInfo with NULL $msgObj

https://gerrit.wikimedia.org/r/486248

xSavitar triaged this task as Medium priority.
xSavitar moved this task from Backlog to Doing [WIP] on the User-xSavitar board.

Change 486248 merged by jenkins-bot:
[mediawiki/extensions/MobileFrontend@master] MobileFrontend.skin.hooks: Cover getPluralLicenseInfo with NULL $msgObj

https://gerrit.wikimedia.org/r/486248

xSavitar reassigned this task from xSavitar to phuedx.Jan 24 2019, 8:08 PM
xSavitar updated the task description. (Show Details)

Changed assignee for signoff

xSavitar updated the task description. (Show Details)Jan 24 2019, 8:09 PM
phuedx removed phuedx as the assignee of this task.Jan 25 2019, 5:11 PM
pmiazga claimed this task.Jan 25 2019, 8:16 PM

getPluralLicenseInfo() is fully covered. Resolving task.

pmiazga closed this task as Resolved.Jan 25 2019, 8:20 PM
pmiazga removed pmiazga as the assignee of this task.