getMockBuilder( '\ParamProcessor\ParamDefinition' )
->disableOriginalConstructor()
->getMock();
$this->assertInstanceOf(
ParameterInput::class,
new ParameterInput( $paramDefinition, '' )
);
}
/**
* @dataProvider listValueProvider
*/
public function testGetHtmlOnCheckboxList( $currentValue, $allowedValues, $expected ) {
$stringValidator = TestEnvironment::newValidatorFactory()->newStringValidator();
$paramDefinition = $this->getMockBuilder( '\ParamProcessor\ParamDefinition' )
->disableOriginalConstructor()
->getMock();
$paramDefinition->expects( $this->atLeastOnce() )
->method( 'getAllowedValues' )
->willReturn( $allowedValues );
$paramDefinition->expects( $this->any() )
->method( 'isList' )
->willReturn( true );
$instance = new ParameterInput(
$paramDefinition,
$currentValue
);
$stringValidator->assertThatStringContains(
$expected,
$instance->getHtml()
);
}
public function listValueProvider() {
$provider[] = [
'Foo',
[ 'Foo', 'Bar' ],
[
'Foo',
'Bar'
],
];
$provider[] = [
[ 'Foo' ],
[ 'Foo', 'Bar' ],
[
'Foo',
'Bar'
],
];
$provider[] = [
[ 'Foo, Bar' ],
[ 'Foo', 'Bar' ],
[
'Foo',
'Bar'
],
];
$provider[] = [
[ 'Foo,foo bar' ],
[ 'Foo', 'foo bar' ],
[
'Foo',
'foo bar'
],
];
return $provider;
}
}