public function testCreateFromResponse() { $mockResponse = $this->createMockResponse('MockChartResponse'); $chart = Chart::createFromResponse($mockResponse); $this->assertInstanceOf('BinaryThinking\\LastfmBundle\\Lastfm\\Model\\Chart', $chart, 'object created is not an instance of Chart'); $this->assertNotEmpty($chart->getFrom(), 'from is empty'); $this->assertNotEmpty($chart->getTo(), 'to is empty'); }
/** * Get a list of available charts for this tag, expressed as date ranges which can be sent to the chart services. * * @param string $tag the tag name */ public function getWeeklyChartList($tag) { $response = $this->call(array('method' => 'tag.getWeeklyChartList', 'tag' => $tag)); $charts = array(); if (!empty($response->weeklychartlist)) { foreach ($response->weeklychartlist->chart as $chart) { $charts[] = LastfmModel\Chart::createFromResponse($chart); } } return $charts; }