function test_buffer_is_called_by_storage()
 {
     $parser = new SimpleQueryParser();
     // This is the only mock test for the buffer, all other tests assume the default buffer is used
     $this->storage->buffer = new MockBuffer();
     $this->storage->buffer->expectAt(0, 'search', array('X', $this->config['test']['components']['X'], '*', 0, 100));
     $this->storage->buffer->expectAt(1, 'search', array('Y', $this->config['test']['components']['Y'], '*', 0, 100));
     $this->storage->buffer->expectCallCount('search', 2);
     $this->storage->buffer->expectOnce('get_results');
     $this->storage->buffer->setReturnValue('get_results', array());
     $this->storage->search($this->ds, '/test', $parser->parse('query'), 0, 100);
 }
 function test_search_with_adaptor()
 {
     // Does not use a mock query parser
     $config = $this->config;
     // the query {replace=this} will be changed to {title=single}
     $config['test']['adaptor'] = array('test' => array('index' => 'replace', 'value' => 'this', 'query_string' => '{title=single}'));
     $this->setup($config);
     $parser = new SimpleQueryParser();
     $expect_tree = $parser->parse('{title=single}');
     $this->storage->expectOnce('search', array('*', '/test', $expect_tree, 123, 456));
     $r = $this->ds->search('/test', '{replace=this}', 123, 456);
 }