Skip to content

Commit

Permalink
Merge pull request #97 from basho/develop
Browse files Browse the repository at this point in the history
Packagist updates, Assertion for tombstones, and docblock descriptions
  • Loading branch information
christophermancini committed May 27, 2015
2 parents 093ae6f + dca55fd commit 18e4ec2
Show file tree
Hide file tree
Showing 7 changed files with 34 additions and 15 deletions.
16 changes: 14 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"name": "basho/riak",
"description": "Official Riak client for PHP",
"type": "library",
"keywords": [
"basho",
"riak",
Expand All @@ -17,8 +18,16 @@
"license": "Apache-2.0",
"authors": [
{
"name": "Riak Team & Contributors",
"homepage": "https://github.com/basho/riak-php-client/contributors"
"name": "Christopher Mancini",
"email": "[email protected]",
"homepage": "https://github.com/christophermancini",
"role": "Lead Developer"
},
{
"name": "Alex Moore",
"email": "[email protected]",
"homepage": "https://github.com/alexmoore",
"role": "Developer"
}
],
"autoload": {
Expand All @@ -27,6 +36,9 @@
"autoload-dev": {
"psr-4": {"Basho\\Tests\\": "tests/"}
},
"support": {
"issues": "https://github.com/sebastianbergmann/phpunit/issues"
},
"repositories": [
{
"type": "package",
Expand Down
2 changes: 1 addition & 1 deletion src/Riak/Command/Bucket/Delete.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
use Basho\Riak\CommandInterface;

/**
* Used to remove an object from Riak
* Used to remove a bucket property from a Riak bucket
*
* @author Christopher Mancini <cmancini at basho d0t com>
*/
Expand Down
2 changes: 1 addition & 1 deletion src/Riak/Command/Bucket/Store.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
use Basho\Riak\CommandInterface;

/**
* Riak key value object store
* Used to set a bucket property on a bucket
*
* @author Christopher Mancini <cmancini at basho d0t com>
*/
Expand Down
2 changes: 1 addition & 1 deletion src/Riak/Command/Builder/IndexTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ public function withMaxResults($maxResults)
*
* @return $this
*/
public function withReturnTerms($returnTerms)
public function withReturnTerms($returnTerms = true)
{
$this->returnTerms = $returnTerms;
return $this;
Expand Down
5 changes: 5 additions & 0 deletions src/Riak/Command/Builder/UpdateMap.php
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,11 @@ public function validate()
throw new Exception('At least one add, remove, or update operation needs to be defined.');
}

if ($count_remove) {
$this->required('Location');
$this->required('Context');
}

// if we are performing a remove on a nested set, Location and context are required
if ($count_sets) {
foreach ($this->sets as $set) {
Expand Down
14 changes: 9 additions & 5 deletions src/Riak/Object.php
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,11 @@ public function addValueToIndex($indexName, $value)

private function validateIndexNameAndValue($indexName, $value)
{
$type = gettype($value);
if (!is_scalar($value)) {
throw new \InvalidArgumentException("Invalid index type for '" . $indexName .
"'index. Expecting '*_int' for an integer index, or '*_bin' for a string index.");
}

$isIntIndex = SecondaryIndexHeaderTranslator::isIntIndex($indexName);
$isStringIndex = SecondaryIndexHeaderTranslator::isStringIndex($indexName);

Expand All @@ -108,14 +112,14 @@ private function validateIndexNameAndValue($indexName, $value)
"'index. Expecting '*_int' for an integer index, or '*_bin' for a string index.");
}

if ($isIntIndex && $type != 'integer') {
if ($isIntIndex && !is_int($value)) {
throw new \InvalidArgumentException("Invalid type for '" . $indexName .
"'index. Expecting 'integer', value was '" . $type . "''");
"'index. Expecting 'integer', value was '" . gettype($value) . "''");
}

if ($isStringIndex && $type != 'string') {
if ($isStringIndex && !is_string($value)) {
throw new \InvalidArgumentException("Invalid type for '" . $indexName .
"'index. Expecting 'string', value was '" . $type . "''");
"'index. Expecting 'string', value was '" . gettype($value) . "''");
}
}

Expand Down
8 changes: 3 additions & 5 deletions tests/functional/ObjectOperationsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,6 @@ class ObjectOperationsTest extends TestCase
*/
private static $object = NULL;

/**
* @var array|null
*/
private static $vclock = NULL;

public static function setUpBeforeClass()
{
// make completely random key based on time
Expand Down Expand Up @@ -180,6 +175,9 @@ public function testFetchDeleted($riak)
$response = $command->execute();

$this->assertEquals('404', $response->getStatusCode());

// deleted key's still leave behind a tombstone with their causal context, aka vclock
$this->assertNotEmpty($response->getVclock());
}

/**
Expand Down

0 comments on commit 18e4ec2

Please sign in to comment.