$nodes = (new Node\Builder) ->atHost('localhost') ->onPort(8098) ->build() $riak = new Riak($nodes); $command = (new Command\Builder\FetchObject($riak)) ->buildLocation('username', 'users') ->build(); $response = $command->execute(); $user = $response->getObject();
 public function testApi()
 {
     $nodes = static::getCluster();
     $riak = new Riak($nodes, [], new Riak\Api\Pb());
     $api = $riak->getApi();
     $this->assertInstanceOf('Basho\\Riak\\Api\\Pb', $api);
 }
示例#2
0
 /**
  * Outputs the caller method name so that accidental connections can be noticed
  *
  * Using echo() is safe, since fixtures should be enabled on the command line while running PHPUnit only!
  *
  * @return BashoRiak\Node
  */
 public function getActiveNode()
 {
     if ($this->usesFixtures()) {
         echo ' [RIAK CONNECT BY "' . $this->getFixtureCaller(8) . '"] ';
     }
     return parent::getActiveNode();
 }
示例#3
0
 /**
  * Gets the request that was issued to the API by this Command.
  *
  * @return string
  */
 public function getRequest()
 {
     return $this->riak->getLastRequest();
 }
示例#4
0
 /**
  * @dataProvider getCluster
  * @param $nodes array
  */
 public function testApi($nodes)
 {
     $riak = new Riak($nodes);
     $this->assertInstanceOf('Basho\\Riak\\Api', $riak->getApi());
 }
示例#5
0
 public function testApi()
 {
     $nodes = static::getCluster();
     $riak = new Riak($nodes);
     $this->assertInstanceOf('Basho\\Riak\\Api', $riak->getApi());
 }