kostajh created this task.
kostajh added projects: MediaWiki-Core-Tests, 
MediaWiki-extensions-WikibaseRepository.
Restricted Application added a subscriber: Aklapper.

TASK DESCRIPTION
  Seen while debugging test failures for 
https://gerrit.wikimedia.org/r/c/mediawiki/core/+/813209.
  
  Modify 
`extensions/Wikibase/repo/tests/phpunit/includes/Hooks/HtmlPageLinkRendererEndHookHandlerTest.php`
 to query user names for your wiki. You'd expect to just see `UTSysop`, but 
instead the full list of user names on your local wiki is output: `php 
tests/phpunit/phpunit.php 
extensions/Wikibase/repo/tests/phpunit/includes/Hooks/HtmlPageLinkRendererEndHookHandlerTest.php
 --filter=testExtractForeignIdString`
  
    <?php
    /**
     * @dataProvider linkTargetProvider
     */
    public function testExtractForeignIdString( $linkTarget, $expectedOutput ) {
        $wrapper = TestingAccessWrapper::newFromObject( $this->newInstance() );
        $output = $wrapper->extractForeignIdString( $linkTarget );
        $this->assertSame( $expectedOutput, $output );
    }
    
    public function linkTargetProvider() {
        $db = wfGetDB( DB_PRIMARY );
        $selectQuery = new SelectQueryBuilder( $db );
        $result = $selectQuery
                ->table( 'user' )
                ->field( 'user_name' )
                ->fetchFieldValues();
        var_dump( $result );
        return [
                'NS=MAIN, title=null' => [ Title::makeTitle( NS_MAIN, null ), 
null ], // T260853
                'NS=SPECIAL, title=null' => [ Title::makeTitle( NS_SPECIAL, 
null ), null ],
                'NS=SPECIAL, title=EntityPage/Q123' => [ 
Title::newFromTextThrow( 'Special:EntityPage/Q123' ), 'Q123' ],
                // One of the defaults from MediaWiki's 
maintenance/interwiki.list (but not Wikidata, as this might be the local test 
wiki name)
                'NS=MAIN, title=Special:EntityPage/Q123' => [ 
Title::newFromTextThrow( 'metawikimedia:Special:EntityPage/Q123' ), 'Q123' ],
        ];
    }
  
  Note that with https://gerrit.wikimedia.org/r/c/mediawiki/core/+/813209, 
access to the main DB is prevented, and the `interwiki` table is empty, which 
is why the test fails.

TASK DETAIL
  https://phabricator.wikimedia.org/T312849

EMAIL PREFERENCES
  https://phabricator.wikimedia.org/settings/panel/emailpreferences/

To: kostajh
Cc: kostajh, Aklapper, ItamarWMDE, Akuckartz, DannyS712, lucamauri, Gq86, 
Wikidata-bugs, Jdforrester-WMF
_______________________________________________
Wikidata-bugs mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to