当前位置: 首页>>代码示例>>PHP>>正文


PHP PHPUnit::run方法代码示例

本文整理汇总了PHP中PHPUnit::run方法的典型用法代码示例。如果您正苦于以下问题:PHP PHPUnit::run方法的具体用法?PHP PHPUnit::run怎么用?PHP PHPUnit::run使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PHPUnit的用法示例。


在下文中一共展示了PHPUnit::run方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: main

function main() {
	// include_once($_SERVER['DOCUMENT_ROOT'].'/ScarletFinal/classes/Template.php');
	
	// $template = new Template('main.tpl/');
	
	include('header.php');
	
	// $template->compile('main.tpl');
	require_once '../Sandbox.php';
	include '../PHPUnit.php';
		
		
	if(isset($_GET['path']) && is_dir($_GET['path'])) {
		$suite = (isset($_GET['test'])) ? $_GET['test'] : '';
		
		$phpunit = new PHPUnit($_GET['path'], $suite);
		
		chdir($_GET['path']);
	} else {
		throw new Exception("Could not find the specified tests directory: <strong>".$_GET['path'].'</strong>', 1);
	}
		
	$results = $phpunit->run();
	// print_r($results);
	echo $phpunit->toHTML($results);
	
	include('footer.php');
	
	
	// include('main.php');
}
开发者ID:redemption,项目名称:PHPUnit-Test-Report,代码行数:31,代码来源:index.php

示例2: runTest

 function runTest($name)
 {
     $test = strToLower($name);
     include_once "test_{$test}.php";
     echo "# Starting unit test for {$name}:\n";
     $tc =& new PhpUnit_TestSuite('File_Passwd' . ($name != 'File_Passwd' ? '_' . $name : '') . 'Test');
     $rs = PHPUnit::run($tc);
     echo $rs->toString() . "\n";
     flush();
 }
开发者ID:BackupTheBerlios,项目名称:lesen-svn,代码行数:10,代码来源:testsuite.php

示例3: show

 /**
  * this prints the HTML code straight out
  *
  */
 function show()
 {
     $request = $_REQUEST;
     $showPassed = FALSE;
     $submitted = @$request['submitted'];
     if ($submitted) {
         $showPassed = @$request['showOK'] ? TRUE : FALSE;
     }
     $suiteResults = array();
     foreach ($this->_suites as $aSuite) {
         $aSuiteResult = array();
         // remove the first directory's name from the test-suite name, since it
         // mostly is something like 'tests' or alike
         $removablePrefix = explode('_', $aSuite->getName());
         $aSuiteResult['name'] = str_replace($removablePrefix[0] . '_', '', $aSuite->getName());
         if ($submitted && isset($request[$aSuiteResult['name']])) {
             $result = PHPUnit::run($aSuite);
             $aSuiteResult['counts']['run'] = $result->runCount();
             $aSuiteResult['counts']['error'] = $result->errorCount();
             $aSuiteResult['counts']['failure'] = $result->failureCount();
             $aSuiteResult['results'] = $this->_prepareResult($result, $showPassed);
             $per = 100 / $result->runCount();
             $failed = $per * $result->errorCount() + $per * $result->failureCount();
             $aSuiteResult['percent'] = round(100 - $failed, 2);
         } else {
             $aSuiteResult['addInfo'] = 'NOT EXECUTED';
         }
         $suiteResults[] = $aSuiteResult;
     }
     $final['name'] = 'OVERALL RESULT';
     $final['counts'] = array();
     $final['percent'] = 0;
     $numExecutedTests = 0;
     foreach ($suiteResults as $aSuiteResult) {
         if (sizeof(@$aSuiteResult['counts'])) {
             foreach ($aSuiteResult['counts'] as $key => $aCount) {
                 if (!isset($final['counts'][$key])) {
                     $final['counts'][$key] = 0;
                 }
                 $final['counts'][$key] += $aCount;
             }
         }
     }
     if (isset($final['counts']['run'])) {
         $per = 100 / $final['counts']['run'];
         $failed = $per * $final['counts']['error'] + $per * $final['counts']['failure'];
         $final['percent'] = round(100 - $failed, 2);
     } else {
         $final['percent'] = 0;
     }
     array_unshift($suiteResults, $final);
     include 'PHPUnit/GUI/HTML.tpl';
 }
