* @copyright Meritoo.pl */ class UnknownMethodExceptionTest extends BaseTestCase { public function testConstructorVisibilityAndArguments() { static::assertConstructorVisibilityAndArguments(UnknownMethodException::className, OopVisibilityType::IS_PUBLIC, 1, 1); } /** * @param string $unknownType The unknown type of something (value of constant) * @param string $expectedMessage Expected exception's message * * @dataProvider provideUnknownType */ public function testConstructorMessage($unknownType, $expectedMessage) { $exception = new UnknownMethodException($unknownType); static::assertEquals($expectedMessage, $exception->getMessage()); } /** * Provides name of called method * * @return array * //return Generator */ public function provideUnknownType() { $allMethods = implode(', ', (new MethodType())->getAll()); $template = 'The \'%s\' type of name of method used while talking to the LimeSurvey\'s API is unknown. Probably' . ' doesn\'t exist or there is a typo. You should use one of these types: %s.'; return [ [ MethodType::ADD_PARTICIPANTS, sprintf($template, MethodType::ADD_PARTICIPANTS, $allMethods), ], [ MethodType::ADD_PARTICIPANTS, sprintf($template, MethodType::ADD_PARTICIPANTS, $allMethods), ], ]; /* yield[ MethodType::ADD_PARTICIPANTS, sprintf($template, MethodType::ADD_PARTICIPANTS, $allMethods), ]; yield[ MethodType::ADD_PARTICIPANTS, sprintf($template, MethodType::ADD_PARTICIPANTS, $allMethods), ]; */ } }