Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fix import-related test failures

  • Loading branch information...
commit 557e546edfdf7c1c327a02103a107b5b4f3119d8 1 parent 0f5520b
@thobbs authored
View
4 lib/autoload.php
@@ -1,7 +1,9 @@
<?php
$GLOBALS['THRIFT_ROOT'] = __DIR__.'/thrift';
-$GLOBALS['THRIFT_AUTOLOAD'] = array();
+if (! isset($GLOBALS['THRIFT_AUTOLOAD'])) {
+ $GLOBALS['THRIFT_AUTOLOAD'] = array();
+}
spl_autoload_register(function($className){
if (strpos($className, 'phpcassa') === 0) {
View
11 lib/phpcassa/Schema/IndexType.php
@@ -1,11 +0,0 @@
-<?php
-namespace phpcassa\Schema;
-
-/**
- * @package phpcassa\Schema
- */
-class IndexType {
- const KEYS = \cassandra_IndexType::KEYS;
- const CUSTOM = \cassandra_IndexType::CUSTOM;
-}
-
View
2  lib/phpcassa/SystemManager.php
@@ -1,12 +1,12 @@
<?php
namespace phpcassa;
-use phpcassa\Schema\IndexType;
use phpcassa\Connection\ConnectionWrapper;
use cassandra\KsDef;
use cassandra\CfDef;
use cassandra\ColumnDef;
+use cassandra\IndexType;
/**
* Helps with getting information about the schema, making
View
2  phpunit.xml
@@ -2,7 +2,7 @@
<!-- http://www.phpunit.de/manual/current/en/appendixes.configuration.html -->
<phpunit
- backupGlobals="true"
+ backupGlobals="false"
backupStaticAttributes="false"
bootstrap="./lib/autoload.php"
cacheTokens="true"
View
4 test/Autopacking/AutopackKeysTest.php
@@ -42,13 +42,11 @@ public function test_multiget() {
$res);
}
- /**
- * @expectedException cassandra_NotFoundException
- */
public function test_remove() {
$this->cf->insert(123, array("foo" => "bar"));
$this->assertEquals(array("foo" => "bar"), $this->cf->get(123));
$this->cf->remove(123);
+ $this->setExpectedException('\cassandra\NotFoundException');
$this->cf->get(123);
}
View
8 test/BatchTest.php
@@ -95,7 +95,7 @@ public function test_cf_mutator() {
$batch->remove("key2");
$batch->send();
- $this->setExpectedException('\cassandra_NotFoundException');
+ $this->setExpectedException('\cassandra\NotFoundException');
$this->cf->get("key1");
}
@@ -127,7 +127,7 @@ public function test_super_cf_mutator() {
$batch->remove("key2");
$batch->send();
- $this->setExpectedException('\cassandra_NotFoundException');
+ $this->setExpectedException('\cassandra\NotFoundException');
$this->super_cf->get("key1");
}
@@ -157,7 +157,7 @@ public function test_counter_cf_mutator() {
$batch->remove("key2");
$batch->send();
- $this->setExpectedException('\cassandra_NotFoundException');
+ $this->setExpectedException('\cassandra\NotFoundException');
$this->counter_cf->get("key1");
}
@@ -190,7 +190,7 @@ public function test_counter_super_cf_mutator() {
$batch->remove("key2");
$batch->send();
- $this->setExpectedException('\cassandra_NotFoundException');
+ $this->setExpectedException('\cassandra\NotFoundException');
$this->counter_super_cf->get("key1");
}
View
8 test/ColumnFamily/ColumnFamilyTest.php
@@ -1,6 +1,5 @@
<?php
-use phpcassa\ConsistencyLevel;
use phpcassa\Connection\ConnectionPool;
use phpcassa\ColumnFamily;
use phpcassa\Schema\DataType;
@@ -9,6 +8,9 @@
use phpcassa\Index\IndexExpression;
use phpcassa\Index\IndexClause;
+use cassandra\ConsistencyLevel;
+use cassandra\NotFoundException;
+
class ColumnFamilyTest extends PHPUnit_Framework_TestCase {
private $pool;
@@ -68,7 +70,7 @@ public function test_empty() {
try {
$this->cf->get(self::$KEYS[0]);
$this->assertTrue(false);
- } catch (cassandra_NotFoundException $e) {
+ } catch (NotFoundException $e) {
}
}
@@ -559,7 +561,7 @@ public function test_remove() {
try {
$this->cf->get(self::$KEYS[0]);
$this->assertTrue(false);
- } catch (cassandra_NotFoundException $e) {
+ } catch (NotFoundException $e) {
}
}
}
View
4 test/ColumnFamily/CounterColumnFamilyTest.php
@@ -5,6 +5,8 @@
use phpcassa\ColumnFamily;
use phpcassa\Schema\DataType;
+use cassandra\NotFoundException;
+
class TestCounterColumnFamily extends PHPUnit_Framework_TestCase {
private $pool;
@@ -74,7 +76,7 @@ public function test_remove_counter() {
try {
$result = $this->cf->get($key, array("col"));
assert(false);
- } catch (cassandra_NotFoundException $e) { }
+ } catch (NotFoundException $e) { }
}
}
View
6 test/ColumnFamily/SuperColumnFamilyTest.php
@@ -5,6 +5,8 @@
use phpcassa\ColumnFamily;
use phpcassa\Schema\DataType;
+use cassandra\NotFoundException;
+
class TestSuperColumnFamily extends PHPUnit_Framework_TestCase {
private $pool;
@@ -54,7 +56,7 @@ public function test_super() {
try {
$this->cf->get(self::$KEYS[0]);
assert(false);
- } catch (cassandra_NotFoundException $e) {
+ } catch (NotFoundException $e) {
}
$this->cf->insert(self::$KEYS[0], $columns);
@@ -79,7 +81,7 @@ public function test_super_column_argument() {
try {
$this->cf->get($key, null, '', '', false, 100, $super_column='3');
assert(false);
- } catch (cassandra_NotFoundException $e) {
+ } catch (NotFoundException $e) {
}
$this->assertEquals($this->cf->multiget(array($key), null, '', '', false, 100, $super_column='1'),
View
4 test/ColumnFamily/SuperCounterColumnFamilyTest.php
@@ -5,6 +5,8 @@
use phpcassa\ColumnFamily;
use phpcassa\Schema\DataType;
+use cassandra\NotFoundException;
+
class TestSuperCounterColumnFamily extends PHPUnit_Framework_TestCase {
private $pool;
@@ -84,7 +86,7 @@ public function test_remove_counter() {
try {
$result = $this->cf->get($key, array("supercol"));
assert(false);
- } catch (cassandra_NotFoundException $e) { }
+ } catch (NotFoundException $e) { }
}
}
View
5 test/ConnectionPoolTest.php
@@ -6,6 +6,9 @@
use phpcassa\ColumnFamily;
use phpcassa\SystemManager;
+use cassandra\TimedOutException;
+use cassandra\CassandraClient;
+
class MockClient extends CassandraClient {
public function __construct($transport) {
@@ -13,7 +16,7 @@ public function __construct($transport) {
}
public function batch_mutate($mutation_map, $consistency_level) {
- throw new cassandra_TimedOutException();
+ throw new TimedOutException();
}
}
View
16 test/SystemManagerTest.php
@@ -3,7 +3,9 @@
use phpcassa\SystemManager;
use phpcassa\Schema\StrategyClass;
use phpcassa\Schema\DataType;
-use phpcassa\Schema\IndexType;
+
+use cassandra\InvalidRequestException;
+use cassandra\IndexType;
class SystemManagerTest extends PHPUnit_Framework_TestCase {
@@ -26,25 +28,24 @@ public function test_keyspace_manipulation() {
$ksname = "PhpcassaKeyspace";
try {
$this->sys->drop_keyspace($ksname);
- } catch (cassandra_InvalidRequestException $e) {
+ } catch (InvalidRequestException $e) {
// don't care
}
$attrs = array();
$attrs["strategy_class"] = StrategyClass::SIMPLE_STRATEGY;
- $attrs["strategy_options"] = NULL;
- $attrs["replication_factor"] = 1;
+ $attrs["strategy_options"] = array("replication_factor" => "1");
$this->sys->create_keyspace($ksname, $attrs);
$ksdef = $this->sys->describe_keyspace($ksname);
$this->assertEquals($ksdef->name, $ksname);
- $this->assertEquals($ksdef->replication_factor, 1);
+ $this->assertEquals($ksdef->strategy_options, array("replication_factor" => "1"));
$attrs["strategy_class"] = StrategyClass::OLD_NETWORK_TOPOLOGY_STRATEGY;
$this->sys->alter_keyspace($ksname, $attrs);
$ksdef = $this->sys->describe_keyspace($ksname);
$this->assertEquals($ksdef->name, $ksname);
- $this->assertEquals($ksdef->replication_factor, 1);
+ $this->assertEquals($ksdef->strategy_options, array("replication_factor" => "1"));
$this->sys->drop_keyspace($ksname);
}
@@ -63,8 +64,7 @@ public function test_cf_manipulation() {
$ksname = "PhpcassaKeyspace";
$attrs = array();
$attrs["strategy_class"] = StrategyClass::SIMPLE_STRATEGY;
- $attrs["strategy_options"] = NULL;
- $attrs["replication_factor"] = 1;
+ $attrs["strategy_options"] = array("replication_factor" => "1");
$this->sys->create_keyspace($ksname, $attrs);
$cfname = "CF";
Please sign in to comment.
Something went wrong with that request. Please try again.