Thiemo Mättig (WMDE) has uploaded a new change for review. (
https://gerrit.wikimedia.org/r/356281 )
Change subject: Use …->assertArrayHasKey() instead of isset()
......................................................................
Use …->assertArrayHasKey() instead of isset()
… as well as update a line of documentation I had stashed. I think this
does not need it's own patch, or does it?
Change-Id: I99eee1f7b5ec96c1c75e73d66200bc41807452fa
---
M includes/MediaWikiGadgetsDefinitionRepo.php
M tests/phpunit/GadgetTest.php
2 files changed, 5 insertions(+), 4 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Gadgets
refs/changes/81/356281/1
diff --git a/includes/MediaWikiGadgetsDefinitionRepo.php
b/includes/MediaWikiGadgetsDefinitionRepo.php
index 06e0760..c0ae3e0 100644
--- a/includes/MediaWikiGadgetsDefinitionRepo.php
+++ b/includes/MediaWikiGadgetsDefinitionRepo.php
@@ -135,7 +135,7 @@
* Generates a structured list of Gadget objects from a definition
*
* @param string $definition
- * @return array Array( name => Gadget )
+ * @return Gadget[] List of Gadget objects indexed by the gadget's name.
*/
private function listFromDefinition( $definition ) {
$definition = preg_replace( '/<!--.*?-->/s', '', $definition );
diff --git a/tests/phpunit/GadgetTest.php b/tests/phpunit/GadgetTest.php
index 25f1ef7..1229281 100644
--- a/tests/phpunit/GadgetTest.php
+++ b/tests/phpunit/GadgetTest.php
@@ -163,9 +163,10 @@
$this->assertTrue( GadgetHooks::getPreferences( new User,
$prefs ), 'GetPrefences hook should return true' );
$options = $prefs['gadgets']['options'];
- $this->assertFalse( isset(
$options['⧼gadget-section-remove-section⧽'] ), 'Must not show empty sections' );
- $this->assertTrue( isset(
$options['⧼gadget-section-keep-section1⧽'] ) );
- $this->assertTrue( isset(
$options['⧼gadget-section-keep-section2⧽'] ) );
+ $this->assertArrayNotHasKey( '⧼gadget-section-remove-section⧽',
$options,
+ 'Must not show empty sections' );
+ $this->assertArrayHasKey( '⧼gadget-section-keep-section1⧽',
$options );
+ $this->assertArrayHasKey( '⧼gadget-section-keep-section2⧽',
$options ) );
}
public function tearDown() {
--
To view, visit https://gerrit.wikimedia.org/r/356281
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I99eee1f7b5ec96c1c75e73d66200bc41807452fa
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Gadgets
Gerrit-Branch: master
Gerrit-Owner: Thiemo Mättig (WMDE) <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits