public function testConfigureCommitHooks() { $namespace = new RiakNamespace(null, 'bucket_hooks'); $store = StoreBucketProperties::builder($namespace)->withPostcommitHook(new NamedJsFunction('Riak.mapValuesJson'))->withPrecommitHook(new ErlangFunction('riak_kv_mapreduce', 'map_object_value'))->build(); $fetch = FetchBucketProperties::builder()->withNamespace($namespace)->build(); $storeResponse = $this->client->execute($store); $fetchResponse = $this->client->execute($fetch); $fetchProperties = $fetchResponse->getProperties(); $this->assertInstanceOf('Riak\\Client\\Core\\Query\\BucketProperties', $fetchProperties); $this->assertInstanceOf('Riak\\Client\\Command\\Bucket\\Response\\StoreBucketPropertiesResponse', $storeResponse); $this->assertInstanceOf('Riak\\Client\\Command\\Bucket\\Response\\FetchBucketPropertiesResponse', $fetchResponse); $postcommitHooks = $fetchProperties->getPostcommitHooks(); $precommitHooks = $fetchProperties->getPrecommitHooks(); $this->assertCount(1, $precommitHooks); $this->assertCount(1, $postcommitHooks); $this->assertInstanceOf('Riak\\Client\\Core\\Query\\Func\\NamedJsFunction', $precommitHooks[0]); $this->assertInstanceOf('Riak\\Client\\Core\\Query\\Func\\ErlangFunction', $postcommitHooks[0]); }
public function testBuildCommand() { $builder = FetchBucketProperties::builder()->withNamespace($this->namespace); $this->assertInstanceOf('Riak\\Client\\Command\\Bucket\\FetchBucketProperties', $builder->build()); }