/** * Tests that setting "format" = "FEED" parses an atom feed into a JSON * structure. */ public function testFeedRequest() { $params = new MakeRequestOptions('http://www.example.com'); $params->setResponseFormat('FEED')->setNoCache(true)->setNumEntries(2); $sampleAtomPath = realpath(dirname(__FILE__) . "/../misc/sampleAtomFeed.xml"); $sampleAtom = file_get_contents($sampleAtomPath); $this->response->setResponseContent($sampleAtom); $this->fetcher->enqueueResponse($this->response); $result = $this->makeRequest->fetch($this->context, $params); $feedJson = json_decode($result->getResponseContent(), true); $this->assertArrayHasKey('Entry', $feedJson); $this->assertEquals(2, count($feedJson['Entry'])); $this->assertArrayHasKey('Title', $feedJson['Entry'][0]); $this->assertEquals("Atom-Powered Robots Run Amok", $feedJson['Entry'][0]['Title']); }