+ Move unit test from test directory to each module.
This commit is contained in:
Executable
+24
@@ -0,0 +1,24 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
include dirname(__FILE__, 5) . "/test/lib/init.php";
|
||||
include dirname(__FILE__, 2) . '/tutorial.class.php';
|
||||
su('admin');
|
||||
|
||||
/**
|
||||
|
||||
title=测试 tutorialModel->checkNovice();
|
||||
cid=1
|
||||
pid=1
|
||||
|
||||
检查当account是admin的时候的返回值。 >> 0
|
||||
检查当->app->user->modifyPassword是不为空的时候的返回值。 >> 0
|
||||
检查当account是guest的时候的返回值。 >> 0
|
||||
|
||||
*/
|
||||
|
||||
$tutorial = new tutorialTest();
|
||||
|
||||
r($tutorial->checkNoviceTest()) && p() && e('0'); //检查当account是admin的时候的返回值。
|
||||
r($tutorial->checkNoviceTest()) && p() && e('0'); //检查当$this->app->user->modifyPassword是不为空的时候的返回值。
|
||||
su('guest');
|
||||
r($tutorial->checkNoviceTest()) && p() && e('0'); //检查当account是guest的时候的返回值。
|
||||
Executable
+23
@@ -0,0 +1,23 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
include dirname(__FILE__, 5) . "/test/lib/init.php";
|
||||
include dirname(__FILE__, 2) . '/tutorial.class.php';
|
||||
su('admin');
|
||||
|
||||
/**
|
||||
|
||||
title=测试 tutorialModel->getExecution();
|
||||
cid=1
|
||||
pid=1
|
||||
|
||||
检查获取数据的id >> 3
|
||||
检查获取数据的PM >> admin
|
||||
检查获取数据的burns >> 35
|
||||
|
||||
*/
|
||||
|
||||
$tutorial = new tutorialTest();
|
||||
|
||||
r($tutorial->getExecutionTest()) && p('id') && e('3'); //检查获取数据的id
|
||||
r($tutorial->getExecutionTest()) && p('PM') && e('admin'); //检查获取数据的PM
|
||||
r($tutorial->getExecutionTest()) && p('burns:0') && e('35'); //检查获取数据的burns
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
include dirname(__FILE__, 5) . "/test/lib/init.php";
|
||||
include dirname(__FILE__, 2) . '/tutorial.class.php';
|
||||
su('admin');
|
||||
|
||||
/**
|
||||
|
||||
title=测试 tutorialModel->getExecutionPairs();
|
||||
cid=1
|
||||
pid=1
|
||||
|
||||
检查获取的数据信息 >> Test execution
|
||||
|
||||
*/
|
||||
|
||||
$tutorial = new tutorialTest();
|
||||
|
||||
r($tutorial->getExecutionPairsTest()) && p('3') && e('Test execution'); //检查获取的数据信息
|
||||
+23
@@ -0,0 +1,23 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
include dirname(__FILE__, 5) . "/test/lib/init.php";
|
||||
include dirname(__FILE__, 2) . '/tutorial.class.php';
|
||||
su('admin');
|
||||
|
||||
/**
|
||||
|
||||
title=测试 tutorialModel->getExecutionProducts();
|
||||
cid=1
|
||||
pid=1
|
||||
|
||||
测试拿到的数据是否正确 >> normal
|
||||
测试拿到的数据是否正确 >> Test branch
|
||||
测试拿到的数据是否正确 >> Test plan
|
||||
|
||||
*/
|
||||
|
||||
$tutorial = new tutorialTest();
|
||||
|
||||
r($tutorial->getExecutionProductsTest()) && p('1:type') && e('normal'); //测试拿到的数据是否正确
|
||||
r($tutorial->getExecutionProductsTest()) && p('1[branches]:1') && e('Test branch'); //测试拿到的数据是否正确
|
||||
r($tutorial->getExecutionProductsTest()) && p('1[plans]:1') && e('Test plan'); //测试拿到的数据是否正确
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
include dirname(__FILE__, 5) . "/test/lib/init.php";
|
||||
include dirname(__FILE__, 2) . '/tutorial.class.php';
|
||||
su('admin');
|
||||
|
||||
/**
|
||||
|
||||
title=测试 tutorialModel->getExecutionStories();
|
||||
cid=1
|
||||
pid=1
|
||||
|
||||
检查是否获取到数据 >> wait
|
||||
|
||||
*/
|
||||
|
||||
$tutorial = new tutorialTest();
|
||||
|
||||
r($tutorial->getExecutionStoriesTest()) && p('1:stage') && e('wait'); //检查是否获取到数据
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
include dirname(__FILE__, 5) . "/test/lib/init.php";
|
||||
include dirname(__FILE__, 2) . '/tutorial.class.php';
|
||||
su('admin');
|
||||
|
||||
/**
|
||||
|
||||
title=测试 tutorialModel->getExecutionStoryPairs();
|
||||
cid=1
|
||||
pid=1
|
||||
|
||||
测试是否能拿到数据 >> Test story
|
||||
|
||||
*/
|
||||
|
||||
$tutorial = new tutorialTest();
|
||||
|
||||
r($tutorial->getExecutionStoryPairsTest()) && p('1') && e('Test story'); //测试是否能拿到数据
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
include dirname(__FILE__, 5) . "/test/lib/init.php";
|
||||
include dirname(__FILE__, 2) . '/tutorial.class.php';
|
||||
su('admin');
|
||||
|
||||
/**
|
||||
|
||||
title=测试 tutorialModel->getModulePairs();
|
||||
cid=1
|
||||
pid=1
|
||||
|
||||
测试是否能拿到数据 >> Test module
|
||||
|
||||
*/
|
||||
|
||||
$tutorial = new tutorialTest();
|
||||
|
||||
r($tutorial->getModulePairsTest()) && p('1') && e('Test module'); //测试是否能拿到数据
|
||||
Executable
+21
@@ -0,0 +1,21 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
include dirname(__FILE__, 5) . "/test/lib/init.php";
|
||||
include dirname(__FILE__, 2) . '/tutorial.class.php';
|
||||
su('admin');
|
||||
|
||||
/**
|
||||
|
||||
title=测试 tutorialModel->getProduct();
|
||||
cid=1
|
||||
pid=1
|
||||
|
||||
测试是否能拿到数据 >> 1
|
||||
测试是否能拿到数据 >> Test branch
|
||||
|
||||
*/
|
||||
|
||||
$tutorial = new tutorialTest();
|
||||
|
||||
r($tutorial->getProductTest()) && p('id') && e('1'); //测试是否能拿到数据
|
||||
r($tutorial->getProductTest()) && p('branches:1') && e('Test branch'); //测试是否能拿到数据
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
include dirname(__FILE__, 5) . "/test/lib/init.php";
|
||||
include dirname(__FILE__, 2) . '/tutorial.class.php';
|
||||
su('admin');
|
||||
|
||||
/**
|
||||
|
||||
title=测试 tutorialModel->getProductPairs();
|
||||
cid=1
|
||||
pid=1
|
||||
|
||||
测试是否能拿到数据 >> Test product
|
||||
|
||||
*/
|
||||
|
||||
$tutorial = new tutorialTest();
|
||||
|
||||
r($tutorial->getProductPairsTest()) && p('1') && e('Test product'); //测试是否能拿到数据
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
include dirname(__FILE__, 5) . "/test/lib/init.php";
|
||||
include dirname(__FILE__, 2) . '/tutorial.class.php';
|
||||
su('admin');
|
||||
|
||||
/**
|
||||
|
||||
title=测试 tutorialModel->getProductStats();
|
||||
cid=1
|
||||
pid=1
|
||||
|
||||
测试是否能拿到数据 >> test
|
||||
测试是否能拿到数据 >> Test branch
|
||||
|
||||
*/
|
||||
|
||||
$tutorial = new tutorialTest();
|
||||
|
||||
r($tutorial->getProductStatsTest()) && p('1:code') && e('test'); //测试是否能拿到数据
|
||||
r($tutorial->getProductStatsTest()) && p('1[branches]:1') && e('Test branch'); //测试是否能拿到数据
|
||||
Executable
+19
@@ -0,0 +1,19 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
include dirname(__FILE__, 5) . "/test/lib/init.php";
|
||||
include dirname(__FILE__, 2) . '/tutorial.class.php';
|
||||
su('admin');
|
||||
|
||||
/**
|
||||
|
||||
title=测试 tutorialModel->getProject();
|
||||
cid=1
|
||||
pid=1
|
||||
|
||||
测试是否能拿到数据 >> project
|
||||
|
||||
*/
|
||||
|
||||
$tutorial = new tutorialTest();
|
||||
|
||||
r($tutorial->getProjectTest()) && p('type') && e('project'); //测试是否能拿到数据
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
include dirname(__FILE__, 5) . "/test/lib/init.php";
|
||||
include dirname(__FILE__, 2) . '/tutorial.class.php';
|
||||
su('admin');
|
||||
|
||||
/**
|
||||
|
||||
title=测试 tutorialModel->getProjectPairs();
|
||||
cid=1
|
||||
pid=1
|
||||
|
||||
测试是否能拿到数据 >> Test Project
|
||||
|
||||
*/
|
||||
|
||||
$tutorial = new tutorialTest();
|
||||
|
||||
r($tutorial->getProjectPairsTest()) && p('2') && e('Test Project'); //测试是否能拿到数据
|
||||
+23
@@ -0,0 +1,23 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
include dirname(__FILE__, 5) . "/test/lib/init.php";
|
||||
include dirname(__FILE__, 2) . '/tutorial.class.php';
|
||||
su('admin');
|
||||
|
||||
/**
|
||||
|
||||
title=测试 tutorialModel->getProjectStats();
|
||||
cid=1
|
||||
pid=1
|
||||
|
||||
测试是否能拿到数据 >> scrum
|
||||
测试是否能拿到数据 >> 0
|
||||
测试是否能拿到数据 >> admin
|
||||
|
||||
*/
|
||||
|
||||
$tutorial = new tutorialTest();
|
||||
|
||||
r($tutorial->getProjectStatsTest()) && p('2:model') && e('scrum'); //测试是否能拿到数据
|
||||
r($tutorial->getProjectStatsTest()) && p('2[hours]:totalLeft') && e('0'); //测试是否能拿到数据
|
||||
r($tutorial->getProjectStatsTest()) && p('2[teamMembers]:0') && e('admin'); //测试是否能拿到数据
|
||||
Executable
+21
@@ -0,0 +1,21 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
include dirname(__FILE__, 5) . "/test/lib/init.php";
|
||||
include dirname(__FILE__, 2) . '/tutorial.class.php';
|
||||
su('admin');
|
||||
|
||||
/**
|
||||
|
||||
title=测试 tutorialModel->getStories();
|
||||
cid=1
|
||||
pid=1
|
||||
|
||||
测试是否能拿到数据 >> 1
|
||||
测试是否能拿到数据 >> 3
|
||||
|
||||
*/
|
||||
|
||||
$tutorial = new tutorialTest();
|
||||
|
||||
r($tutorial->getStoriesTest()) && p('0:module') && e('1'); //测试是否能拿到数据
|
||||
r($tutorial->getStoriesTest()) && p('1:pri') && e('3'); //测试是否能拿到数据
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
include dirname(__FILE__, 5) . "/test/lib/init.php";
|
||||
include dirname(__FILE__, 2) . '/tutorial.class.php';
|
||||
su('admin');
|
||||
|
||||
/**
|
||||
|
||||
title=测试 tutorialModel->getTeamMembers();
|
||||
cid=1
|
||||
pid=1
|
||||
|
||||
测试是否能拿到数据 >> 10
|
||||
|
||||
*/
|
||||
|
||||
$tutorial = new tutorialTest();
|
||||
|
||||
r($tutorial->getTeamMembersTest()) && p('admin:days') && e('10'); //测试是否能拿到数据
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
include dirname(__FILE__, 5) . "/test/lib/init.php";
|
||||
include dirname(__FILE__, 2) . '/tutorial.class.php';
|
||||
su('admin');
|
||||
|
||||
/**
|
||||
|
||||
title=测试 tutorialModel->getTeamMembersPairs();
|
||||
cid=1
|
||||
pid=1
|
||||
|
||||
测试是否能拿到数据 >> admin
|
||||
|
||||
*/
|
||||
|
||||
$tutorial = new tutorialTest();
|
||||
|
||||
r($tutorial->getTeamMembersPairsTest()) && p('admin') && e('admin'); //测试是否能拿到数据
|
||||
Executable
+19
@@ -0,0 +1,19 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
include dirname(__FILE__, 5) . "/test/lib/init.php";
|
||||
include dirname(__FILE__, 2) . '/tutorial.class.php';
|
||||
su('admin');
|
||||
|
||||
/**
|
||||
|
||||
title=测试 tutorialModel->getTutorialed();
|
||||
cid=1
|
||||
pid=1
|
||||
|
||||
测试是否能拿到数据 >> 0
|
||||
|
||||
*/
|
||||
|
||||
$tutorial = new tutorialTest();
|
||||
|
||||
r($tutorial->getTutorialedTest()) && p() && e('0'); //测试是否能拿到数据
|
||||
Executable
+19
@@ -0,0 +1,19 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
include dirname(__FILE__, 5) . "/test/lib/init.php";
|
||||
include dirname(__FILE__, 2) . '/tutorial.class.php';
|
||||
su('admin');
|
||||
|
||||
/**
|
||||
|
||||
title=测试 tutorialModel->getUserPairs();
|
||||
cid=1
|
||||
pid=1
|
||||
|
||||
测试是否能拿到数据 >> admin
|
||||
|
||||
*/
|
||||
|
||||
$tutorial = new tutorialTest();
|
||||
|
||||
r($tutorial->getUserPairsTest()) && p('admin') && e('admin'); //测试是否能拿到数据
|
||||
@@ -0,0 +1,281 @@
|
||||
<?php
|
||||
class tutorialTest
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
global $tester;
|
||||
$this->objectModel = $tester->loadModel('tutorial');
|
||||
}
|
||||
|
||||
/**
|
||||
* Check novice.
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function checkNoviceTest()
|
||||
{
|
||||
$this->app->user->modifyPassword = 1;
|
||||
$objects = $this->objectModel->checkNovice();
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get tutorial product pairs.
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function getProductPairsTest()
|
||||
{
|
||||
$objects = $this->objectModel->getProductPairs();
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get module pairs for tutorial.
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function getModulePairsTest()
|
||||
{
|
||||
$objects = $this->objectModel->getModulePairs();
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get tutorial product.
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function getProductTest()
|
||||
{
|
||||
$objects = $this->objectModel->getProduct();
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get product stats for tutorial.
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function getProductStatsTest()
|
||||
{
|
||||
$objects = $this->objectModel->getProductStats();
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects[0][0]['products'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get project for tutorial.
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function getProjectTest()
|
||||
{
|
||||
$objects = $this->objectModel->getProject();
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get tutorial project pairs.
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function getProjectPairsTest()
|
||||
{
|
||||
$objects = $this->objectModel->getProjectPairs();
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get project stats for tutorial.
|
||||
*
|
||||
* @param string $browseType
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function getProjectStatsTest($browseType = '')
|
||||
{
|
||||
$objects = $this->objectModel->getProjectStats($browseType = '');
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get tutorial stories.
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function getStoriesTest()
|
||||
{
|
||||
$objects = $this->objectModel->getStories();
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get tutorial Execution pairs.
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function getExecutionPairsTest()
|
||||
{
|
||||
$objects = $this->objectModel->getExecutionPairs();
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get tutorial execution.
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function getExecutionTest()
|
||||
{
|
||||
$objects = $this->objectModel->getExecution();
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get tutorial execution products.
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function getExecutionProductsTest()
|
||||
{
|
||||
$objects = $this->objectModel->getExecutionProducts();
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get tutorial execution stories.
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function getExecutionStoriesTest()
|
||||
{
|
||||
$objects = $this->objectModel->getExecutionStories();
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get tutorial execution story pairs.
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function getExecutionStoryPairsTest()
|
||||
{
|
||||
$objects = $this->objectModel->getExecutionStoryPairs();
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get tutorial team members.
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function getTeamMembersTest()
|
||||
{
|
||||
$objects = $this->objectModel->getTeamMembers();
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get team members pairs.
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function getTeamMembersPairsTest()
|
||||
{
|
||||
$objects = $this->objectModel->getTeamMembersPairs();
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get tutorial user pairs.
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function getUserPairsTest()
|
||||
{
|
||||
$objects = $this->objectModel->getUserPairs();
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get tutorialed.
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function getTutorialedTest()
|
||||
{
|
||||
$objects = $this->objectModel->getTutorialed();
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user