public function testTextToQueryForRealz() { $db = $this->connectionFactory->get('R'); $set = new Text(); $set->sqlIdentifierSet('n'); $query = new Query("SELECT n FROM ( VALUES ('a'),('b'),('c'),('d'),('e'),('f'),('g'),('h'),('i'),('j'),('k'),('l'),('m'),('n'),('o'),('p'),('q'),('r'),('s'),('t'),('u'),('v'),('w'),('x'),('y'),('z') ) AS _( n) WHERE %set:%", array('set' => $set)); $set->none()->add('a'); $result = $db->query($query)->fetch(Result::TYPE_DETECT); $this->assertSame($result, array('a')); $set->none()->add('a,b,c,f'); $result = $db->query($query)->fetch(Result::TYPE_DETECT); $this->assertSame($result, str_split("abcf")); $set->none()->add('-c,x-'); $result = $db->query($query)->fetch(Result::TYPE_DETECT); $this->assertSame($result, str_split("abcxyz")); $set->none()->add('c-e'); $result = $db->query($query)->fetch(Result::TYPE_DETECT); $this->assertSame($result, str_split("cde")); $set->none()->add('cat'); $result = $db->query($query)->fetch(Result::TYPE_DETECT); $this->assertSame($result, array()); }
public function testInvertWithRanges() { $set = new Text('\\0,-'); $this->assertSame((string) $set->invert(), ''); $set = new Text(''); $this->assertSame((string) $set->invert(), '\\0,-'); $set = new Text('A-'); $this->assertSame((string) $set->invert(), '\\0,-A'); $set = new Text('-B'); $this->assertSame((string) $set->invert(), '\\0,B-'); }