* upgrade patches for oracle 1.17->1.19
[mediawiki.git] / tests / phpunit / includes / FormOptionsTest.php
blobeab2def3f4f6ca374b53c16ab66a0c4ccdc57f64
1 <?php
2 /**
3 * This file host two test case classes for the MediaWiki FormOptions class:
4 * - FormOptionsInitializationTest : tests initialization of the class.
5 * - FormOptionsTest : tests methods an on instance
7 * The split let us take advantage of setting up a fixture for the methods
8 * tests.
9 */
11 /**
12 * Test class for FormOptions methods.
13 * Generated by PHPUnit on 2011-02-28 at 20:46:27.
15 * Copyright © 2011, Ashar Voultoiz
17 * @author Ashar Voultoiz
19 class FormOptionsTest extends MediaWikiTestCase {
20 /**
21 * @var FormOptions
23 protected $object;
25 /**
26 * Instanciates a FormOptions object to play with.
27 * FormOptions::add() is tested by the class FormOptionsInitializationTest
28 * so we assume the function is well tested already an use it to create
29 * the fixture.
31 protected function setUp() {
32 $this->object = new FormOptions;
33 $this->object->add( 'string1', 'string one' );
34 $this->object->add( 'string2', 'string two' );
35 $this->object->add( 'integer', 0 );
36 $this->object->add( 'intnull', 0, FormOptions::INTNULL );
39 /**
40 * @todo Implement testDelete().
42 public function testDelete() {
43 // Remove the following lines when you implement this test.
44 $this->markTestIncomplete(
45 'This test has not been implemented yet.'
49 /** Helpers for testGuessType() */
50 /* @{ */
51 private function assertGuessBoolean( $data ) {
52 $this->guess( FormOptions::BOOL, $data );
54 private function assertGuessInt( $data ) {
55 $this->guess( FormOptions::INT, $data );
57 private function assertGuessString( $data ) {
58 $this->guess( FormOptions::STRING, $data );
61 /** Generic helper */
62 private function guess( $expected, $data ) {
63 $this->assertEquals(
64 $expected,
65 FormOptions::guessType( $data )
68 /* @} */
70 /**
71 * Reuse helpers above assertGuessBoolean assertGuessInt assertGuessString
73 public function testGuessTypeDetection() {
74 $this->assertGuessBoolean( true );
75 $this->assertGuessBoolean( false );
77 $this->assertGuessInt( 0 );
78 $this->assertGuessInt( -5 );
79 $this->assertGuessInt( 5 );
80 $this->assertGuessInt( 0x0F );
82 $this->assertGuessString( 'true' );
83 $this->assertGuessString( 'false' );
84 $this->assertGuessString( '5' );
85 $this->assertGuessString( '0' );
88 /**
89 * @expectedException MWException
91 public function testGuessTypeOnArrayThrowException() {
92 $this->object->guessType( array( 'foo' ) );
94 /**
95 * @expectedException MWException
97 public function testGuessTypeOnNullThrowException() {
98 $this->object->guessType( null );
102 * @todo Implement testValidateName().
104 public function testValidateName() {
105 // Remove the following lines when you implement this test.
106 $this->markTestIncomplete(
107 'This test has not been implemented yet.'
112 * @todo Implement testSetValue().
114 public function testSetValue() {
115 // Remove the following lines when you implement this test.
116 $this->markTestIncomplete(
117 'This test has not been implemented yet.'
122 * @todo Implement testGetValue().
124 public function testGetValue() {
125 // Remove the following lines when you implement this test.
126 $this->markTestIncomplete(
127 'This test has not been implemented yet.'
132 * @todo Implement testReset().
134 public function testReset() {
135 // Remove the following lines when you implement this test.
136 $this->markTestIncomplete(
137 'This test has not been implemented yet.'
142 * @todo Implement testConsumeValue().
144 public function testConsumeValue() {
145 // Remove the following lines when you implement this test.
146 $this->markTestIncomplete(
147 'This test has not been implemented yet.'
152 * @todo Implement testConsumeValues().
154 public function testConsumeValues() {
155 // Remove the following lines when you implement this test.
156 $this->markTestIncomplete(
157 'This test has not been implemented yet.'
162 * @todo Implement testValidateIntBounds().
164 public function testValidateIntBounds() {
165 // Remove the following lines when you implement this test.
166 $this->markTestIncomplete(
167 'This test has not been implemented yet.'
172 * @todo Implement testGetUnconsumedValues().
174 public function testGetUnconsumedValues() {
175 // Remove the following lines when you implement this test.
176 $this->markTestIncomplete(
177 'This test has not been implemented yet.'
182 * @todo Implement testGetChangedValues().
184 public function testGetChangedValues() {
185 // Remove the following lines when you implement this test.
186 $this->markTestIncomplete(
187 'This test has not been implemented yet.'
192 * @todo Implement testGetAllValues().
194 public function testGetAllValues() {
195 // Remove the following lines when you implement this test.
196 $this->markTestIncomplete(
197 'This test has not been implemented yet.'
202 * @todo Implement testFetchValuesFromRequest().
204 public function testFetchValuesFromRequest() {
205 // Remove the following lines when you implement this test.
206 $this->markTestIncomplete(
207 'This test has not been implemented yet.'
212 * @todo Implement testOffsetExists().
214 public function testOffsetExists() {
215 // Remove the following lines when you implement this test.
216 $this->markTestIncomplete(
217 'This test has not been implemented yet.'
222 * @todo Implement testOffsetGet().
224 public function testOffsetGet() {
225 // Remove the following lines when you implement this test.
226 $this->markTestIncomplete(
227 'This test has not been implemented yet.'
232 * @todo Implement testOffsetSet().
234 public function testOffsetSet() {
235 // Remove the following lines when you implement this test.
236 $this->markTestIncomplete(
237 'This test has not been implemented yet.'
242 * @todo Implement testOffsetUnset().
244 public function testOffsetUnset() {
245 // Remove the following lines when you implement this test.
246 $this->markTestIncomplete(
247 'This test has not been implemented yet.'