Awight has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/403458 )
Change subject: Cover a couple of conditions ...................................................................... Cover a couple of conditions Change-Id: I40bedcee1c6da4d837ab9b9109ad6d26e0164f79 --- M tests/phpunit/includes/Hooks/ChangesListHooksHandlerTest.php 1 file changed, 31 insertions(+), 0 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/ORES refs/changes/58/403458/1 diff --git a/tests/phpunit/includes/Hooks/ChangesListHooksHandlerTest.php b/tests/phpunit/includes/Hooks/ChangesListHooksHandlerTest.php index b55bd01..dd47f50 100644 --- a/tests/phpunit/includes/Hooks/ChangesListHooksHandlerTest.php +++ b/tests/phpunit/includes/Hooks/ChangesListHooksHandlerTest.php @@ -51,6 +51,7 @@ $this->user->setOption( 'rcOresDamagingPref', 'maybebad' ); $this->user->setOption( 'oresHighlight', 1 ); $this->user->setOption( 'ores-damaging-flag-rc', 1 ); + $this->user->setOption( 'oresRCHideNonDamaging', 1 ); $this->user->setOption( 'rcenhancedfilters-disable', true ); $this->user->saveSettings(); @@ -404,6 +405,36 @@ $maybebadFilter = $damagingFilterGroup->getFilter( 'maybebad' ); $this->assertNotNull( $maybebadFilter ); + $this->assertEquals( 'maybebad', $damagingFilterGroup->getDefault() ); + + $goodfaithFilterGroup = $changesListSpecialPage->getFilterGroup( 'goodfaith' ); + $this->assertNull( $goodfaithFilterGroup ); + } + + /** + * @covers ORES\Hooks\ChangesListHooksHandler::onChangesListSpecialPageStructuredFilters + */ + public function testOnChangesListSpecialPageStructuredFilters_Watchlist() { + $this->user->setOption( 'oresWatchlistHideNonDamaging', 0 ); + $this->user->setOption( 'oresHighlight', 1 ); + + $changesListSpecialPage = new \SpecialWatchlist(); + $changesListSpecialPage->setContext( $this->context ); + $wrappedClsp = TestingAccessWrapper::newFromObject( $changesListSpecialPage ); + $wrappedClsp->registerFilters(); + + ChangesListHooksHandler::onChangesListSpecialPageStructuredFilters( $changesListSpecialPage ); + + $damagingFilterGroup = $changesListSpecialPage->getFilterGroup( 'damaging' ); + $this->assertNotNull( $damagingFilterGroup ); + $maybebadFilter = $damagingFilterGroup->getFilter( 'maybebad' ); + $this->assertNotNull( $maybebadFilter ); + + $this->assertEquals( '', $damagingFilterGroup->getDefault() ); + + $filterJsData = $damagingFilterGroup->getFilter( 'likelybad' )->getJsData(); + $this->assertEquals( 'c4', $filterJsData['defaultHighlightColor'] ); + $goodfaithFilterGroup = $changesListSpecialPage->getFilterGroup( 'goodfaith' ); $this->assertNull( $goodfaithFilterGroup ); } -- To view, visit https://gerrit.wikimedia.org/r/403458 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I40bedcee1c6da4d837ab9b9109ad6d26e0164f79 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/ORES Gerrit-Branch: master Gerrit-Owner: Awight <awi...@wikimedia.org> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits