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


PHP TestSuite类代码示例

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


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

示例1: suite

 public static function suite()
 {
     $suite = new TestSuite('AmpolirosCore');
     $suite->addTestSuite(new ReflectionClass('AmpolirosTest'));
     $suite->addTestSuite(new ReflectionClass('AmpConfigTest'));
     return $suite;
 }
开发者ID:alexpagnoni,项目名称:ampoliros,代码行数:7,代码来源:AllAmpolirosCoreTests.php

示例2: runAllTests

 function runAllTests()
 {
     $test = new TestSuite();
     $test->addTestFile($this->webTestDir . 'wtest_uploadform.php');
     $test->addTestFile($this->webTestDir . 'wtest_loginform.php');
     $test->run(new HtmlReporter());
 }
开发者ID:cybercog,项目名称:exambuff,代码行数:7,代码来源:webtests.php

示例3: suite

 public static function suite()
 {
     $suite = new TestSuite('Haanga test suite');
     $suite->addTestSuite('templateTest');
     $suite->addTestSuite('errorTest');
     return $suite;
 }
开发者ID:narock,项目名称:lodspeakr,代码行数:7,代码来源:TestSuite.php

示例4: suite

 public static function suite()
 {
     require 'ampoliros.php';
     $suite = new TestSuite('Ampoliros');
     $suite->addTest(AllAmpolirosCoreTests::suite());
     $suite->addTest(AllAmpolirosDatatransferTests::suite());
     return $suite;
 }
开发者ID:alexpagnoni,项目名称:ampoliros,代码行数:8,代码来源:AllAmpolirosTests.php

示例5: report

 /**
  * Genereates a nice report of the test.
  *
  * It instantiate a SimpleTest TestSuite and launches a Reporter.
  * This method is typically called by a TestRunner.
  *
  * @return void
  * @see    KortTestRunner
  * @see    KortCliReporter
  * @see    KortHTMLReporter
  */
 public function report()
 {
     $test = new \TestSuite($this->getLabel());
     $test->add($this);
     if (\TextReporter::inCli()) {
         exit($test->run(new KortCliReporter()) ? 0 : 1);
     }
     $test->run(new KortHTMLReporter());
 }
开发者ID:CloCkWeRX,项目名称:kort,代码行数:20,代码来源:AbstractKortUnitTestCase.php

示例6: matched

 /**
  * Check if the test object should be filtered out.
  *
  * @param TestSuite|TestCase $test
  * @return bool
  */
 protected function matched($test)
 {
     foreach ($this->groups as $group) {
         if ($test->in_group($group)) {
             return false;
         }
     }
     return true;
 }
开发者ID:v2e4lisp,项目名称:preview,代码行数:15,代码来源:GroupExcluded.php

示例7: addTestSuite

 /**
  * Add child TestSuite to the provided TestSuite from the XML node
  *
  * @param TestSuite         $testSuite
  * @param \SimpleXMLElement $xml
  */
 public function addTestSuite(TestSuite $testSuite, \SimpleXMLElement $xml)
 {
     foreach ($xml->xpath('./testsuite') as $element) {
         $suite = new TestSuite((string) $element['name'], (string) $element['file'], (string) $element['namespace'], (string) $element['fullPackage']);
         $this->addTestCase($suite, $element);
         $this->addTestSuite($suite, $element);
         $testSuite->addTestSuite($suite);
     }
 }
开发者ID:sonata-project,项目名称:composer-archive-creator,代码行数:15,代码来源:PHPUnitLoader.php

示例8: test

 /**
  * Runs the indicated test case in isolation with the
  * URI: /simpletests/test/path/to/filename
  *
  * For example, to run test_user.php, indicate the path relative to the "tests" directory.
  * http://hostname/test/model/test_user.php
  */
 function test()
 {
     $nodes = Router::$segments;
     unset($nodes[0]);
     unset($nodes[1]);
     $path = implode('/', $nodes);
     $test = new TestSuite("Test " . $path);
     $test->addTestFile(APPPATH . "tests/" . $path);
     $test->run(new HtmlReporter());
 }
开发者ID:ready4god2513,项目名称:Journal,代码行数:17,代码来源:simpletests.php

示例9: call_simpletest

 public static function call_simpletest($task, $type = 'text', $dirs = array())
 {
     // remove E_STRICT because simpletest is not E_STRICT compatible
     $old_error_reporting = error_reporting();
     $new_error_reporting = $old_error_reporting;
     if ($new_error_reporting & E_STRICT) {
         $new_error_reporting = $new_error_reporting ^ E_STRICT;
     }
     include_once 'simpletest/unit_tester.php';
     include_once 'simpletest/web_tester.php';
     if (!class_exists('TestSuite')) {
         throw new pakeException('You must install SimpleTest to use this task.');
     }
     require_once 'simpletest/reporter.php';
     require_once 'simpletest/mock_objects.php';
     set_include_path('test' . PATH_SEPARATOR . 'lib' . PATH_SEPARATOR . get_include_path());
     $base_test_dir = 'test';
     $test_dirs = array();
     // run tests only in these subdirectories
     if ($dirs) {
         foreach ($dirs as $dir) {
             $test_dirs[] = $base_test_dir . DIRECTORY_SEPARATOR . $dir;
         }
     } else {
         $test_dirs[] = $base_test_dir;
     }
     $test = new TestSuite('Test suite in (' . implode(', ', $test_dirs) . ')');
     $files = pakeFinder::type('file')->name('*Test.php')->in($test_dirs);
     if (count($files) > 0) {
         foreach ($files as $file) {
             $test->addFile($file);
         }
         ob_start();
         if ($type == 'html') {
             $result = $test->run(new HtmlReporter());
         } else {
             if ($type == 'xml') {
                 $result = $test->run(new XmlReporter());
             } else {
                 $result = $test->run(new TextReporter());
             }
         }
         $content = ob_get_contents();
         ob_end_clean();
         if ($task->is_verbose()) {
             echo $content;
         }
     } else {
         throw new pakeException('No test to run.');
     }
     error_reporting($old_error_reporting);
 }
开发者ID:rosko,项目名称:pake,代码行数:52,代码来源:pakeSimpletestTask.class.php

示例10: testContentOfRecorderWithOnePassAndOneFailure

 public function testContentOfRecorderWithOnePassAndOneFailure()
 {
     $test = new TestSuite();
     $test->addFile(dirname(__FILE__) . '/support/recorder_sample.php');
     $recorder = new Recorder(new SimpleReporter());
     $test->run($recorder);
     $this->assertEqual(count($recorder->results), 2);
     $this->assertIsA($recorder->results[0], 'SimpleResultOfPass');
     $this->assertEqual('testTrueIsTrue', array_pop($recorder->results[0]->breadcrumb));
     $this->assertPattern('/ at \\[.*\\Wrecorder_sample\\.php line 9\\]/', $recorder->results[0]->message);
     $this->assertIsA($recorder->results[1], 'SimpleResultOfFail');
     $this->assertEqual('testFalseIsTrue', array_pop($recorder->results[1]->breadcrumb));
     $this->assertPattern("/Expected false, got \\[Boolean: true\\] at \\[.*\\Wrecorder_sample\\.php line 14\\]/", $recorder->results[1]->message);
 }
开发者ID:guicara,项目名称:simpletest,代码行数:14,代码来源:recorder_test.php

示例11: suite

 public static function suite()
 {
     $suite = new TestSuite('onPHP-' . ONPHP_VERSION);
     foreach (self::$paths as $testPath) {
         foreach (glob($testPath . '*Test' . EXT_CLASS, GLOB_BRACE) as $file) {
             $suite->addTestFile($file);
         }
     }
     // meta, DB and DAOs ordered tests portion
     if (self::$dbs) {
         try {
             Singleton::getInstance('DBTestPool', self::$dbs)->connect();
         } catch (Exception $e) {
             Singleton::dropInstance('DBTestPool');
             Singleton::getInstance('DBTestPool');
         }
         // build stuff from meta
         $metaDir = ONPHP_TEST_PATH . 'meta' . DIRECTORY_SEPARATOR;
         $path = ONPHP_META_PATH . 'bin' . DIRECTORY_SEPARATOR . 'build.php';
         $_SERVER['argv'] = array();
         $_SERVER['argv'][0] = $path;
         $_SERVER['argv'][1] = $metaDir . 'config.inc.php';
         $_SERVER['argv'][2] = $metaDir . 'config.meta.xml';
         $_SERVER['argv'][] = '--force';
         $_SERVER['argv'][] = '--no-schema-check';
         $_SERVER['argv'][] = '--drop-stale-files';
         include $path;
         // provide paths to autogenerated stuff
         set_include_path(get_include_path() . PATH_SEPARATOR . ONPHP_META_AUTO_BUSINESS_DIR . PATH_SEPARATOR . ONPHP_META_AUTO_DAO_DIR . PATH_SEPARATOR . ONPHP_META_AUTO_PROTO_DIR . PATH_SEPARATOR . ONPHP_META_DAO_DIR . PATH_SEPARATOR . ONPHP_META_BUSINESS_DIR . PATH_SEPARATOR . ONPHP_META_PROTO_DIR);
         $daoTest = new DAOTest();
         $out = MetaConfiguration::me()->getOutput();
         foreach (DBTestPool::me()->getPool() as $connector => $db) {
             DBPool::me()->setDefault($db);
             $out->info('Using ')->info(get_class($db), true)->infoLine(' connector.');
             try {
                 $daoTest->drop();
             } catch (DatabaseException $e) {
                 // previous shutdown was clean
             }
             $daoTest->create()->fill(false);
             MetaConfiguration::me()->checkIntegrity();
             $out->newLine();
             $daoTest->drop();
         }
         DBPool::me()->dropDefault();
     }
     $suite->addTestSuite('DAOTest');
     return $suite;
 }
开发者ID:rero26,项目名称:onphp-framework,代码行数:49,代码来源:AllTests.php

示例12: save

 /**
  * @param TestSuite $testSuite
  * @param $file
  */
 public function save(TestSuite $testSuite, $file)
 {
     $close = false;
     if (!is_resource($file)) {
         $file = fopen($file, 'w');
         $close = true;
     }
     fwrite($file, "<?xml version=\"1.0\" ?>\n");
     fwrite($file, "<testsuites>\n");
     fwrite($file, (string) $testSuite->toXml());
     fwrite($file, "</testsuites>");
     if ($close) {
         fclose($file);
     }
 }
开发者ID:sonata-project,项目名称:composer-archive-creator,代码行数:19,代码来源:JUnitWriter.php

示例13: runAllTests

 function runAllTests()
 {
     $test = new TestSuite();
     /*//$test->addTestFile(dirname(__FILE__).'/testcrud.php');
     		$test->addTestFile(dirname(__FILE__).'/testdatabase.php');
     		$test->addTestFile(dirname(__FILE__).'/testcrudasmodel.php');
     		//$test->addTestFile(dirname(__FILE__).'/testusersignup.php'); obselete - users store themselves
     		$test->addTestFile(dirname(__FILE__).'/testupload.php');
     		$test->addTestFile(dirname(__FILE__).'/testscript.php');
     		$test->addTestFile(dirname(__FILE__).'/testmarkjson.php');
     		$test->addTestFile(dirname(__FILE__).'/testpayment.php');
     		$test->addTestFile(dirname(__FILE__).'/testpagegroup.php');*/
     $test->addTestFile(dirname(__FILE__) . '/testscript.php');
     $test->run(new HtmlReporter());
 }
开发者ID:cybercog,项目名称:exambuff,代码行数:15,代码来源:alltests.php

示例14: merge

 /**
  * @param \Iterator $files
  * @param TestSuite $testSuite
  *
  * @return TestSuite
  */
 public function merge(\Iterator $files, TestSuite $testSuite = null)
 {
     if (!$testSuite) {
         $testSuite = new TestSuite(null, null, null, null);
     }
     $loader = new PHPUnitLoader();
     foreach ($files as $file) {
         $suite = $loader->load($file->getContents());
         if (!$suite) {
             continue;
         }
         $testSuite->addTestSuite($suite);
     }
     return $testSuite;
 }
开发者ID:sonata-project,项目名称:composer-archive-creator,代码行数:21,代码来源:JUnitMerger.php

示例15: testPass

 function testPass()
 {
     $listener = new MockSimpleSocket();
     $fullpath = realpath(dirname(__FILE__) . '/support/test1.php');
     $testpath = EclipseReporter::escapeVal($fullpath);
     $expected = "{status:\"pass\",message:\"pass1 at [{$testpath} line 4]\",group:\"{$testpath}\",case:\"test1\",method:\"test_pass\"}";
     //this should work...but it doesn't so the next line and the last line are the hacks
     //$listener->expectOnce('write',array($expected));
     $listener->setReturnValue('write', -1);
     $pathparts = pathinfo($fullpath);
     $filename = $pathparts['basename'];
     $test = new TestSuite($filename);
     $test->addTestFile($fullpath);
     $test->run(new EclipseReporter($listener));
     $this->assertEqual($expected, $listener->output);
 }
开发者ID:Bremaweb,项目名称:streber-1,代码行数:16,代码来源:eclipse_test.php


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