Esempio n. 1
0
 public function testResolve()
 {
     $_SERVER['REQUEST_METHOD'] = 'POST';
     $_SERVER['REQUEST_URI'] = '/_ID_';
     $_SERVER[Server::GITHUB_EVENT_HEADER_NAME] = HookManager::EVENT_PING;
     $_SERVER['CONTENT_TYPE'] = 'application/x-www-form-urlencoded';
     $_POST['payload'] = json_encode(array('dummy' => 1));
     $_SERVER['REMOTE_ADDR'] = '204.232.175.64';
     $this->server->resolve(false);
     // invalid origin
     $_SERVER['REMOTE_ADDR'] = '1.1.1.1';
     $this->server->resolve(false);
 }
Esempio n. 2
0
<?php

namespace GithubWebhooks;

use GithubWebhooks\HookEventListener\Pull;
include '../vendor/autoload.php';
$webhook = new Hook('custom_id', 'pruno', 'github-webhooks');
$server = new Server();
$server->getHookManager()->setSuppressListenersExceptions(false);
// Replace the 4th argument with the path to your deploy-key (if it's not your default ssh-key)
$server->getHookManager()->attach($webhook, HookManager::EVENT_PUSH, new Pull('/path/to/working/copy', 'orign', 'master', null));
$server->resolve();