Пример #1
0
 public function generateUrlProvider()
 {
     $data = array();
     $service = new Robo47_Service_Bitly('login', 'apiKey');
     $defaultParams = array('login' => $service->getLogin(), 'apiKey' => $service->getApiKey(), 'version' => $service->getVersion(), 'format' => $service->getFormat(), 'version' => $service->getVersion());
     $data[] = array(clone $service, '/foo', array('foo' => 'baa', 'blub' => 'bla'));
     // tests#1 that callback is only attachted with json
     $s2 = clone $service;
     $s2->setCallback('baafoo');
     $s2->setFormat('json');
     $data[] = array($s2, '/foo', array('callback' => 'baafoo'));
     // tests#2 that callback is only attachted with json
     $s3 = clone $service;
     $s3->setCallback('baafoo');
     $s3->setFormat('xml');
     $data[] = array($s3, '/foo', array('format' => 'xml'));
     // test#3 testing params get encoded
     $data[] = array(clone $service, '/foo', array('foo' => 'http://www.example.com?asdf=bla', 'blub' => 'bla'));
     foreach ($data as $key => $value) {
         $params = array_merge($defaultParams, $data[$key][2]);
         $data[$key][3] = Robo47_Service_Bitly::API_URL . $data[$key][1];
         $data[$key][3] .= '?' . http_build_query($params, null, '&');
     }
     return $data;
 }