本文整理汇总了PHP中TestCase::retrieveRspecStructure方法的典型用法代码示例。如果您正苦于以下问题:PHP TestCase::retrieveRspecStructure方法的具体用法?PHP TestCase::retrieveRspecStructure怎么用?PHP TestCase::retrieveRspecStructure使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TestCase
的用法示例。
在下文中一共展示了TestCase::retrieveRspecStructure方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getTestsuiteRegression
/**
* Retrieve testsuite regression status
*
* @return Array
*/
function getTestsuiteRegression($testSuiteName)
{
//@todo Clean up debug stuff
$testSuiteManager = new TestSuiteManager();
$testSuite = $testSuiteManager->getTestSuite($testSuiteName);
$testCasesArray = $testSuite->getTestCases();
$testCaseManager = new TestCaseManager();
$regressionArray = array();
//PDO::setAttribute("PDO::MYSQL_ATTR_USE_BUFFERED_QUERY", true);
if (!empty($testCasesArray)) {
foreach ($testCasesArray as $key => $testCaseName) {
$regression = FALSE;
$testCase = new TestCase(substr($testCaseName, 0, -3));
$rspecStructure = $testCase->retrieveRspecStructure();
foreach ($rspecStructure as $rspeckey => $rspecLabel) {
if (!empty($rspecLabel)) {
try {
unset($result);
$sqlString = "SELECT testsuite_id as Testsuite, FROM_UNIXTIME(date) as Date, status as Status FROM testcase_result\n WHERE rspec_label = " . $this->dbHandler->quote($rspecLabel) . " ORDER BY date DESC";
$result = $this->dbHandler->query($sqlString);
$result->setFetchMode(PDO::FETCH_OBJ);
$rows = $result->fetchAll();
// echo "<br>".$rspecLabel." : <br> ----> " ;
//echo $rows[0]->testsuite; echo $rows[1]->Testsuite;
if ($rows[0]->Status == ResultManager::STATUS_FAILURE && $rows[1]->Status == ResultManager::STATUS_PASS) {
//echo $rows[0]->Date."-+-";
//echo $rows[0]->Status."<br>";
/*echo $rows[1]->Date."-+-<br>";
echo $rows[1]->Status."<br>";*/
$regression = TRUE;
$regressionArray[$testCaseName][$rspecLabel] = $regression;
}
//there would be a regression if execution at 'T-1' has Passed Status and execution at 'T' has Failure status
} catch (Exception $e) {
echo $e->getMessage();
}
}
}
}
}
/*if(!empty($testCasesArray)) {
foreach ($testCasesArray as $key => $testCaseName) {
$regression = FALSE;
$testCase = new TestCase(substr($testCaseName, 0, -3));
$rspecStructure = $testCase->retrieveRspecStructure();
foreach ($rspecStructure as $rspeckey => $rspecLabel) {
$lastExec = $testCase->getLastOldExecutionStatusByRspecLabel($rspecLabel);
echo $rspecLabel." -- ".$lastExec."<br>";
if(!$lastExec) {
$regression = TRUE;
$regressionArray[$testCaseName][$rspecLabel] = $regression;
}
}
} */
return $regressionArray;
}
示例2: storeTestCase
/**
* Store testCases into DB
*
* @param TestCase $testCase TestCase to store
* @param TestSuite $testSuite Target test suite to populate
*
* @return Void
*/
function storeTestCase($testCase, $testSuite)
{
$rspecStructure = $testCase->retrieveRspecStructure();
$this->dbHandler = DBHandler::getInstance();
foreach ($rspecStructure as $testString) {
try {
$sql = "INSERT INTO testcase (id, filename, rspec_label, testsuite_id) VALUES (" . $this->dbHandler->quote($testCase->id) . ", " . $this->dbHandler->quote($testCase->name) . ", " . $this->dbHandler->quote($testString) . ", " . $this->dbHandler->quote($testSuite->getTestSuiteName()) . ")";
$this->dbHandler->query($sql);
} catch (Exception $e) {
echo $e->getMessage();
}
}
}
示例3: rspecPrettyFormat
/**
* Display test case as HTML output
*
* @param String $name The test case name
*
* @return String
*/
function rspecPrettyFormat($testCaseName)
{
$testCaseObj = new TestCase($testCaseName);
$rspecStructure = $testCaseObj->retrieveRspecStructure();
$rspecOutput = '<br><pre>ClassName : ' . $testCaseObj->name . '.rb';
$rspecOutput .= '<br><br><b>' . count($rspecStructure) . ' Rspec examples:</b> <br><br>';
foreach ($rspecStructure as $testString) {
$rspecOutput .= '<span style="padding: 25px;">' . $testString . '</span><br>';
}
$rspecOutput .= '<br>';
$dependencies = $testCaseObj->getDependencies();
if (!empty($dependencies)) {
$rspecOutput .= '<b>' . count($dependencies) . ' test(s) in the dependency list</b>:<br><br>';
foreach ($dependencies as $deps) {
$rspecOutput .= '<span style="padding: 25px;">' . $deps . '</span><br>';
}
}
$rspecOutput .= '<br></pre>';
return $rspecOutput;
}