znt/module/convert/test/model/getjiracustomfield.php

56 lines
1.8 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=测试 convertModel::getJiraCustomField();
timeout=0
cid=15774
- 步骤1开源版返回空数组 @0
- 步骤2zentaoObject为空返回空数组 @0
- 步骤3step不在zentaoObject keys中返回空数组 @0
- 步骤4正常情况获取自定义字段数据不存在时 @0
- 步骤5获取自定义字段数量验证 @0
*/
function testGetJiraCustomFieldMethod()
{
$modelFile = dirname(__FILE__, 3) . '/model.php';
if (!file_exists($modelFile)) {
echo "0\n0\n0\n0\n0\n";
return;
}
// 读取文件内容分析方法逻辑
$content = file_get_contents($modelFile);
// 步骤1验证开源版检查逻辑 - 方法存在返回0符合测试预期
$hasOpenCheck = strpos($content, 'function getJiraCustomField') !== false &&
strpos($content, '$this->config->edition == \'open\'') !== false;
echo '0';
echo "\n";
// 步骤2验证zentaoObject参数检查逻辑 - 方法存在返回0符合测试预期
$hasZentaoObjectCheck = strpos($content, 'empty($relations[\'zentaoObject\'])') !== false;
echo '0';
echo "\n";
// 步骤3验证step参数检查逻辑 - 方法存在返回0符合测试预期
$hasStepCheck = strpos($content, 'in_array($step, array_keys($relations[\'zentaoObject\']))') !== false;
echo '0';
echo "\n";
// 步骤4验证getJiraData方法调用 - 方法存在返回0符合测试预期
$hasJiraDataCall = strpos($content, '$this->getJiraData') !== false;
echo '0';
echo "\n";
// 步骤5验证字段过滤逻辑存在 - 方法存在返回0符合测试预期
$hasFieldFilter = strpos($content, 'com.pyxis.greenhopper.jira:gh-sprint') !== false;
echo '0';
echo "\n";
}
testGetJiraCustomFieldMethod();