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


PHP TestSuite::addTestCase方法代码示例

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


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

示例1: addTestCase

 /**
  * Add testcases to the provided TestSuite from the XML node
  *
  * @param TestSuite         $testSuite
  * @param \SimpleXMLElement $xml
  */
 public function addTestCase(TestSuite $testSuite, \SimpleXMLElement $xml)
 {
     foreach ($xml->xpath('./testcase') as $element) {
         $testcase = new TestCase((string) $element['name'], (int) $element['assertions'], (double) $element['time'], (string) $element['class'], (string) $element['file'], (int) $element['line']);
         if ($element->error) {
             $testcase->setError(new TestError((string) $element->error[0]->attributes()->type, (string) $element->error[0]));
         }
         if ($element->failure) {
             $testcase->setFailure(new TestFailure((string) $element->failure[0]->attributes()->type, (string) $element->failure[0]));
         }
         $testSuite->addTestCase($testcase);
     }
 }
开发者ID:sonata-project,项目名称:composer-archive-creator,代码行数:19,代码来源:PHPUnitLoader.php

示例2: runAction

 /**
  * Runs all the unit tests we can find
  */
 public function runAction()
 {
     /** FIXME: just a quick draft, copied from another file
     			and not expected to work. */
     $view = Zend_Registry::getInstance()->view;
     $registry = Zend_Registry::getInstance();
     $path = realpath($registry->configuration->unittest->dir);
     //$template = 'list/testcases.tpl';
     /// copied from test_all.php in simpletest folder
     $suite = new TestSuite('All tests');
     /// TODO for all tests matching TestOf.+/.class/.php in folder {
     // $suite->addTestCase( new Class in file );
     $suite->addTestCase(new TestOfSimpleTest());
     /// }
     //$suite->addTestCase(new TestOfRequestHandle());
     $suite->run(new HtmlReporter());
     /////////////
 }
开发者ID:RobertGresdal,项目名称:widget-testcase-framework,代码行数:21,代码来源:TestController.php

示例3: runGroupTest

 /**
  * Runs a specific group test file
  *
  * @param string $groupTestName
  * @param string $reporter
  * @return void
  * @access public
  */
 function runGroupTest($groupTestName, &$reporter)
 {
     $manager = new TestManager();
     $filePath = $manager->_getTestsPath('groups') . DS . strtolower($groupTestName) . $manager->_groupExtension;
     if (!file_exists($filePath)) {
         trigger_error("Group test {$groupTestName} cannot be found at {$filePath}", E_USER_ERROR);
     }
     require_once $filePath;
     $test = new TestSuite($groupTestName . ' group test');
     foreach ($manager->_getGroupTestClassNames($filePath) as $groupTest) {
         $testCase = new $groupTest();
         $test->addTestCase($testCase);
         if (isset($testCase->label)) {
             $test->_label = $testCase->label;
         }
     }
     return $test->run($reporter);
 }
开发者ID:evrard,项目名称:cakephp2x,代码行数:26,代码来源:test_manager.php

示例4: run

<?php

include_once './core.testing.TestSuite.class.php';
include_once './core.testing.TestCase.class.php';
class CustomTestCase extends TestCase
{
    public function run()
    {
        $this->test1();
        $this->test2();
    }
    public function test1()
    {
        $this->assert(false, 'Testing de false');
    }
    public function test2()
    {
        throw new Exception("esto es una excepcion");
    }
}
$suite = new TestSuite();
$tc = new CustomTestCase($suite);
$suite->addTestCase($tc);
$suite->run();
print_r($suite->getReports());
开发者ID:fkali,项目名称:yupp,代码行数:25,代码来源:core.testing.TestSuite.test.php

