public function testIntegerToQueryNowWithNulls() { $db = $this->connectionFactory->get('R'); $set = new Integer(); $set->sqlIdentifierSet('n'); $query = new Query("SELECT n FROM ( VALUES (NULL),(1),(2),(3),(4),(5),(6),(7),(8) ) AS _( n) WHERE %set:%", array('set' => $set)); $set->none()->add('\\0,1'); $result = $db->query($query)->fetch(Result::TYPE_DETECT); $this->assertSame($result, array(null, 1)); $set->none()->add('1-8'); $result = $db->query($query)->fetch(Result::TYPE_DETECT); $this->assertSame($result, range(1, 8)); $set->all(); $result = $db->query($query)->fetch(Result::TYPE_DETECT); $this->assertSame(count($result), 9); }
public function testInvert() { $set = new Integer(5); $this->assertSame((string) $set->invert(), '\\0,-4,6-'); $set = new Integer('1,3'); $this->assertSame((string) $set->invert(), '\\0,-0,2,4-'); $set = new Integer('-'); $this->assertSame((string) $set->invert(), '\\0'); $set = new Integer('\\0'); $this->assertSame((string) $set->invert(), '-'); $set = new Integer(''); $this->assertSame((string) $set->invert(), '\\0,-'); $this->assertSame((string) $set->invert(), ''); $set = new Integer('6-'); $this->assertSame((string) $set->invert(), '\\0,-5'); $set = new Integer('-6'); $this->assertSame((string) $set->invert(), '\\0,7-'); }