Esempio n. 1
0
 public function testUserGetWeeklyChartList()
 {
     try {
         $testing_response = "HTTP/1.1 200 OK\r\nContent-type: text/xml\r\n\r\n" . '<?xml version="1.0" encoding="UTF-8"?>
                             <weeklychartlist user="******">
                                 <chart from="1108296002" to="1108900802"/>
                                 <chart from="1108900801" to="1109505601"/>
                                 <chart from="1109505601" to="1110110401"/>
                                 <chart from="1110715201" to="1111320001"/>
                                 <chart from="1111320001" to="1111924801"/>
                                 <chart from="1111924801" to="1112529601"/>
                                 <chart from="1112529601" to="1113134401"/>
                             </weeklychartlist>';
         $as = new Zend_Service_Audioscrobbler(true, $testing_response);
         $as->set('user', 'RJ');
         $response = $as->userGetWeeklyChartList();
         $chart = $response->chart[0];
         $this->assertEquals((string) $response['user'], 'RJ');
         $this->assertEquals(count($response->chart), 7);
         $this->assertEquals((string) $chart['from'], '1108296002');
         $this->assertEquals((string) $chart['to'], '1108900802');
     } catch (Exception $e) {
         $this->fail("Exception: [" . $e->getMessage() . "] thrown by test");
     }
 }
Esempio n. 2
0
 public function testUserGetWeeklyChartList()
 {
     try {
         $as = new Zend_Service_Audioscrobbler();
         $as->set('user', 'RJ');
         $response = $as->userGetWeeklyChartList();
         $this->assertEquals($response['user'], 'RJ');
         $this->assertNotNull($response->weeklychartlist);
         $this->assertNotNull($response->chart['from']);
         $this->assertNotNull($response->chart['to']);
     } catch (Exception $e) {
         $this->fail("Exception: [" . $e->getMessage() . "] thrown by test");
     }
 }