public function testGetPaymentUrlSuccessNew()
 {
     $orderId = 1;
     $url = 'http://start-new.url';
     $this->session->expects($this->once())->method('getLastOrderId')->willReturn($orderId);
     $this->paymentHelper->expects($this->once())->method('getRepeatPaymentUrl')->with($this->equalTo($orderId))->willReturn(false);
     $this->paymentHelper->expects($this->once())->method('getStartPaymentUrl')->with($this->equalTo($orderId))->willReturn($url);
     $this->assertEquals($url, $this->block->getPaymentUrl());
 }
Exemple #2
0
/**
 * Return an array of objects representing search results.
 *
 * See: http://www.bugzilla.org/docs/4.2/en/html/api/Bugzilla/WebService/Bug.html#search
 *
 * @param array $params search fields => values
 * @return array of stdClass bug objects for given search
 * @return boolean false if search failed altogether (I think)
 */
function search(array $params)
{
    $client = new jsonRPCClient("https://bugzilla.wikimedia.org/jsonrpc.cgi");
    try {
        $result = $client->call('Bug.search', array($params));
    } catch (\Exception $e) {
        Fail::log($e);
        return false;
    }
    $bugs = array();
    for ($i = 0, $c = count($result[1]['bugs']); $i < $c; ++$i) {
        $bugs[] = (object) $result[1]['bugs'][$i];
    }
    return $bugs;
}
function search_gerrit()
{
    $client = new jsonRPCClient("https://gerrit.wikimedia.org/r/gerrit/rpc/ChangeListService");
    try {
        $result = $client->call('allQueryNext', array());
    } catch (\Exception $e) {
        Fail::log($e);
        return false;
    }
    $bugs = array();
    for ($i = 0, $c = count($result[1]['bugs']); $i < $c; ++$i) {
        $bugs[] = (object) $result[1]['bugs'][$i];
    }
    return $bugs;
}