All Downloads are FREE. Search and download functionalities are using the official Maven repository.

php-slim4-server.string_utils_trait_test.mustache Maven / Gradle / Ivy

assertSame($expectedWord, StringUtils::camelize($word, $lowercaseFirstLetter));
    }

    public function provideWordsForCamelizeTest()
    {
        return [
            // fixtures from modules/openapi-generator/src/test/java/org/openapitools/codegen/utils/StringUtilsTest.java
            ['openApiServer/model/pet', null, 'OpenApiServerModelPet'],
            ['abcd', null, 'Abcd'],
            ['some-value', null, 'SomeValue'],
            ['some-Value', null, 'SomeValue'],
            ['some_value', null, 'SomeValue'],
            ['some_Value', null, 'SomeValue'],
            ['$type', null, '$Type'],

            ['abcd', true, 'abcd'],
            ['some-value', true, 'someValue'],
            ['some_value', true, 'someValue'],
            ['Abcd', true, 'abcd'],
            ['$type', true, '$type'],

            ['123', true, '123'],
            ['$123', true, '$123'],
        ];
    }

    /**
     * @covers ::isReservedWord
     * @dataProvider provideWordsForIsReservedTest
     */
    public function testisReservedWord($word, $expected)
    {
        $this->assertSame($expected, StringUtils::isReservedWord($word));
    }

    public function provideWordsForIsReservedTest()
    {
        return [
            ['return', true],
            ['switch', true],
            ['class', true],
            ['interface', true],
            ['ABSTRACT', true],
            ['Trait', true],
            ['final', true],
            ['foobar', false],
            ['DateTime', false],
            ['Pet', false],
            [123, false],
            [null, false],
        ];
    }
}
{{/apiInfo}}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy