* Revert productModel select method.
This commit is contained in:
@@ -80,7 +80,6 @@ class productModel extends model
|
||||
if($this->app->tab == 'execution') $extra = $this->session->execution;
|
||||
}
|
||||
|
||||
|
||||
/* 查询产品数据。*/
|
||||
$product = $this->getById($productID);
|
||||
$this->session->set('currentProductType', $product->type);
|
||||
@@ -90,32 +89,18 @@ class productModel extends model
|
||||
if($this->app->tab == 'feedback') $moduleName = 'feedback';
|
||||
$dropMenuLink = helper::createLink($moduleName, 'ajaxGetDropMenu', "objectID=$productID&module=$currentModule&method=$currentMethod&extra=$extra");
|
||||
|
||||
/* 根据是否显示分支,处理分支语言项,获取分支数据。 */
|
||||
$showBranch = ($product->type != 'normal' && $withBranch && $currentModule != 'programplan');
|
||||
if(!$showBranch) unset($this->lang->product->menu->settings['subMenu']->branch);
|
||||
if($showBranch)
|
||||
{
|
||||
/* 修正分支显示语言项。 */
|
||||
$this->lang->product->branch = sprintf($this->lang->product->branch, $this->lang->product->branchName[$product->type]);
|
||||
$this->lang->product->menu->settings['subMenu']->branch['link'] = str_replace('@branch@', $this->lang->product->branch, $this->lang->product->menu->settings['subMenu']->branch['link']);
|
||||
|
||||
$branches = $this->loadModel('branch')->getPairs($product->id, 'all');
|
||||
$branchName = zget($branches, $branch, reset($branches));
|
||||
}
|
||||
|
||||
/* 构建移动端产品1.5级导航代码。 */
|
||||
if($this->app->viewType == 'mhtml')
|
||||
{
|
||||
$output = "<a id='currentItem' href=\"javascript:showSearchMenu('product', '$productID', '$currentModule', '$currentMethod', '$extra')\"><span class='text'>{$product->name}</span> <span class='icon-caret-down'></span></a><div id='currentItemDropMenu' class='hidden affix enter-from-bottom layer'></div>";
|
||||
if($showBranch) $output .= "<a id='currentBranch' href=\"javascript:showSearchMenu('branch', '{$product->id}', '$currentModule', '$currentMethod', '$extra')\">{$branchName} <span class='icon-caret-down'></span></a><div id='currentBranchDropMenu' class='hidden affix enter-from-bottom layer'></div>";
|
||||
$output = "<a id='currentItem' href=\"javascript:showSearchMenu('product', '$productID', '$currentModule', '$currentMethod', '$extra')\"><span class='text'>{$product->name}</span> <span class='icon-caret-down'></span></a><div id='currentItemDropMenu' class='hidden affix enter-from-bottom layer'></div>";
|
||||
$output .= $this->productTao->getBranchDropMenu4Select($product, $branch, $currentModule, $currentMethod, $extra, $withBranch);
|
||||
return $output;
|
||||
}
|
||||
|
||||
/* 构建PC端产品1.5级导航代码。 */
|
||||
$output = "<div class='btn-group angle-btn'><div class='btn-group'><button data-toggle='dropdown' type='button' class='btn btn-limit' id='currentItem' title='{$product->name}' style='width: 90%'><span class='text'>{$product->name}</span> <span class='caret'></span></button><div id='dropMenu' class='dropdown-menu search-list' data-ride='searchList' data-url='$dropMenuLink'>";
|
||||
$output .= '<div class="input-control search-box has-icon-left has-icon-right search-example"><input type="search" class="form-control search-input" /><label class="input-control-icon-left search-icon"><i class="icon icon-search"></i></label><a class="input-control-icon-right search-clear-btn"><i class="icon icon-close icon-sm"></i></a></div>';
|
||||
$output .= "</div></div>";
|
||||
if($showBranch) $output .= "<a id='currentBranch' href=\"javascript:showSearchMenu('branch', '$productID', '$currentModule', '$currentMethod', '$extra')\">{$branchName} <span class='icon-caret-down'></span></a><div id='currentBranchDropMenu' class='hidden affix enter-from-bottom layer'></div>";
|
||||
$output .= '<div class="input-control search-box has-icon-left has-icon-right search-example"><input type="search" class="form-control search-input" /><label class="input-control-icon-left search-icon"><i class="icon icon-search"></i></label><a class="input-control-icon-right search-clear-btn"><i class="icon icon-close icon-sm"></i></a></div></div></div>';
|
||||
$output .= $this->productTao->getBranchDropMenu4Select($product, $branch, $currentModule, $currentMethod, $extra, $withBranch);
|
||||
$output .= '</div>';
|
||||
|
||||
return $output;
|
||||
@@ -513,7 +498,7 @@ class productModel extends model
|
||||
$output = "<div class='btn-group header-btn' id='swapper'><button data-toggle='dropdown' type='button' class='btn' id='currentItem' title='{$currentProductName}'><span class='text'>{$currentProductName}</span> <span class='caret' style='margin-bottom: -1px'></span></button><div id='dropMenu' class='dropdown-menu search-list' data-ride='searchList' data-url='$dropMenuLink'>";
|
||||
$output .= '<div class="input-control search-box has-icon-left has-icon-right search-example"><input type="search" class="form-control search-input" /><label class="input-control-icon-left search-icon"><i class="icon icon-search"></i></label><a class="input-control-icon-right search-clear-btn"><i class="icon icon-close icon-sm"></i></a></div>';
|
||||
$output .= "</div></div>";
|
||||
$output .= $this->productTao->getBranchSelect4PC($currentProduct, $branch, $locateModule, $locateMethod, $extra);
|
||||
$output .= $this->productTao->getBranchDropMenu4Switch($currentProduct, $branch, $locateModule, $locateMethod, $extra);
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
||||
+44
-5
@@ -474,18 +474,18 @@ class productTao extends productModel
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取PC端分支下拉的HTML
|
||||
* Get branch select for mobile
|
||||
* 获取getSwitch方法中的分支下拉的HTML。
|
||||
* Get branch drop menu for getSwitch method.
|
||||
*
|
||||
* @param object $product
|
||||
* @param string|int $branch
|
||||
* @param string $currentModule
|
||||
* @param string $currentMethod
|
||||
* @param string $extra
|
||||
* @access private
|
||||
* @access protected
|
||||
* @return string
|
||||
*/
|
||||
protected function getBranchSelect4PC(object $product, string|int $branch, string $currentModule, string $currentMethod, string $extra = ''): string
|
||||
protected function getBranchDropMenu4Switch(object $product, string|int $branch, string $currentModule, string $currentMethod, string $extra = ''): string
|
||||
{
|
||||
if(!isset($product->type) or $product->type == 'normal') return '';
|
||||
|
||||
@@ -507,12 +507,51 @@ class productTao extends productModel
|
||||
|
||||
/* 生成分支HTML代码。*/
|
||||
$this->lang->product->branch = sprintf($this->lang->product->branch, $this->lang->product->branchName[$product->type]);
|
||||
$output = "<div class='btn-group header-btn'><button id='currentBranch' data-toggle='dropdown' type='button' class='btn'><span class='text'>{$branchName}</span> <span class='caret' style='margin-bottom: -1px'></span></button><div id='dropMenu' class='dropdown-menu search-list' data-ride='searchList' data-url='$dropMenuLink'>";
|
||||
$output = "<div class='btn-group header-btn'><button id='currentBranch' data-toggle='dropdown' type='button' class='btn'><span class='text'>{$branchName}</span> <span class='caret' style='margin-bottom: -1px'></span></button><div id='dropMenu' class='dropdown-menu search-list' data-ride='searchList' data-url='$dropMenuLink'>";
|
||||
$output .= '<div class="input-control search-box has-icon-left has-icon-right search-example"><input type="search" class="form-control search-input" /><label class="input-control-icon-left search-icon"><i class="icon icon-search"></i></label><a class="input-control-icon-right search-clear-btn"><i class="icon icon-close icon-sm"></i></a></div>';
|
||||
$output .= "</div></div>";
|
||||
return $output;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取select方法中的分支下拉的HTML
|
||||
* Get branch drop menu for select method.
|
||||
*
|
||||
* @param object $product
|
||||
* @param string|int $branch
|
||||
* @param string $currentModule
|
||||
* @param string $currentMethod
|
||||
* @param string $extra
|
||||
* @param bool $withBranch
|
||||
* @access protected
|
||||
* @return string
|
||||
*/
|
||||
protected function getBranchDropMenu4Select(object $product, string|int $branch, string $currentModule, string $currentMethod, string $extra = '', bool $withBranch = true): string
|
||||
{
|
||||
$showBranch = (isset($product->type) and $product->type != 'normal' && $withBranch && $currentModule != 'programplan');
|
||||
if(!$showBranch)
|
||||
{
|
||||
unset($this->lang->product->menu->settings['subMenu']->branch);
|
||||
return '';
|
||||
}
|
||||
|
||||
/* 修正分支显示语言项。 */
|
||||
$this->lang->product->branch = sprintf($this->lang->product->branch, $this->lang->product->branchName[$product->type]);
|
||||
$this->lang->product->menu->settings['subMenu']->branch['link'] = str_replace('@branch@', $this->lang->product->branch, $this->lang->product->menu->settings['subMenu']->branch['link']);
|
||||
|
||||
$branches = $this->loadModel('branch')->getPairs($product->id, 'all');
|
||||
$branchName = zget($branches, $branch, reset($branches));
|
||||
|
||||
/* 获取移动端分支下拉HTML。*/
|
||||
if($this->app->viewType == 'mhtml') return "<a id='currentBranch' href=\"javascript:showSearchMenu('branch', '{$product->id}', '$currentModule', '$currentMethod', '$extra')\">{$branchName} <span class='icon-caret-down'></span></a><div id='currentBranchDropMenu' class='hidden affix enter-from-bottom layer'></div>";
|
||||
|
||||
/* 获取PC端分支下拉HTML。*/
|
||||
$dropMenuLink = helper::createLink('branch', 'ajaxGetDropMenu', "objectID={$product->id}&branch=$branch&module=$currentModule&method=$currentMethod&extra=$extra");
|
||||
$output = "<div class='btn-group'><button id='currentBranch' data-toggle='dropdown' type='button' class='btn btn-limit' title='{$branchName}' style='width: 90%'>{$branchName} <span class='caret'></span></button><div id='dropMenu' class='dropdown-menu search-list' data-ride='searchList' data-url='$dropMenuLink'>";
|
||||
$output .= '<div class="input-control search-box has-icon-left has-icon-right search-example"><input type="search" class="form-control search-input" /><label class="input-control-icon-left search-icon"><i class="icon icon-search"></i></label><a class="input-control-icon-right search-clear-btn"><i class="icon icon-close icon-sm"></i></a></div></div></div>';
|
||||
return $output;
|
||||
}
|
||||
|
||||
/**
|
||||
* 计算在点击1.5级导航下拉选项后,跳转的模块名和方法名。
|
||||
* Compute locate for drop menu in PC.
|
||||
|
||||
Executable
+62
@@ -0,0 +1,62 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
include dirname(__FILE__, 5) . "/test/lib/init.php";
|
||||
include dirname(__FILE__, 2) . '/product.class.php';
|
||||
|
||||
zdTable('product')->gen(50);
|
||||
$branch = zdTable('branch');
|
||||
$branch->product->range('41');
|
||||
$branch->gen(5);
|
||||
|
||||
/**
|
||||
|
||||
title=测试productModel->select();
|
||||
timeout=0
|
||||
cid=1
|
||||
|
||||
*/
|
||||
|
||||
$productTest = new productTest('admin');
|
||||
$productTest->objectModel->dao->update(TABLE_PRODUCT)->set('deleted')->eq(1)->where('id')->eq(49)->exec();
|
||||
$products = $productTest->objectModel->dao->select('*')->from(TABLE_PRODUCT)->where('deleted')->eq(0)->fetchPairs('id', 'name');
|
||||
|
||||
$moduleName = 'product';
|
||||
$methodName = 'browse';
|
||||
r($productTest->selectTest(array(), 0, $moduleName, $methodName)) && p('hasProduct,hasBranch') && e('0,0');
|
||||
r($productTest->selectTest($products, 0, $moduleName, $methodName)) && p('hasProduct,hasBranch') && e('1,0');
|
||||
r($productTest->selectTest($products, 1, $moduleName, $methodName)) && p('hasProduct,hasBranch') && e('1,0');
|
||||
r($productTest->selectTest($products, 49, $moduleName, $methodName)) && p('hasProduct,hasBranch') && e('1,0');
|
||||
r($productTest->selectTest($products, 41, $moduleName, $methodName)) && p('hasProduct,hasBranch') && e('1,1');
|
||||
r($productTest->selectTest($products, 41, $moduleName, $methodName, '', 1)) && p('hasProduct,hasBranch') && e('1,1');
|
||||
r($productTest->selectTest($products, 41, $moduleName, $methodName, '', '', false)) && p('hasProduct,hasBranch') && e('1,0');
|
||||
r($productTest->selectTest($products, 70, $moduleName, $methodName)) && p('hasProduct,hasBranch') && e('1,0');
|
||||
|
||||
$productTest->objectModel->app->tab = 'project';
|
||||
$moduleName = 'project';
|
||||
$methodName = 'testcase';
|
||||
r($productTest->selectTest($products, 41, $moduleName, $methodName)) && p('hasProduct,hasBranch') && e('1,1');
|
||||
$moduleName = 'testcase';
|
||||
$methodName = 'groupCase';
|
||||
r($productTest->selectTest($products, 41, $moduleName, $methodName)) && p('hasProduct,hasBranch') && e('1,1');
|
||||
|
||||
$productTest->objectModel->app->tab = 'execution';
|
||||
$moduleName = 'execution';
|
||||
$methodName = 'bug';
|
||||
r($productTest->selectTest($products, 41, $moduleName, $methodName)) && p('hasProduct,hasBranch') && e('1,1');
|
||||
$methodName = 'task';
|
||||
r($productTest->selectTest($products, 41, $moduleName, $methodName)) && p('hasProduct,hasBranch') && e('1,1');
|
||||
|
||||
$productTest->objectModel->app->tab = 'feedback';
|
||||
$moduleName = 'bug';
|
||||
$methodName = 'view';
|
||||
r($productTest->selectTest($products, 41, $moduleName, $methodName)) && p('hasProduct,hasBranch') && e('1,1');
|
||||
|
||||
$productTest->objectModel->app->viewType = 'mhtml';
|
||||
r($productTest->selectTest(array(), 0, $moduleName, $methodName)) && p('hasProduct,hasBranch') && e('0,0');
|
||||
r($productTest->selectTest($products, 0, $moduleName, $methodName)) && p('hasProduct,hasBranch') && e('1,0');
|
||||
r($productTest->selectTest($products, 1, $moduleName, $methodName)) && p('hasProduct,hasBranch') && e('1,0');
|
||||
r($productTest->selectTest($products, 49, $moduleName, $methodName)) && p('hasProduct,hasBranch') && e('1,0');
|
||||
r($productTest->selectTest($products, 41, $moduleName, $methodName)) && p('hasProduct,hasBranch') && e('1,1');
|
||||
r($productTest->selectTest($products, 41, $moduleName, $methodName, '', 1)) && p('hasProduct,hasBranch') && e('1,1');
|
||||
r($productTest->selectTest($products, 41, $moduleName, $methodName, '', '', false)) && p('hasProduct,hasBranch') && e('1,0');
|
||||
r($productTest->selectTest($products, 70, $moduleName, $methodName)) && p('hasProduct,hasBranch') && e('1,0');
|
||||
@@ -1141,8 +1141,8 @@ class productTest
|
||||
}
|
||||
|
||||
/**
|
||||
* 测试 buildSelect4Mobile 方法。
|
||||
* Test buildSelect4Mobile
|
||||
* 测试 select 方法。
|
||||
* Test select method.
|
||||
*
|
||||
* @param array $products
|
||||
* @param int $productID
|
||||
@@ -1154,11 +1154,11 @@ class productTest
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function buildSelect4MobileTest(array $products, int $productID, string $currentModule, string $currentMethod, string $extra = '', string|int $branch = '', bool $withBranch = true): array
|
||||
public function selectTest(array $products, int $productID, string $currentModule, string $currentMethod, string $extra = '', string|int $branch = '', bool $withBranch = true): array
|
||||
{
|
||||
$this->objectModel->lang->product->menu->settings['subMenu']->branch = array('link' => "@branch@|branch|manage|product=%s", 'subModule' => 'branch');
|
||||
|
||||
$select = $this->objectModel->buildSelect4Mobile($products, $productID, $currentModule, $currentMethod, $extra, $branch, $withBranch);
|
||||
$select = $this->objectModel->select($products, $productID, $currentModule, $currentMethod, $extra, $branch, $withBranch);
|
||||
|
||||
$productName = zget($products, $productID, reset($products));
|
||||
$branchName = '所有';
|
||||
|
||||
+41
@@ -0,0 +1,41 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
include dirname(__FILE__, 5) . "/test/lib/init.php";
|
||||
|
||||
zdTable('product')->gen(50);
|
||||
$branch = zdTable('branch');
|
||||
$branch->product->range('41');
|
||||
$branch->gen(5);
|
||||
|
||||
/**
|
||||
|
||||
title=测试productModel->getBranchDropMenu4Select();
|
||||
timeout=0
|
||||
cid=1
|
||||
|
||||
*/
|
||||
|
||||
global $tester;
|
||||
$productTest = $tester->loadModel('product');
|
||||
$product = $productTest->dao->select('*')->from(TABLE_PRODUCT)->where('id')->eq(1)->fetch();
|
||||
|
||||
$moduleName = 'product';
|
||||
$methodName = 'browse';
|
||||
r($productTest->getBranchDropMenu4Select(new stdclass(), '', $moduleName, $methodName)) && p() && e('0');
|
||||
r($productTest->getBranchDropMenu4Select($product, '', $moduleName, $methodName)) && p() && e('0');
|
||||
r($productTest->getBranchDropMenu4Select($product, '', $moduleName, $methodName, '', false)) && p() && e('0');
|
||||
|
||||
$productTest->lang->product->menu->settings['subMenu']->branch = array('link' => "@branch@|branch|manage|product=%s", 'subModule' => 'branch');
|
||||
$product = $productTest->dao->select('*')->from(TABLE_PRODUCT)->where('id')->eq(41)->fetch();
|
||||
$result = $productTest->getBranchDropMenu4Select($product, 'all', $moduleName, $methodName);
|
||||
r((strpos($result, 'currentBranch') !== false and strpos($result, '所有') !== false)) && p() && e('1');
|
||||
|
||||
$result = $productTest->getBranchDropMenu4Select($product, 1, $moduleName, $methodName);
|
||||
r((strpos($result, 'currentBranch') !== false and strpos($result, '分支1') !== false)) && p() && e('1');
|
||||
|
||||
$productTest->app->viewType = 'mhtml';
|
||||
$result = $productTest->getBranchDropMenu4Select($product, 'all', $moduleName, $methodName);
|
||||
r((strpos($result, 'currentBranch') !== false and strpos($result, '所有') !== false)) && p() && e('1');
|
||||
|
||||
$result = $productTest->getBranchDropMenu4Select($product, 1, $moduleName, $methodName);
|
||||
r((strpos($result, 'currentBranch') !== false and strpos($result, '分支1') !== false)) && p() && e('1');
|
||||
+44
@@ -0,0 +1,44 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
include dirname(__FILE__, 5) . "/test/lib/init.php";
|
||||
|
||||
zdTable('product')->gen(50);
|
||||
$branch = zdTable('branch');
|
||||
$branch->product->range('41');
|
||||
$branch->gen(5);
|
||||
|
||||
/**
|
||||
|
||||
title=测试productModel->getBranchDropMenu4Switch();
|
||||
timeout=0
|
||||
cid=1
|
||||
|
||||
*/
|
||||
|
||||
global $tester;
|
||||
$productTest = $tester->loadModel('product');
|
||||
$product = $productTest->dao->select('*')->from(TABLE_PRODUCT)->where('id')->eq(1)->fetch();
|
||||
|
||||
$moduleName = 'product';
|
||||
$methodName = 'browse';
|
||||
r($productTest->getBranchDropMenu4Switch(new stdclass(), '', $moduleName, $methodName)) && p() && e('0');
|
||||
r($productTest->getBranchDropMenu4Switch($product, '', $moduleName, $methodName)) && p() && e('0');
|
||||
|
||||
$product = $productTest->dao->select('*')->from(TABLE_PRODUCT)->where('id')->eq(41)->fetch();
|
||||
$result = $productTest->getBranchDropMenu4Switch($product, '', $moduleName, $methodName);
|
||||
r((strpos($result, 'currentBranch') !== false and strpos($result, '所有') !== false)) && p() && e('1');
|
||||
|
||||
$result = $productTest->getBranchDropMenu4Switch($product, 1, $moduleName, $methodName);
|
||||
r((strpos($result, 'currentBranch') !== false and strpos($result, '分支1') !== false)) && p() && e('1');
|
||||
|
||||
r((strpos($productTest->getBranchDropMenu4Switch($product, 1, 'testcase', 'showimport'), 'currentBranch') !== false)) && p() && e('0');
|
||||
r((strpos($productTest->getBranchDropMenu4Switch($product, 1, 'tree', 'browse'), 'currentBranch') !== false)) && p() && e('1');
|
||||
r((strpos($productTest->getBranchDropMenu4Switch($product, 1, 'product', 'view'), 'currentBranch') !== false)) && p() && e('0');
|
||||
r((strpos($productTest->getBranchDropMenu4Switch($product, 1, 'release', 'create'), 'currentBranch') !== false)) && p() && e('1');
|
||||
r((strpos($productTest->getBranchDropMenu4Switch($product, 1, 'release', 'view'), 'currentBranch') !== false)) && p() && e('0');
|
||||
|
||||
$productTest->app->tab = 'qa';
|
||||
r((strpos($productTest->getBranchDropMenu4Switch($product, 1, 'bug', 'view'), 'currentBranch') !== false)) && p() && e('1');
|
||||
r((strpos($productTest->getBranchDropMenu4Switch($product, 1, 'testcase', 'view'), 'currentBranch') !== false)) && p() && e('1');
|
||||
r((strpos($productTest->getBranchDropMenu4Switch($product, 1, 'testtask', 'view'), 'currentBranch') !== false)) && p() && e('1');
|
||||
r((strpos($productTest->getBranchDropMenu4Switch($product, 1, 'testtask', 'create'), 'currentBranch') !== false)) && p() && e('0');
|
||||
@@ -1,32 +0,0 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
include dirname(__FILE__, 5) . "/test/lib/init.php";
|
||||
|
||||
zdTable('product')->gen(50);
|
||||
$branch = zdTable('branch');
|
||||
$branch->product->range('41');
|
||||
$branch->gen(5);
|
||||
|
||||
/**
|
||||
|
||||
title=测试productModel->getBranchSelect4Mobile();
|
||||
timeout=0
|
||||
cid=1
|
||||
|
||||
*/
|
||||
|
||||
global $tester;
|
||||
$productTest = $tester->loadModel('product');
|
||||
$product = $productTest->dao->select('*')->from(TABLE_PRODUCT)->where('id')->eq(1)->fetch();
|
||||
|
||||
$moduleName = 'product';
|
||||
$methodName = 'browse';
|
||||
r($productTest->getBranchSelect4Mobile(new stdclass(), '', $moduleName, $methodName)) && p() && e('0');
|
||||
r($productTest->getBranchSelect4Mobile($product, '', $moduleName, $methodName)) && p() && e('0');
|
||||
|
||||
$product = $productTest->dao->select('*')->from(TABLE_PRODUCT)->where('id')->eq(41)->fetch();
|
||||
$result = $productTest->getBranchSelect4Mobile($product, 'all', $moduleName, $methodName);
|
||||
r((strpos($result, 'currentBranch') !== false and strpos($result, '所有') !== false)) && p() && e('1');
|
||||
|
||||
$result = $productTest->getBranchSelect4Mobile($product, 1, $moduleName, $methodName);
|
||||
r((strpos($result, 'currentBranch') !== false and strpos($result, '分支1') !== false)) && p() && e('1');
|
||||
@@ -1,44 +0,0 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
include dirname(__FILE__, 5) . "/test/lib/init.php";
|
||||
|
||||
zdTable('product')->gen(50);
|
||||
$branch = zdTable('branch');
|
||||
$branch->product->range('41');
|
||||
$branch->gen(5);
|
||||
|
||||
/**
|
||||
|
||||
title=测试productModel->getBranchSelect4PC();
|
||||
timeout=0
|
||||
cid=1
|
||||
|
||||
*/
|
||||
|
||||
global $tester;
|
||||
$productTest = $tester->loadModel('product');
|
||||
$product = $productTest->dao->select('*')->from(TABLE_PRODUCT)->where('id')->eq(1)->fetch();
|
||||
|
||||
$moduleName = 'product';
|
||||
$methodName = 'browse';
|
||||
r($productTest->getBranchSelect4PC(new stdclass(), '', $moduleName, $methodName)) && p() && e('0');
|
||||
r($productTest->getBranchSelect4PC($product, '', $moduleName, $methodName)) && p() && e('0');
|
||||
|
||||
$product = $productTest->dao->select('*')->from(TABLE_PRODUCT)->where('id')->eq(41)->fetch();
|
||||
$result = $productTest->getBranchSelect4PC($product, '', $moduleName, $methodName);
|
||||
r((strpos($result, 'currentBranch') !== false and strpos($result, '所有') !== false)) && p() && e('1');
|
||||
|
||||
$result = $productTest->getBranchSelect4PC($product, 1, $moduleName, $methodName);
|
||||
r((strpos($result, 'currentBranch') !== false and strpos($result, '分支1') !== false)) && p() && e('1');
|
||||
|
||||
r((strpos($productTest->getBranchSelect4PC($product, 1, 'testcase', 'showimport'), 'currentBranch') !== false)) && p() && e('0');
|
||||
r((strpos($productTest->getBranchSelect4PC($product, 1, 'tree', 'browse'), 'currentBranch') !== false)) && p() && e('1');
|
||||
r((strpos($productTest->getBranchSelect4PC($product, 1, 'product', 'view'), 'currentBranch') !== false)) && p() && e('0');
|
||||
r((strpos($productTest->getBranchSelect4PC($product, 1, 'release', 'create'), 'currentBranch') !== false)) && p() && e('1');
|
||||
r((strpos($productTest->getBranchSelect4PC($product, 1, 'release', 'view'), 'currentBranch') !== false)) && p() && e('0');
|
||||
|
||||
$productTest->app->tab = 'qa';
|
||||
r((strpos($productTest->getBranchSelect4PC($product, 1, 'bug', 'view'), 'currentBranch') !== false)) && p() && e('1');
|
||||
r((strpos($productTest->getBranchSelect4PC($product, 1, 'testcase', 'view'), 'currentBranch') !== false)) && p() && e('1');
|
||||
r((strpos($productTest->getBranchSelect4PC($product, 1, 'testtask', 'view'), 'currentBranch') !== false)) && p() && e('1');
|
||||
r((strpos($productTest->getBranchSelect4PC($product, 1, 'testtask', 'create'), 'currentBranch') !== false)) && p() && e('0');
|
||||
Reference in New Issue
Block a user