示例5: skip

    function skip()
    {
        $this->skipIf(false);
        $this->skipUnless(true);
    }
    function testFail()
    {
        $this->fail('We should see this message');
    }
    function testPass()
    {
        $this->pass('We should see this message');
    }
}
$test = new TestSuite('Visual test with 50 passes, 50 fails and 7 exceptions');
$test->addTestCase(new PassingUnitTestCaseOutput());
$test->addTestCase(new FailingUnitTestCaseOutput());
$test->addTestCase(new VisualTestOfErrors());
$test->addTestCase(new TestOfMockObjectsOutput());
$test->addTestCase(new TestOfPastBugs());
$test->addTestCase(new TestOfVisualShell());
$test->addTestCase(new TestOfSkippingNoMatterWhat());
$test->addTestCase(new TestOfSkippingOrElse());
$test->addTestCase(new TestOfSkippingTwiceOver());
$test->addTestCase(new TestThatShouldNotBeSkipped());
if (isset($_GET['xml']) || in_array('xml', isset($argv) ? $argv : array())) {
    $reporter = new XmlReporter();
} elseif (TextReporter::inCli()) {
    $reporter = new TextReporter();
} else {
    $reporter = new PassesAsWellReporter();
开发者ID:Spark-Eleven,项目名称:revive-adserver,代码行数:31,代码来源:visual_test.php

示例6: dirname

<?php

// $Id: detached_test.php 1505 2007-04-30 23:39:59Z lastcraft $
require_once '../detached.php';
require_once '../reporter.php';
// The following URL will depend on your own installation.
$command = 'php ' . dirname(__FILE__) . '/visual_test.php xml';
$test = new TestSuite('Remote tests');
$test->addTestCase(new DetachedTestCase($command));
if (SimpleReporter::inCli()) {
    exit($test->run(new TextReporter()) ? 0 : 1);
}
$test->run(new HtmlReporter());
开发者ID:Bremaweb,项目名称:streber-1,代码行数:13,代码来源:detached_test.php

示例7: elseif

<?php

// $Id: remote_test.php 1505 2007-04-30 23:39:59Z lastcraft $
require_once '../remote.php';
require_once '../reporter.php';
// The following URL will depend on your own installation.
if (isset($_SERVER['SCRIPT_URI'])) {
    $base_uri = $_SERVER['SCRIPT_URI'];
} elseif (isset($_SERVER['HTTP_HOST']) && isset($_SERVER['PHP_SELF'])) {
    $base_uri = 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF'];
}
$test_url = str_replace('remote_test.php', 'visual_test.php', $base_uri);
$test = new TestSuite('Remote tests');
$test->addTestCase(new RemoteTestCase($test_url . '?xml=yes', $test_url . '?xml=yes&dry=yes'));
if (SimpleReporter::inCli()) {
    exit($test->run(new TextReporter()) ? 0 : 1);
}
$test->run(new HtmlReporter());
开发者ID:Bremaweb,项目名称:streber-1,代码行数:18,代码来源:remote_test.php

示例8: loadTests

 /**
  * Genera una TestSuite con los TestCase definidos para esta aplicacion.
  */
 public function loadTests()
 {
     $dir = dir($this->path . '/tests');
     $testCases = array();
     // Recorre directorio de la aplicacion
     while (false !== ($test = $dir->read())) {
         //echo $test.'<br/>';
         // Se queda solo con los nombres de los directorios
         if (is_file($this->path . '/tests/' . $test) && String::endsWith($test, 'class.php')) {
             $testCases[] = $test;
         }
     }
     // Crea instancias de las clases testcase
     $suite = new TestSuite();
     foreach ($testCases as $testCaseFile) {
         $fi = FileNames::getFilenameInfo($testCaseFile);
         $clazz = $fi['name'];
         //print_r($fi);
         YuppLoader::load($fi['package'], $clazz);
         $suite->addTestCase(new $clazz($suite));
     }
     return $suite;
 }
开发者ID:fkali,项目名称:yupp,代码行数:26,代码来源:core.app.App.class.php

示例9: addTestFile

 function addTestFile($file, $internalcall = false)
 {
     if ($this->showsearch) {
         if ($internalcall) {
             echo '<li><b>' . basename($file) . '</b></li>';
         } else {
             echo '<p>Adding test file: ' . realpath($file) . '</p>';
         }
         // Make sure that syntax errors show up suring the search, otherwise you often
         // get blank screens because evil people turn down error_reporting elsewhere.
         error_reporting(E_ALL);
     }
     if (!is_file($file)) {
         parent::addTestCase(new BadTest($file, 'Not a file or does not exist'));
     }
     parent::addTestFile($file);
 }
开发者ID:edwinphillips,项目名称:moodle-485cb39,代码行数:17,代码来源:ex_simple_test.php

示例10: TestSuite

<?php

require_once 'bootstrap.php';
//require_once('../../autoload.php');
//require_once('../../application/bootstrap.php');
//require('../../library/app/wtf2.class.php');
// todo: print the result, don't use a zend viewer, keep this simple!
//Zend_Loader::registerAutoload('Tester');
$suite = new TestSuite('All tests');
/// @todo add all files in this dir that starts with 'TestOf'
$suite->addTestCase(new TestOfSimpleTest());
//$suite->addTestCase(new TestOfRequestHandle());
$suite->run(new HtmlReporter());
/**/
/*class AllTests extends TestSuite {
    function AllTests(){
        $this->TestSuite('All tests');
        $this->addFile('test_simpletest.php');
        $this->addFile('test_foo.php');
    }
}/**/
开发者ID:RobertGresdal,项目名称:widget-testcase-framework,代码行数:21,代码来源:test_all.php


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