开发者ID:Zunair,项目名称:xataface,代码行数:57,代码来源:HTML.php

示例4: PHPUnit_TestSuite

    	$message2->delete();

    	$message->fetch();
    	$threadCount2 = $message->getNumMessagesInThread();

    	if ($threadCount != ($threadCount2 + 1)) {
    		$this->fail("Thread stats not updated correctly.");
    	}
    }
} // class PhorumMessage_test


class PhorumForum_test extends PHPUnit_TestCase
{

}

$suite  = new PHPUnit_TestSuite("PhorumUser_Test");
$suite->addTestSuite("PhorumMessage_Test");
$result = PHPUnit::run($suite);

echo $result->toHtml();

//$message = new Phorum_message(1);
//camp_dump($message);




?>
开发者ID:nistormihai,项目名称:Newscoop,代码行数:30,代码来源:tests.php

示例5: test_entryContributor

        $this->assertEquals($value, $this->entry->author);
    }
    function test_entryContributor()
    {
        $value = 'Sam Ruby';
        $this->assertEquals($value, $this->entry->contributor);
    }
    function test_entryContributorOffset()
    {
        $value = 'Joe Gregorio';
        $this->assertEquals($value, $this->entry->contributor(1));
    }
    # According to RFC4287 section 4.2.7.2:
    # [..]If the 'rel' attribute is not present, the link element MUST be
    # interpreted as if the link relation type is "alternate".
    function test_getsLinkWithoutRel()
    {
        $source = '<?xml version="1.0" ?>
        <entry xmlns="http://www.w3.org/2005/Atom">
        <link href="http://example.org/2005/04/02/atom" />
        </entry>
        ';
        $feed = new XML_Feed_Parser($source);
        $entry = $feed->getEntryByOffset(0);
        // Output
        $this->assertEquals("http://example.org/2005/04/02/atom", $entry->link(0, 'href', array('rel' => 'alternate')));
    }
}
$suite = new PHPUnit_TestSuite('XML_Feed_Parser_Atom_valueValidity_TestCase');
$result = PHPUnit::run($suite, '123');
echo $result->toString();
开发者ID:villos,项目名称:tree_admin,代码行数:31,代码来源:atomValues.php

示例6: testrelativePath

        if (OS_WINDOWS) {
            $this->assertTrue(File::isAbsolute('C:\\\\data'));
            $this->assertTrue(File::isAbsolute('d:/data'));
            $this->assertFalse(File::isAbsolute('\\'));
        } else {
            $this->assertTrue(File::isAbsolute('/'));
            $this->assertFalse(File::isAbsolute('\\'));
            $this->assertTrue(File::isAbsolute('~mike/bin'));
        }
    }
    function testrelativePath()
    {
        $this->assertEquals('tests/File', File::relativePath('/usr/share/pear/tests/File', '/usr/share/pear', '/'));
        $this->assertEquals('../etc', File::relativePath('/etc', '/usr', '/'));
        $this->assertEquals('D:\\Data', File::relativePath('D:\\Data', 'C:\\Data', '\\'));
        if (OS_WINDOWS) {
            $this->assertEquals('data\\dir', File::relativePath('/var/data/dir', '/var'));
        } else {
            $this->assertEquals('data/dir', File::relativePath('/var/data/dir', '/var'));
        }
        $this->assertEquals('../', File::relativePath('data', 'data/dir', '/'));
    }
    function testrealpath()
    {
        $drive = OS_WINDOWS ? substr(getcwd(), 0, 2) : '';
        $this->assertEquals($drive . '/a/weird/path/is', File::realpath('/a\\weird//path\\is/that/./../', '/'));
        $this->assertEquals($drive . '/a/weird/path/is/that', File::realpath('/a\\weird//path\\is/that/./../that/.', '/'));
    }
}
$result =& PHPUnit::run(new PHPUnit_TestSuite('FileTest'));
echo $result->toString();
开发者ID:GeekyNinja,项目名称:LifesavingCAD,代码行数:31,代码来源:FileTest.php

