public function testUnicode() { $config_path = __DIR__ . '/../sphinx/unicode.conf'; $plain_config = file_get_contents($config_path); $result = md5(serialize(Tokenizer::tokenize($plain_config))); static::assertEquals('2a589652bd1c299d62420f089b1207f9', $result); }
/** * @expectedException \LTDBeget\sphinx\SyntaxErrorException * @expectedExceptionMessage Parse error: syntax error, unexpected '.' on line 14. */ public function testWrongMultiLine3Conf() { $config_path = __DIR__ . '/../sphinx/invalid/wrong_multi_line_3.conf'; $plain_config = file_get_contents($config_path); /** @noinspection ExceptionsAnnotatingAndHandlingInspection */ Tokenizer::tokenize($plain_config); }
/** * Make Configuration object from plain content of sphinx configuration file * * @param string $stringConfiguration * @param Configuration $objectConfiguration * * @return Configuration * @throws \Hoa\Ustring\Exception * @throws \LTDBeget\sphinx\configurator\exceptions\SectionException * @throws \LogicException * @throws \InvalidArgumentException * @throws \LTDBeget\sphinx\configurator\exceptions\ConfigurationException * @throws \LTDBeget\sphinx\configurator\exceptions\DeserializeException * @throws \BadMethodCallException * @throws \LTDBeget\sphinx\SyntaxErrorException */ public static function deserialize(string $stringConfiguration, Configuration $objectConfiguration) : Configuration { return ArrayDeserializer::deserialize(Tokenizer::tokenize($stringConfiguration), $objectConfiguration); }