/** * Test if stringlength is in range * * @param string $value * @param string $configuration e.g. "1,6" or "6" * @return bool */ protected function validateLength($value, $configuration) { $values = GeneralUtility::trimExplode(',', $configuration, true); if ((int) $values[0] <= 0) { return true; } if (!isset($values[1])) { $values[1] = $values[0]; $values[0] = 1; } return StringUtility::getStringLength($value) >= $values[0] && StringUtility::getStringLength($value) <= $values[1]; }
/** * getStringLength Test * * @param string $string * @param int $expectedResult * @dataProvider getStringLengthReturnIntDataProvider * @return void * @test */ public function getStringLengthReturnInt($string, $expectedResult) { $this->assertSame($expectedResult, StringUtility::getStringLength($string)); }