示例7: tearDown

    }
    function tearDown()
    {
    }
    /**
     * Try to work with this ill-formed feed. If the tidy extension is not installed,
     * it expects parsing to fail. If tidy is installed and parsing fails, the test
     * fails. If tidy is installed and it parses, then the test passes.
     */
    function test_Tidy()
    {
        $sample_dir = XML_Feed_Parser_TestCase::getSampleDir();
        $file = file_get_contents($sample_dir . DIRECTORY_SEPARATOR . "illformed_atom10.xml");
        try {
            $feed = new XML_Feed_Parser($file, false, true, true);
        } catch (XML_Feed_Parser_Exception $e) {
            if (extension_loaded('tidy')) {
                $this->assertTrue(false);
            } else {
                $this->assertTrue(true);
            }
            return;
        }
        $entry = $feed->getEntryByOffset(0);
        $this->assertEquals($entry->author, 'Example author');
    }
}
$suite = new PHPUnit_TestSuite();
$suite->addTestSuite("XML_Feed_Parser_Tidy_TestCase");
$result = PHPUnit::run($suite, "123");
echo $result->toString();
开发者ID:villos,项目名称:tree_admin,代码行数:31,代码来源:tidy.php

示例8: phpversion

} else {
    echo "{$title}\n\n";
}
if (isset($_SERVER['REQUEST_METHOD'])) {
    echo "<h3>Using lib version: {$xmlrpcVersion} on PHP version: " . phpversion() . "</h3>\n";
    echo '<h3>Running ' . $suite->testCount() . ' tests (some of which are multiple) against servers: http://' . htmlspecialchars($LOCALSERVER . $URI) . ' and https://' . htmlspecialchars($HTTPSSERVER . $HTTPSURI) . "\n ...</h3>\n";
    flush();
} else {
    echo "Using lib version: {$xmlrpcVersion} on PHP version: " . phpversion() . "\n";
    echo 'Running ' . $suite->testCount() . ' tests (some of which are multiple) against servers: http://' . $LOCALSERVER . $URI . ' and https://' . $HTTPSSERVER . $HTTPSURI . "\n\n";
}
// do some basic timing measurement
list($micro, $sec) = explode(' ', microtime());
$start_time = $sec + $micro;
$PHPUnit = new PHPUnit();
$result = $PHPUnit->run($suite);
list($micro, $sec) = explode(' ', microtime());
$end_time = $sec + $micro;
if (!isset($_SERVER['REQUEST_METHOD'])) {
    echo $result->toString() . "\n";
}
if (isset($_SERVER['REQUEST_METHOD'])) {
    echo '<h3>' . $result->failureCount() . " test failures</h3>\n";
    printf("Time spent: %.2f secs<br/>\n", $end_time - $start_time);
} else {
    echo $result->failureCount() . " test failures\n";
    printf("Time spent: %.2f secs\n", $end_time - $start_time);
}
if ($result->failureCount() && !$DEBUG) {
    $target = strpos($_SERVER['PHP_SELF'], '?') ? $_SERVER['PHP_SELF'] . '&amp;DEBUG=1' : $_SERVER['PHP_SELF'] . '?DEBUG=1';
    if (isset($_SERVER['REQUEST_METHOD'])) {
开发者ID:RiquelmyMelara,项目名称:Awakened-Millionaire,代码行数:31,代码来源:testsuite.php

示例9: testExtractBody

    function testExtractBody()
    {
        $testcases = array("before<body></body>after" => "", "<body>Simple</body>" => "Simple", "<Body>Ignore case</BODY>" => "Ignore case", "<body id=\"id123\">Attributes</body>" => "Attributes", "<body id=\"id123\">Html entities: &amp;&lt;&gt;</body >" => "Html entities: &<>", "<body><b class=\"bold\">Tags</b></body\n\n>" => " Tags ", "<body\n\n>\nNewlines\n</body\n\n>" => "\nNewlines\n");
        foreach ($testcases as $html => $body) {
            $this->assertEquals($body, $this->indexer->extract_body($html));
        }
    }
}
class IndexerFactoryTest extends PHPUnit_TestCase
{
    var $index;
    function setUp()
    {
        $this->index = new IndexStub();
    }
    function tearDown()
    {
        unset($this->index);
    }
    function testIndexer()
    {
        $testcases = array('abc.txt' => 'Fulltext_TextIndexer', 'abc.htm' => 'Fulltext_HtmlIndexer', 'abc.html' => 'Fulltext_HtmlIndexer');
        foreach ($testcases as $path => $class) {
            $this->assertTrue(is_a(Fulltext_indexer_factory($path, $this->index), $class), $class);
        }
    }
}
$testcases = array('HtmlIndexerTest', 'IndexerFactoryTest');
foreach ($testcases as $testcase) {
    echo PHPUnit::run(new PHPUnit_TestSuite($testcase))->toString();
}
开发者ID:BackupTheBerlios,项目名称:htmlhelp-svn,代码行数:31,代码来源:fulltext_indexer.php

示例10: QuickForm_table_test

class QuickForm_table_test extends PHPUnit_TestCase
{
    var $el;
    function QuickForm_table_test($name = 'QuickForm_table_test')
    {
        $this->PHPUnit_TestCase($name);
    }
    function setUp()
    {
        $this->el = new HTML_QuickForm_table('test_table', 'Testing');
        $this->el->addField(new HTML_QuickForm_text('fname', 'First Name'));
        $this->el->addField(new HTML_QuickForm_text('lname', 'Last Name'));
    }
    function tearDown()
    {
    }
    function test_Html()
    {
        $this->assertEquals($this->el->toHtml(), '');
    }
    function test_Html_with_values()
    {
        $el = unserialize(serialize($this->el));
        $el->setName('test_table_2');
        $el->setValue(array(array('fname' => 'John', 'lname' => 'Stamos'), array('fname' => 'Sally', 'lname' => 'Field'), array('fname' => 'Steve', 'lname' => 'Field')));
        $this->assertEquals($el->toHtml(), '');
    }
}
$test = new PHPUnit_TestSuite('QuickForm_table_test');
$result = PHPUnit::run($test);
print $result->toString();
开发者ID:promoso,项目名称:HVAC,代码行数:31,代码来源:QuickForm_table_tests.php

示例11: runTest

 /**
  * Run the test suite.
  *
  * This method runs the test suite and updates the messages
  * for the user. When finished it changes the status line
  * to 'Test Complete'
  *
  * @access public
  * @param  none
  * @return void
  */
 function runTest()
 {
     // Notify the user that the test is running.
     $this->_showStatus('Running Test...');
     // Run the test.
     $result = PHPUnit::run($this->suite);
     // Update the labels.
     $this->_setLabelValue($this->numberOfRuns, $result->runCount());
     $this->_setLabelValue($this->numberOfErrors, $result->errorCount());
     $this->_setLabelValue($this->numberOfFailures, $result->failureCount());
     // Update the progress bar.
     $this->_updateProgress($result->runCount(), $result->errorCount(), $result->failureCount());
     // Show the errors.
     $this->_showFailures($result->errors(), $this->dumpArea);
     // Show the messages from the tests.
     if ($this->showPassed->get_active()) {
         // Show failures and success.
         $this->_showAll($result, $this->reportArea);
     } else {
         // Show only failures.
         $this->_showFailures($result->failures(), $this->reportArea);
     }
     // Update the status message.
     $this->_showStatus('Test complete');
 }
开发者ID:codethics,项目名称:proteoerp,代码行数:36,代码来源:Gtk.php

示例12: phpversion

    echo "{$title}\n\n";
}
if (isset($_SERVER['REQUEST_METHOD'])) {
    echo "<h3>Using lib version: {$xmlrpcVersion} on PHP version: " . phpversion() . "</h3>\n";
    echo '<h3>Running ' . $suite->testCount() . ' tests (some of which are multiple) against servers: http://' . htmlspecialchars($LOCALSERVER . $URI) . ' and https://' . htmlspecialchars($HTTPSSERVER . $HTTPSURI) . "\n ...</h3>\n";
    flush();
    @ob_flush();
} else {
    echo "Using lib version: {$xmlrpcVersion} on PHP version: " . phpversion() . "\n";
    echo 'Running ' . $suite->testCount() . ' tests (some of which are multiple) against servers: http://' . $LOCALSERVER . $URI . ' and https://' . $HTTPSSERVER . $HTTPSURI . "\n\n";
}
// do some basic timing measurement
list($micro, $sec) = explode(' ', microtime());
$start_time = $sec + $micro;
$PHPUnit = new PHPUnit();
$result = $PHPUnit->run($suite, $DEBUG == 0 ? '.' : '<hr/>');
list($micro, $sec) = explode(' ', microtime());
$end_time = $sec + $micro;
if (!isset($_SERVER['REQUEST_METHOD'])) {
    echo $result->toString() . "\n";
}
if (isset($_SERVER['REQUEST_METHOD'])) {
    echo '<h3>' . $result->failureCount() . " test failures</h3>\n";
    printf("Time spent: %.2f secs<br/>\n", $end_time - $start_time);
} else {
    echo $result->failureCount() . " test failures\n";
    printf("Time spent: %.2f secs\n", $end_time - $start_time);
}
if ($result->failureCount() && !$DEBUG) {
    $target = strpos($_SERVER['PHP_SELF'], '?') ? $_SERVER['PHP_SELF'] . '&amp;DEBUG=1' : $_SERVER['PHP_SELF'] . '?DEBUG=1';
    $t2 = strpos($_SERVER['PHP_SELF'], '?') ? $_SERVER['PHP_SELF'] . '&amp;DEBUG=2' : $_SERVER['PHP_SELF'] . '?DEBUG=2';
开发者ID:hoangsoft90,项目名称:hw-hoangweb-plugin,代码行数:31,代码来源:testsuite.php

示例13: testdate

     */
    function testdate()
    {
        $this->assertEquals(strftime('%x', $this->t), $this->l->date($this->t));
    }
    /**
     * Regression test for I18Nv2_Locale.dayName method
     * 
     * @access public 
     */
    function testdayName()
    {
        $dayNum = strftime('%w', $this->t);
        $this->assertEquals(strftime('%A', $this->t), $this->l->dayName($dayNum));
        $this->assertEquals(strftime('%a', $this->t), $this->l->dayName($dayNum, true));
    }
    /**
     * Regression test for I18Nv2_Locale.monthName method
     * 
     * @access public 
     */
    function testmonthName()
    {
        $monthNum = strftime('%m', $this->t) - 1;
        $this->assertEquals(strftime('%B', $this->t), $this->l->monthName($monthNum));
        $this->assertEquals(strftime('%b', $this->t), $this->l->monthName($monthNum, true));
    }
}
$ts = new PHPUnit_TestSuite('I18Nv2_LocaleTest');
$rs = PHPUnit::run($ts);
echo $rs->toString();
开发者ID:promoso,项目名称:HVAC,代码行数:31,代码来源:I18Nv2_Locale-PHPUnit_Testcase.php


注:本文中的PHPUnit::run方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。