diff options
author | Kunal Mehta <legoktm@member.fsf.org> | 2019-01-29 21:33:42 -0800 |
---|---|---|
committer | Kunal Mehta <legoktm@member.fsf.org> | 2019-01-29 21:33:42 -0800 |
commit | 8ff88cc4d2128a940e1ae77dc44baf1cf6516b41 (patch) | |
tree | d9ed5ac2708236a363c8e3d464ded6864aeef49b | |
parent | 19619edf43ce63c658ebd179304f95eae56f5f7c (diff) | |
download | mediawikicore-8ff88cc4d2128a940e1ae77dc44baf1cf6516b41.tar.gz mediawikicore-8ff88cc4d2128a940e1ae77dc44baf1cf6516b41.zip |
Use TestingAccessWrapper in FormOptionsInitializationTest
Avoids the need for an extra wrapper class just to make a property
public.
Change-Id: I08ae2fb24604a2bde352525abdcadf6251045f5b
-rw-r--r-- | tests/phpunit/includes/FormOptionsInitializationTest.php | 29 |
1 files changed, 6 insertions, 23 deletions
diff --git a/tests/phpunit/includes/FormOptionsInitializationTest.php b/tests/phpunit/includes/FormOptionsInitializationTest.php index 0c853e0833e0..2c78618aa1dc 100644 --- a/tests/phpunit/includes/FormOptionsInitializationTest.php +++ b/tests/phpunit/includes/FormOptionsInitializationTest.php @@ -1,23 +1,6 @@ <?php -/** - * This file host two test case classes for the MediaWiki FormOptions class: - * - FormOptionsInitializationTest : tests initialization of the class. - * - FormOptionsTest : tests methods an on instance - * - * The split let us take advantage of setting up a fixture for the methods - * tests. - */ -/** - * Dummy class to makes FormOptions::$options public. - * Used by FormOptionsInitializationTest which need to verify the $options - * array is correctly set through the FormOptions::add() function. - */ -class FormOptionsExposed extends FormOptions { - public function getOptions() { - return $this->options; - } -} +use Wikimedia\TestingAccessWrapper; /** * Test class for FormOptions initialization @@ -39,11 +22,11 @@ class FormOptionsInitializationTest extends MediaWikiTestCase { */ protected function setUp() { parent::setUp(); - $this->object = new FormOptionsExposed(); + $this->object = TestingAccessWrapper::newFromObject( new FormOptions() ); } /** - * @covers FormOptionsExposed::add + * @covers FormOptions::add */ public function testAddStringOption() { $this->object->add( 'foo', 'string value' ); @@ -56,12 +39,12 @@ class FormOptionsInitializationTest extends MediaWikiTestCase { 'value' => null, ] ], - $this->object->getOptions() + $this->object->options ); } /** - * @covers FormOptionsExposed::add + * @covers FormOptions::add */ public function testAddIntegers() { $this->object->add( 'one', 1 ); @@ -81,7 +64,7 @@ class FormOptionsInitializationTest extends MediaWikiTestCase { 'type' => FormOptions::INT, ] ], - $this->object->getOptions() + $this->object->options ); } } |