public function __construct($loggly_input_key) { if (!Valid::exact_length($loggly_input_key, self::LOGGLY_KEY_LENGTH)) { throw new Kohana_Exception('Loggly input key must be exactly :length characters long.', [':length' => self::LOGGLY_KEY_LENGTH]); } $this->_loggly_input_key = $loggly_input_key; }
/** * * Tests Valid::exact_length() * * Checks that a field is exactly the right length. * * @test * @dataProvider provider_exact_length * @param string $string The string to length check * @param integer $length The length of the string * @param boolean $correct Is $length the actual length of the string? * @return bool */ public function test_exact_length($string, $length, $correct) { return $this->assertSame($correct, Valid::exact_length($string, $length), 'Reported string length is not correct'); }