MediaWiki
REL1_24
|
00001 <?php 00016 class FormOptionsExposed extends FormOptions { 00017 public function getOptions() { 00018 return $this->options; 00019 } 00020 } 00021 00032 class FormOptionsInitializationTest extends MediaWikiTestCase { 00036 protected $object; 00037 00042 protected function setUp() { 00043 parent::setUp(); 00044 $this->object = new FormOptionsExposed(); 00045 } 00046 00050 public function testAddStringOption() { 00051 $this->object->add( 'foo', 'string value' ); 00052 $this->assertEquals( 00053 array( 00054 'foo' => array( 00055 'default' => 'string value', 00056 'consumed' => false, 00057 'type' => FormOptions::STRING, 00058 'value' => null, 00059 ) 00060 ), 00061 $this->object->getOptions() 00062 ); 00063 } 00064 00068 public function testAddIntegers() { 00069 $this->object->add( 'one', 1 ); 00070 $this->object->add( 'negone', -1 ); 00071 $this->assertEquals( 00072 array( 00073 'negone' => array( 00074 'default' => -1, 00075 'value' => null, 00076 'consumed' => false, 00077 'type' => FormOptions::INT, 00078 ), 00079 'one' => array( 00080 'default' => 1, 00081 'value' => null, 00082 'consumed' => false, 00083 'type' => FormOptions::INT, 00084 ) 00085 ), 00086 $this->object->getOptions() 00087 ); 00088 } 00089 }