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
This commit is contained in:
Thiemo Mättig 2017-05-30 22:40:09 +02:00 committed by Thiemo Mättig (WMDE)
parent 722141ff0c
commit 6b22f1089e
2 changed files with 5 additions and 4 deletions

View file

@ -135,7 +135,7 @@ class MediaWikiGadgetsDefinitionRepo extends GadgetRepo {
* 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 );

View file

@ -163,9 +163,10 @@ class GadgetsTest extends MediaWikiTestCase {
$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() {