9 'rows' => [
'r1',
'r2' ],
10 'columns' => [
'c1',
'c2' ],
11 'fieldname' =>
'test',
18 $this->assertInstanceOf( HTMLFormFieldRequiredOptionsException::class,
$e );
22 $this->fail(
'Expected MWException indicating missing parameters but none was thrown.' );
27 $this->assertTrue(
true );
33 'validation-callback' =>
function () use ( &
$called ) {
39 $this->assertEquals(
false, $this->
validate( $field, [] ) );
45 $this->assertEquals(
false, $this->
validate( $field,
null ) );
46 $this->assertEquals(
false, $this->
validate( $field,
true ) );
47 $this->assertEquals(
false, $this->
validate( $field,
'abc' ) );
48 $this->assertEquals(
false, $this->
validate( $field,
new stdClass ) );
49 $this->assertEquals(
true, $this->
validate( $field, [] ) );
54 $this->assertInstanceOf( Message::class, $this->
validate( $field, [
'foo' ] ) );
59 $this->assertTrue( $this->
validate( $field, [] ) );
60 $this->assertTrue( $this->
validate( $field, [
'c1-r1' ] ) );
61 $this->assertTrue( $this->
validate( $field, [
'c1-r1',
'c1-r2',
'c2-r1',
'c2-r2' ] ) );
73 'force-options-on' => [
'c2-r1' ],
81 $this->assertEquals( $expected, $field->filterDataForSubmit( [] ) );
86 'force-options-off' => [
'c1-r2',
'c2-r2' ],
95 $this->assertEquals( $expected, $field->filterDataForSubmit( array_keys( $expected ) ) );
99 return $field->validate(
101 [ self::$defaultOptions[
'fieldname'] => $submitted ]
Unit tests for the HTMLCheckMatrix HTMLCheckMatrix.
testValidateAllowsOnlyKnownTags()
validate(HTMLFormField $field, $submitted)
testValidateCallsUserDefinedValidationCallback()
testValidateRequiresArrayInput()
testValidateAcceptsPartialTagList()
testValuesForcedOffRemainOff()
testValuesForcedOnRemainOn()
This form object actually has no visibility into what happens later on, but essentially if the data s...
testInstantiationWithMinimumRequiredParameters()
A checkbox matrix Operates similarly to HTMLMultiSelectField, but instead of using an array of option...
returning false will NOT prevent logging $e