znt/module/compile/test/model/synccompile.php

38 lines
1.1 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
/**
title=测试 compileModel::syncCompile();
timeout=0
cid=15754
- 测试步骤1无参数调用 @1
- 测试步骤2仅指定repoID @1
- 测试步骤3仅指定jobID @1
- 测试步骤4同时指定两个参数 @1
- 测试步骤5不存在的jobID @1
*/
// 1. 导入依赖
include dirname(__FILE__, 5) . '/test/lib/init.php';
include dirname(__FILE__, 2) . '/lib/model.class.php';
// 2. 简化数据准备
zenData('job')->gen(5);
zenData('pipeline')->gen(3);
zenData('repo')->gen(3);
// 3. 用户登录
su('admin');
// 4. 创建测试实例
$compileTest = new compileModelTest();
// 5. 执行测试步骤至少5个
r($compileTest->syncCompileTest(0, 0)) && p() && e('1'); // 测试步骤1无参数调用
r($compileTest->syncCompileTest(1, 0)) && p() && e('1'); // 测试步骤2仅指定repoID
r($compileTest->syncCompileTest(0, 1)) && p() && e('1'); // 测试步骤3仅指定jobID
r($compileTest->syncCompileTest(1, 2)) && p() && e('1'); // 测试步骤4同时指定两个参数
r($compileTest->syncCompileTest(0, 999)) && p() && e('1'); // 测试步骤5不存在的jobID