示例#1
0
 public function testStoreAndFetchCounter()
 {
     $store = StoreCounter::builder()->withLocation($this->location)->withReturnBody(true)->withPw(2)->withDw(2)->withW(3)->withDelta(10)->build();
     $fetch = FetchCounter::builder()->withLocation($this->location)->withNotFoundOk(true)->withPr(1)->withR(1)->build();
     $fetchResponse1 = $this->client->execute($fetch);
     $storeResponse = $this->client->execute($store);
     $fetchResponse2 = $this->client->execute($fetch);
     $this->assertInstanceOf('Riak\\Client\\Command\\DataType\\Response\\FetchCounterResponse', $fetchResponse1);
     $this->assertInstanceOf('Riak\\Client\\Command\\DataType\\Response\\StoreCounterResponse', $storeResponse);
     $this->assertInstanceOf('Riak\\Client\\Command\\DataType\\Response\\FetchCounterResponse', $fetchResponse2);
     $this->assertNull($fetchResponse1->getDatatype());
     $this->assertInstanceOf('Riak\\Client\\Core\\Query\\Crdt\\RiakCounter', $storeResponse->getDatatype());
     $this->assertInstanceOf('Riak\\Client\\Core\\Query\\Crdt\\RiakCounter', $fetchResponse2->getDatatype());
     $this->assertEquals($this->location, $fetchResponse2->getLocation());
     $this->assertEquals(10, $storeResponse->getDatatype()->getValue());
     $this->assertEquals(10, $fetchResponse2->getDatatype()->getValue());
 }
示例#2
0
 public function testBuildCommand()
 {
     $builder = StoreCounter::builder($this->location, [])->withLocation($this->location)->withContext('context-hash')->withReturnBody(true)->withDelta(1)->withDw(1)->withPw(2)->withW(3);
     $this->assertInstanceOf('Riak\\Client\\Command\\DataType\\StoreCounter', $builder->build());
 }