public function setup() { if (function_exists('apc_clear_cache')) { apc_clear_cache(); } $this->servers = array(array('host' => '127.0.0.1', 'port' => 9160)); $this->cassandra = Cassandra::createInstance($this->servers); $this->cassandra2 = Cassandra::createInstance($this->servers, 'Another'); if (!self::$setupComplete) { try { $this->cassandra->dropKeyspace('CassandraModelTest'); } catch (Exception $e) { } $this->cassandra->setMaxCallRetries(5); $this->cassandra->createKeyspace('CassandraModelTest'); $this->cassandra->useKeyspace('CassandraModelTest'); $this->cassandra->createStandardColumnFamily('CassandraModelTest', 'user', array(array('name' => 'email', 'type' => Cassandra::TYPE_UTF8), array('name' => 'name', 'type' => Cassandra::TYPE_UTF8, 'index-type' => Cassandra::INDEX_KEYS, 'index-name' => 'NameIdx'), array('name' => 'age', 'type' => Cassandra::TYPE_INTEGER, 'index-type' => Cassandra::INDEX_KEYS, 'index-name' => 'AgeIdx'))); /* $this->cassandra->createSuperColumnFamily( 'CassandraModelTest', 'cities', array( array( 'name' => 'population', 'type' => Cassandra::TYPE_INTEGER ), array( 'name' => 'comment', 'type' => Cassandra::TYPE_UTF8 ) ), Cassandra::TYPE_UTF8, Cassandra::TYPE_UTF8, Cassandra::TYPE_UTF8, 'Capitals supercolumn test', 1000, 1000, 0.5 ); */ self::$setupComplete = true; } else { $this->cassandra->useKeyspace('CassandraModelTest'); } $this->cassandra2->useKeyspace('CassandraModelTest'); }
public function testUseKeyspaceCanSkipAuthOnSecondCall() { $this->cassandra->useKeyspace('CassandraTest', 'admin', 'qwerty'); $this->cassandra->useKeyspace('CassandraTest'); }