public static function setUpBeforeClass() { require_once __DIR__ . '/User.php'; require_once __DIR__ . '/Person.php'; require_once __DIR__ . '/CounterTest.php'; require_once __DIR__ . '/KeyedUser.php'; require_once __DIR__ . '/StaticMapper.php'; require_once __DIR__ . '/IndexedMapper.php'; $cassDb = \Packaged\Mappers\ThriftConnection::newConnection(['hosts' => '127.0.0.1']); $cassDb->setConnectTimeout(1000); $stmt = $cassDb->prepare('SELECT * FROM system.schema_keyspaces where keyspace_name = \'test_cassandra_mapper\''); if (!$cassDb->execute($stmt)) { $stmt = $cassDb->prepare('CREATE KEYSPACE "test_cassandra_mapper" WITH replication = {\'class\':\'SimpleStrategy\', \'replication_factor\':1};'); $cassDb->execute($stmt); } $cassDb->setKeyspace('test_cassandra_mapper'); $resolver = new \Packaged\Mappers\ConnectionResolver(); $resolver->addConnection('cassdb', $cassDb); \Packaged\Mappers\BaseMapper::setConnectionResolver($resolver); CassUser::createTable(); CassPerson::createTable(); CounterTest::createTable(); }
public static function tearDownAfterClass() { $cassDb = \Packaged\Mappers\ThriftConnection::newConnection(['hosts' => '127.0.0.1']); $stmt = $cassDb->prepare('DROP KEYSPACE "test_cassandra_mapper"'); $stmt->execute(); }