+ Add case of the getBugForExport method.

This commit is contained in:
tianshujie
2023-10-10 17:24:10 +08:00
parent 5e835492dd
commit c3bfa1ad91
2 changed files with 66 additions and 0 deletions
@@ -0,0 +1,30 @@
#!/usr/bin/env php
<?php
/**
title=测试 releaseModel->getBugForExport();
timeout=0
cid=1
*/
include dirname(__FILE__, 5) . '/test/lib/init.php';
include dirname(__FILE__, 2) . '/release.class.php';
zdTable('bug')->config('bug')->gen(10);
zdTable('user')->gen(5);
su('admin');
$conditions[0] = 'id in (1, 2, 3, 4, 5)';
$conditions[1] = 'product=1';
$conditions[2] = 'title like "%1%" and product=1';
$types = array('bug', 'leftBug');
$orderBy = 'id DESC';
$releaseTester = new releaseTest();
r($releaseTester->getBugForExportTest($types[0], $conditions[0], $orderBy)) && p('1:title') && e('Bug1'); // 根据条件获取Bug列表信息
r($releaseTester->getBugForExportTest($types[0], $conditions[1], $orderBy)) && p('1:title') && e('Bug1'); // 根据条件获取Bug列表信息
r($releaseTester->getBugForExportTest($types[0], $conditions[2], $orderBy)) && p('1:title') && e('Bug1'); // 根据条件获取Bug列表信息
r($releaseTester->getBugForExportTest($types[1], $conditions[0], $orderBy)) && p('1:title') && e('Bug1'); // 根据条件获取遗留的Bug列表信息
r($releaseTester->getBugForExportTest($types[1], $conditions[1], $orderBy)) && p('1:title') && e('Bug1'); // 根据条件获取遗留的Bug列表信息
r($releaseTester->getBugForExportTest($types[1], $conditions[2], $orderBy)) && p('1:title') && e('Bug1'); // 根据条件获取遗留的Bug列表信息
+36
View File
@@ -291,4 +291,40 @@ class releaseTest
$this->objectModel->delete(TABLE_RELEASE, $releaseID);
return $this->objectModel->getByID($releaseID);
}
/**
* 获取发布的导出需求数据。
* Get stories for export.
*
* @param string $condition
* @param string $orderBy
* @access public
* @return array
*/
public function getStoryForExportTest(string $condition, string $orderBy): array
{
$this->objectModel->session->storyQueryCondition = $condition;
$this->objectModel->session->storyOrderBy = $orderBy;
return $this->objectModel->getStoryForExport();
}
/**
* 获取发布的导出bug数据。
* Get bugs for export.
*
* @param string $type
* @param string $condition
* @param string $orderBy
* @access public
* @return array
*/
public function getBugForExportTest(string $type, string $condition, string $orderBy): array
{
$queryName = $type == 'bug' ? 'linkedBugQueryCondition' : 'leftBugsQueryCondition';
$this->objectModel->session->$queryName = $condition;
$this->objectModel->session->bugOrderBy = $orderBy;
return $this->objectModel->getBugForExport($type);
}
}