protected function setCaseSensitive($caseSensitive) { if ($caseSensitive) { $this->builder->parseCaseSensitive(); } else { $this->builder->parseCaseInsensitive(); } }
/** * @dataProvider data_parseSuccess */ public function test_parseSuccess_caseSensitive($text, $expectedIndex, $expectedErrorIndex, $expected) { $this->builder->parseCaseSensitive()->appendZoneId(); $lcText = strtolower($text); $parsed = $this->builder->toFormatter()->parseUnresolved($lcText, $this->pos); if (preg_match("/[^A-Z]*[A-Z].*/", $text)) { // if input has letters $this->assertEquals($this->pos->getErrorIndex() >= 0, true); $this->assertEquals($this->pos->getIndex(), 0); $this->assertEquals($parsed, null); } else { // case sensitive made no difference $this->assertEquals($this->pos->getIndex(), $expectedIndex, "Incorrect index parsing: " . $lcText); $this->assertEquals($this->pos->getErrorIndex(), $expectedErrorIndex, "Incorrect error index parsing: " . $lcText); if ($expected !== null) { $this->assertEquals($parsed->query(TemporalQueries::zoneId()), $expected); $this->assertEquals($parsed->query(TemporalQueries::offset()), null); $this->assertEquals($parsed->query(TemporalQueries::zone()), $expected); } else { $this->assertEquals($parsed, null); } } }
public function test_parseCaseSensitive() { $this->builder->parseCaseSensitive(); $f = $this->builder->toFormatter(); $this->assertEquals($f->__toString(), "ParseCaseSensitive(true)"); }