MediaWiki  REL1_19
FormOptionsInitializationTest.php
Go to the documentation of this file.
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 
00038 
00043         protected function setUp() {
00044                 $this->object = new FormOptionsExposed();
00045                 
00046         }
00047 
00048         public function testAddStringOption() {
00049                 $this->object->add( 'foo', 'string value' ); 
00050                 $this->assertEquals(
00051                         array(
00052                                 'foo' => array(
00053                                         'default'  => 'string value',
00054                                         'consumed' => false,
00055                                         'type'   => FormOptions::STRING,
00056                                         'value' => null,
00057                                         )
00058                         ),
00059                         $this->object->getOptions()
00060                 );
00061         }
00062 
00063         public function testAddIntegers() {
00064                 $this->object->add( 'one',     1 ); 
00065                 $this->object->add( 'negone', -1 ); 
00066                 $this->assertEquals(
00067                         array(
00068                                 'negone' => array(
00069                                         'default'  => -1, 
00070                                         'value' => null,
00071                                         'consumed' => false,
00072                                         'type'   => FormOptions::INT,
00073                                         ),
00074                                 'one' => array(
00075                                         'default'  => 1,
00076                                         'value' => null,
00077                                         'consumed' => false,
00078                                         'type'   => FormOptions::INT,
00079                                         )
00080                         ),
00081                         $this->object->getOptions()
00082                 );
00083         }
00084 
00085 }