예제 #1
0
 public function testGuzzleServicesIssue70()
 {
     $client = GitlabGuzzleClient::factory(['base_url' => 'https://example.com/gitlab/api/v3', 'api_token' => 'QVy1PB7sTxfy4pqfZM1U']);
     $fixturePath = __DIR__ . '/fixtures/issues/list_issues.http';
     $mock = new Mock([$fixturePath]);
     $client->getHttpClient()->getEmitter()->attach($mock);
     $result = $client->listIssues([]);
     $this->assertNotEmpty($result);
 }
예제 #2
0
#!/bin/php
<?php 
/*
 * This file is part of fgrosse/gitlab-api.
 *
 * Copyright © Friedrich Große <*****@*****.**>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */
use Gitlab\Client\GitlabGuzzleClient;
use Gitlab\Client\HttpGitlabClient;
include __DIR__ . '/../vendor/autoload.php';
include __DIR__ . '/cli_helper.php';
$baseUrl = getParameter('base-url', $argv);
$token = getParameter('token', $argv);
$project = getParameter('project', $argv);
try {
    $guzzleClient = GitlabGuzzleClient::factory(['base_url' => $baseUrl, 'api_token' => $token]);
    $client = new HttpGitlabClient($guzzleClient);
    $mergeRequests = $client->listMergeRequests($project, $state = 'closed', $order = 'updated_at', $sort = 'asc', $page = 1, $perPage = 5);
    foreach ($mergeRequests as $mergeRequest) {
        echo $mergeRequest . PHP_EOL;
    }
} catch (Exception $exception) {
    printError('An Exception of type ' . get_class($exception) . ' occurred:');
    printError($exception->getMessage());
    exit(1);
}
예제 #3
0
 protected function setUp()
 {
     $this->client = GitlabGuzzleClient::factory(['base_url' => 'https://example.com/gitlab/api/v3', 'api_token' => 'QVy1PB7sTxfy4pqfZM1U']);
     $this->requestHistory = new History();
     $this->client->getHttpClient()->getEmitter()->attach($this->requestHistory);
 }