znt/module/instance/test/model/saveauthinfo.php

35 lines
1.7 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=测试 instanceModel::saveAuthInfo();
timeout=0
cid=16814
- 步骤1非devops应用 @notDevopsApp
- 步骤2已存在pipeline记录 @pipelineExists
- 步骤3gitlab应用 @noSettingsMapping
- 步骤4jenkins应用 @noSettingsMapping
- 步骤5sonarqube应用 @noSettingsMapping
*/
// 1. 导入依赖(路径固定,不可修改)
include dirname(__FILE__, 5) . '/test/lib/init.php';
include dirname(__FILE__, 2) . '/lib/model.class.php';
// 2. 不需要zendata数据准备使用纯逻辑测试
// 3. 用户登录(选择合适角色)
su('admin');
// 4. 创建测试实例(变量名与模块名一致)
$instanceTest = new instanceModelTest();
// 5. 强制要求必须包含至少5个测试步骤
r($instanceTest->saveAuthInfoTest((object)array('id' => 1, 'chart' => 'zentao'))) && p() && e('notDevopsApp'); // 步骤1非devops应用
r($instanceTest->saveAuthInfoTest((object)array('id' => 2, 'chart' => 'gitlab'))) && p() && e('pipelineExists'); // 步骤2已存在pipeline记录
r($instanceTest->saveAuthInfoTest((object)array('id' => 3, 'chart' => 'gitlab', 'name' => 'test-gitlab', 'domain' => 'test3.domain.com', 'appVersion' => '1.0'))) && p() && e('noSettingsMapping'); // 步骤3gitlab应用
r($instanceTest->saveAuthInfoTest((object)array('id' => 4, 'chart' => 'jenkins', 'name' => 'test-jenkins', 'domain' => 'test4.domain.com', 'appVersion' => '2.0'))) && p() && e('noSettingsMapping'); // 步骤4jenkins应用
r($instanceTest->saveAuthInfoTest((object)array('id' => 5, 'chart' => 'sonarqube', 'name' => 'test-sonar', 'domain' => 'test5.domain.com', 'appVersion' => '3.0'))) && p() && e('noSettingsMapping'); // 步骤5sonarqube应用