Example #1
0
 public function testStoreAndFetchSchema()
 {
     $content = $this->getSchemaContent('schedule.xml');
     $schema = new YokozunaSchema('schedule', $content);
     $store = StoreSchema::builder()->withSchema($schema)->build();
     $fetch = FetchSchema::builder()->withSchemaName('schedule')->build();
     $storeResponse = $this->client->execute($store);
     $fetchResponse = $this->client->execute($fetch);
     $this->assertInstanceOf('Riak\\Client\\Command\\Search\\Response\\StoreSchemaResponse', $storeResponse);
     $this->assertInstanceOf('Riak\\Client\\Command\\Search\\Response\\FetchSchemaResponse', $fetchResponse);
     $this->assertInstanceOf('Riak\\Client\\Core\\Query\\Search\\YokozunaSchema', $fetchResponse->getSchema());
     $this->assertXmlStringEqualsXmlString($content, $fetchResponse->getSchema()->getContent());
     $this->assertEquals('schedule', $fetchResponse->getSchema()->getName());
 }
Example #2
0
 public function testExecuteCommand()
 {
     $index = new YokozunaSchema('schema-name', 'schema-content');
     $response = new PutSchemaResponse();
     $command = StoreSchema::builder()->withSchema($index)->build();
     $callback = function ($subject) {
         $this->assertInstanceOf('Riak\\Client\\Core\\Message\\Search\\PutSchemaRequest', $subject);
         $this->assertEquals('schema-content', $subject->content);
         $this->assertEquals('schema-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\\StoreSchemaResponse', $this->client->execute($command));
 }