public function testAddGet() { $this->module->executeCommand('HSET', ['tfx_hash111', 'hashfield', 'hashval']); $this->module->executeCommand('HMSET', ['testfxt:1:hash111', 'hashfierththld1', 'hasgkbjrfkjkhval1', '4543', 'hashvatgrl2']); Debug::debug($this->module->executeCommand('HGETALL', ['tfx_hash111'])); Debug::debug($this->module->executeCommand('HGETALL', ['testfxt:1:hash111'])); }
public function testEscapeQuotes() { $keys = $this->module->executeCommand('KEYS', ['stress:*']); foreach ($keys as $key) { $qkey = Redisman::quoteValue($key); Debug::debug($key . ' - ' . $qkey); $res = $this->module->executeCommand('EVAL', [$this->buildExistScript($qkey), 0]); $this->assertEquals(1, $res); $res = $this->module->executeCommand('EXISTS', [$key]); $this->assertEquals(1, $res); } }
public function testFixturizer() { $fixter = new RedisFixts(); $fixter->createFixtures(); $this->module->setConnection('local', 1); $this->assertEquals(1, $this->module->executeCommand('EXISTS', ['tfx_string'])); $this->assertEquals(1, $this->module->executeCommand('EXISTS', ['tfx_hash'])); $this->assertEquals(1, $this->module->executeCommand('EXISTS', ['tfx_list'])); $this->assertEquals(1, $this->module->executeCommand('EXISTS', ['tfx_set'])); $this->assertEquals(1, $this->module->executeCommand('EXISTS', ['tfx_zset'])); $this->assertEquals(-1, $this->module->executeCommand('TTL', ['tfx_hash'])); $this->assertNotEquals(-1, $this->module->executeCommand('TTL', ['tfx_stringexp'])); $this->assertNotEquals(-1, $this->module->executeCommand('TTL', ['tfx_listexp'])); $fixter->deleteFixtures(); $this->assertEquals(0, $this->module->executeCommand('EXISTS', ['tfx_string'])); $this->assertEquals(0, $this->module->executeCommand('EXISTS', ['tfx_hash'])); $this->assertEquals(0, $this->module->executeCommand('EXISTS', ['tfx_list'])); $this->assertEquals(0, $this->module->executeCommand('EXISTS', ['tfx_set'])); $this->assertEquals(0, $this->module->executeCommand('EXISTS', ['tfx_zset'])); }
public function testCreate() { $model = new RedisItem(); $model->scenario = 'create'; $model->setAttributes(['key' => 'newstringkey', 'ttl' => 2000, 'formatvalue' => 'h ehfif ierireh ei', 'type' => 'string']); $this->assertTrue($model->validate()); $model->create(); $this->assertEquals(1, $this->module->executeCommand('EXISTS', ['newstringkey'])); $tmodel = RedisItem::find('newstringkey')->findValue(); $this->assertLessThanOrEqual(2000, $tmodel->ttl); $this->assertNotEquals(-1, $tmodel->ttl); }
public function deleteFixtures() { $this->module->executeCommand('FLUSHDB'); }