wiki.techinc.nl/tests/phpunit/includes/FormOptionsTest.php
2011-02-28 20:58:34 +00:00

250 lines
6 KiB
PHP

<?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.
*/
/**
* Test class for FormOptions methods.
* Generated by PHPUnit on 2011-02-28 at 20:46:27.
*
* Copyright © 2011, Ashar Voultoiz
*
* @author Ashar Voultoiz
*/
class FormOptionsTest extends MediaWikiTestCase {
/**
* @var FormOptions
*/
protected $object;
/**
* Instanciates a FormOptions object to play with.
* FormOptions::add() is tested by the class FormOptionsInitializationTest
* so we assume the function is well tested already an use it to create
* the fixture.
*/
protected function setUp() {
$this->object = new FormOptions;
$this->object->add( 'string1', 'string one' );
$this->object->add( 'string2', 'string two' );
$this->object->add( 'integer', 0 );
$this->object->add( 'intnull', 0, FormOptions::INTNULL );
}
/**
* @todo Implement testDelete().
*/
public function testDelete() {
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
/** Helpers for testGuessType() */
/* @{ */
private function assertGuessBoolean( $data ) {
$this->guess( FormOptions::BOOL, $data );
}
private function assertGuessInt( $data ) {
$this->guess( FormOptions::INT, $data );
}
private function assertGuessString( $data ) {
$this->guess( FormOptions::STRING, $data );
}
/** Generic helper */
private function guess( $expected, $data ) {
$this->assertEquals(
$expected,
FormOptions::guessType( $data )
);
}
/* @} */
/**
* Reuse helpers above assertGuessBoolean assertGuessInt assertGuessString
*/
public function testGuessTypeDetection() {
$this->assertGuessBoolean( true );
$this->assertGuessBoolean( false );
$this->assertGuessInt( 0 );
$this->assertGuessInt( -5 );
$this->assertGuessInt( 5 );
$this->assertGuessInt( 0x0F );
$this->assertGuessString( 'true' );
$this->assertGuessString( 'false' );
$this->assertGuessString( '5' );
$this->assertGuessString( '0' );
}
/**
* @expectedException MWException
*/
public function testGuessTypeOnArrayThrowException() {
$this->object->guessType( array( 'foo' ) );
}
/**
* @expectedException MWException
*/
public function testGuessTypeOnNullThrowException() {
$this->object->guessType( null );
}
/**
* @todo Implement testValidateName().
*/
public function testValidateName() {
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
/**
* @todo Implement testSetValue().
*/
public function testSetValue() {
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
/**
* @todo Implement testGetValue().
*/
public function testGetValue() {
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
/**
* @todo Implement testReset().
*/
public function testReset() {
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
/**
* @todo Implement testConsumeValue().
*/
public function testConsumeValue() {
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
/**
* @todo Implement testConsumeValues().
*/
public function testConsumeValues() {
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
/**
* @todo Implement testValidateIntBounds().
*/
public function testValidateIntBounds() {
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
/**
* @todo Implement testGetUnconsumedValues().
*/
public function testGetUnconsumedValues() {
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
/**
* @todo Implement testGetChangedValues().
*/
public function testGetChangedValues() {
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
/**
* @todo Implement testGetAllValues().
*/
public function testGetAllValues() {
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
/**
* @todo Implement testFetchValuesFromRequest().
*/
public function testFetchValuesFromRequest() {
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
/**
* @todo Implement testOffsetExists().
*/
public function testOffsetExists() {
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
/**
* @todo Implement testOffsetGet().
*/
public function testOffsetGet() {
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
/**
* @todo Implement testOffsetSet().
*/
public function testOffsetSet() {
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
/**
* @todo Implement testOffsetUnset().
*/
public function testOffsetUnset() {
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
}