znt/module/gitlab/test/model/addpushwebhook.php

34 lines
1.2 KiB
PHP
Executable file
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/usr/bin/env php
<?php
include dirname(__FILE__, 5) . '/test/lib/init.php';
include dirname(__FILE__, 2) . '/lib/model.class.php';
su('admin');
/**
title=测试 gitlabModel::addPushWebhook();
timeout=0
cid=16572
- 使用repoID为1不存在的项目id推送webhook @0
- 使用repoID为1存在的项目id推送webhook @1
- 使用repoID为1异常的项目id推送webhook @1
- 使用repoID为2不存在的项目id推送webhook @0
- 使用repoID为2存在的项目id推送webhook @1
*/
zenData('pipeline')->gen(5);
zenData('repo')->gen(2);
$gitlab = new gitlabModelTest();
$token = '';
$_SERVER['REQUEST_URI'] = 'http://unittest/';
r($gitlab->addPushWebhookTest(1, $token)) && p() && e('0'); //使用repoID为1不存在的项目id推送webhook
r($gitlab->addPushWebhookTest(1, $token, 2)) && p() && e('1'); //使用repoID为1存在的项目id推送webhook
r($gitlab->addPushWebhookTest(1, $token, -1)) && p() && e('0'); //使用repoID为1异常的项目id推送webhook
r($gitlab->addPushWebhookTest(2, $token)) && p() && e('0'); //使用repoID为2不存在的项目id推送webhook
r($gitlab->addPushWebhookTest(2, $token, 2)) && p() && e('1'); //使用repoID为2存在的项目id推送webhook