Jarry1250 has uploaded a new change for review. https://gerrit.wikimedia.org/r/178083
Change subject: Reorder tearDownAfterClass() to work around $title destruction ...................................................................... Reorder tearDownAfterClass() to work around $title destruction Functions like $title->getArticleID() cease to work once the WikiPage with which $title is associated is deleted. So we need to Change-Id: I6ecebe3c0ee10a379d4f10d5d852de627a73f5f9 --- M tests/phpunit/TranslateSvgTestCase.php 1 file changed, 19 insertions(+), 14 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/TranslateSvg refs/changes/83/178083/1 diff --git a/tests/phpunit/TranslateSvgTestCase.php b/tests/phpunit/TranslateSvgTestCase.php index b2a018c..4f926d3 100644 --- a/tests/phpunit/TranslateSvgTestCase.php +++ b/tests/phpunit/TranslateSvgTestCase.php @@ -100,22 +100,27 @@ parent::tearDownAfterClass(); $title = Title::makeTitle( NS_FILE, self::$name ); - if( $title->exists() ) { - $wikiPage = new WikiPage( $title ); - $wikiPage->doDeleteArticle( 'resetting' ); - $subpages = $title->getSubpages(); - foreach ( $subpages as $subpage ) { - /** @var Title $subpage */ - $wikiPage = new WikiPage( $subpage ); - $wikiPage->doDeleteArticle( 'resetting' ); - } - } - $dbw = wfGetDB( DB_MASTER ); - $row = array( 'ts_page_id' => $title->getArticleID() ); - $dbw->delete( 'translate_svg', $row, __METHOD__ ); - $conds = array( 'tmd_group' => str_replace( '_', ' ', self::$name ) ); + + $conds = array( 'ts_page_id' => $title->getArticleID() ); + $dbw->delete( 'translate_svg', $conds, __METHOD__ ); + + $conds = array( 'tmd_group' => self::$name ); $dbw->delete( 'translate_metadata', $conds, __METHOD__ ); $dbw->commit( __METHOD__, 'flush' ); + + if( !$title->exists() ) { + return; + } + + $subpages = $title->getSubpages(); + foreach ( $subpages as $subpage ) { + /** @var Title $subpage */ + $wikiPage = new WikiPage( $subpage ); + $wikiPage->doDeleteArticle( 'resetting' ); + } + + $wikiPage = new WikiPage( $title ); + $wikiPage->doDeleteArticle( 'resetting' ); } } \ No newline at end of file -- To view, visit https://gerrit.wikimedia.org/r/178083 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I6ecebe3c0ee10a379d4f10d5d852de627a73f5f9 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/TranslateSvg Gerrit-Branch: master Gerrit-Owner: Jarry1250 <jarry1...@gmail.com> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits