Page MenuHomePhabricator

Write tests for page assessment tool
Closed, ResolvedPublic5 Estimated Story Points

Description

Write php unit tests for most of the functions in PageAssessmentsBody class:

Acceptance criteria:

  • Create various tests for PageAssessmentsBody::execute() that exercise record inserting, updating, and deleting. The tests should assert that the data in the database matches expectations after running execute(). You can either utilize $this->assertSelect() from the MediaWikiTestCase parent class or write a simple getPageAssessments() function in PageAssessmentsBody to look at the resulting data.
  • Create a test for PageAssessmentsBody::getAllProjects().

See https://www.mediawiki.org/wiki/Manual:PHP_unit_testing/Writing_unit_tests#Databases for how to set up database-related tests. For some examples, see extensions/Math/tests/MathDatabaseTest.php or extensions/Gather/tests/phpunit/api/GatherTest.php.

See https://www.mediawiki.org/wiki/Manual:PHP_unit_testing/Writing_unit_tests_for_extensions for general documentation on how to write unit tests for extensions.

You may want to utilize addDBData() and insertPage() from the parent class, MediaWikiTestCase, during set-up.

Event Timeline

DannyH raised the priority of this task from to Needs Triage.
DannyH updated the task description. (Show Details)
DannyH added a project: Community-Tech.
DannyH moved this task to Needs Discussion on the Community-Tech board.
DannyH subscribed.
DannyH triaged this task as Medium priority.Dec 18 2015, 7:03 PM
DannyH edited a custom field.
DannyH moved this task from Needs Discussion to Up Next on the Community-Tech board.

Change 266786 had a related patch set uploaded (by Niharika29):
Tests for the PageAssessments extension

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

Change 266786 merged by jenkins-bot:
Tests for the PageAssessments extension

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

kaldari moved this task from Needs Review/Feedback to Q3 2018-19 on the Community-Tech-Sprint board.
kaldari subscribed.