function search($query, $max = 10, $offset = 0, $sort = false) { if (empty($this->request_factory)) { $this->request_factory = new HttpRequestFactory(); } $responses = array(); foreach ($this->stores as $store_info) { $cb = new Contentbox($store_info['uri'] . '/items', $store_info['credentials']); $request = $this->request_factory->make('GET', $cb->make_search_uri($query, $max, $offset, $sort), $store_info['credentials']); $request->set_accept(MIME_RSS); $response[$store_info['uri']] = $request->execute(); } $g = new SimpleGraph(); $channel_uri = 'tag:moriarty.talis.com,2009:union'; foreach ($this->stores as $store_info) { } }
function test_search_to_resource_list_parses_items() { $fake_response = new HttpResponse(); $fake_response->status_code = 200; $fake_response->body = $this->_simple_rss_feed; $fake_request_factory = new FakeRequestFactory(); $fake_request = new FakeHttpRequest($fake_response); $fake_request_factory->register('GET', "http://example.org/store/items?query=scooby&max=10&offset=0", $fake_request); $cb = new Contentbox("http://example.org/store/items", new FakeCredentials()); $cb->request_factory = $fake_request_factory; $resources = $cb->search_to_resource_list('scooby', 10, 0); $this->assertEquals(2, count($resources->items)); $this->assertEquals("AppDomain, process and components...", $resources->items[0]['http://purl.org/dc/elements/1.1/title'][0]); $this->assertEquals("Export & Import Goodie from/to Photoshop", $resources->items[1]['http://purl.org/dc/elements/1.1/title'][0]); }