Ejemplo n.º 1
0
 /**
  * @deprecated
  *
  * not worth functional testing
  * Riak will fail to fetch the index for a couple seconds after store
  */
 public function testStoreAndFetchIndex()
 {
     $indexName = 'schedule_' . uniqid();
     $index = new YokozunaIndex($indexName, '_yz_default');
     $index->setNVal(3);
     $store = StoreIndex::builder()->withIndex($index)->build();
     $fetch = FetchIndex::builder()->withIndexName($indexName)->build();
     $delete = DeleteIndex::builder()->withIndexName($indexName)->build();
     $storeResponse = $this->client->execute($store);
     $fetchResponse = $this->retryCommand($fetch, 10);
     $deleteResponse = $this->client->execute($delete);
     $this->assertInstanceOf('Riak\\Client\\Command\\Search\\Response\\StoreIndexResponse', $storeResponse);
     $this->assertInstanceOf('Riak\\Client\\Command\\Search\\Response\\FetchIndexResponse', $fetchResponse);
     $this->assertInstanceOf('Riak\\Client\\Command\\Search\\Response\\DeleteIndexResponse', $deleteResponse);
 }
Ejemplo n.º 2
0
 public function testExecuteCommand()
 {
     $response = new DeleteIndexResponse();
     $command = DeleteIndex::builder()->withIndexName('index-name')->build();
     $response->nVal = 10;
     $response->name = 'index-name';
     $response->schema = 'schema-name';
     $callback = function ($subject) {
         $this->assertInstanceOf('Riak\\Client\\Core\\Message\\Search\\DeleteIndexRequest', $subject);
         $this->assertEquals('index-name', $subject->name);
         return true;
     };
     $this->adapter->expects($this->once())->method('send')->with($this->callback($callback))->will($this->returnValue($response));
     $this->assertInstanceOf('Riak\\Client\\Command\\Search\\Response\\DeleteIndexResponse', $this->client->execute($command));
 }