本文整理汇总了PHP中SimpleTest::ignore方法的典型用法代码示例。如果您正苦于以下问题:PHP SimpleTest::ignore方法的具体用法?PHP SimpleTest::ignore怎么用?PHP SimpleTest::ignore使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SimpleTest
的用法示例。
在下文中一共展示了SimpleTest::ignore方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: ignoreParentsIfIgnored
/**
* Scans the now complete ignore list, and adds
* all parent classes to the list. If a class
* is not a runnable test case, then it's parents
* wouldn't be either. This is syntactic sugar
* to cut down on ommissions of ignore()'s or
* missing abstract declarations. This cannot
* be done whilst loading classes wiithout forcing
* a particular order on the class declarations and
* the ignore() calls. It's just nice to have the ignore()
* calls at the top of the file before the actual declarations.
* @param array $classes Class names of interest.
* @static
* @access public
*/
function ignoreParentsIfIgnored($classes) {
$registry = &SimpleTest::_getRegistry();
foreach ($classes as $class) {
if (SimpleTest::isIgnored($class)) {
$reflection = new SimpleReflection($class);
if ($parent = $reflection->getParent()) {
SimpleTest::ignore($parent);
}
}
}
}
示例2: ignoreParentsIfIgnored
/**
* Scans the now complete ignore list, and adds
* all parent classes to the list. If a class
* is not a runnable test case, then it's parents
* wouldn't be either. This is syntactic sugar
* to cut down on ommissions of ignore()'s or
* missing abstract declarations. This cannot
* be done whilst loading classes wiithout forcing
* a particular order on the class declarations and
* the ignore() calls. It's just nice to have the ignore()
* calls at the top of the file before the actual declarations.
* @param array $classes Class names of interest.
*/
public static function ignoreParentsIfIgnored($classes)
{
foreach ($classes as $class) {
if (SimpleTest::isIgnored($class)) {
$reflection = new SimpleReflection($class);
$parent = $reflection->getParent();
if ($parent) {
SimpleTest::ignore($parent);
}
}
}
}
示例3: call_simpletest
public static function call_simpletest(pakeTask $task, $type = 'text', $dirs = array())
{
if (!class_exists('TestSuite')) {
throw new pakeException('You must install SimpleTest to use this task.');
}
SimpleTest::ignore('UnitTestCase');
$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;
}
$files = pakeFinder::type('file')->name('*Test.php')->in($test_dirs);
if (count($files) == 0) {
throw new pakeException('No test to run.');
}
$test = new TestSuite('Test suite in (' . implode(', ', $test_dirs) . ')');
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;
}
}
示例4: _selectRunnableTests
/**
* Calculates the incoming test cases from a before
* and after list of loaded classes. Skips abstract
* classes.
* @param array $existing_classes Classes before require().
* @param array $new_classes Classes after require().
* @return array New classes which are test
* cases that shouldn't be ignored.
* @access private
*/
function _selectRunnableTests($existing_classes, $new_classes)
{
$classes = array();
foreach ($new_classes as $class) {
if (in_array($class, $existing_classes)) {
continue;
}
if ($this->_getBaseTestCase($class)) {
$reflection = new SimpleReflection($class);
if ($reflection->isAbstract()) {
SimpleTest::ignore($class);
}
$classes[] = $class;
}
}
return $classes;
}
示例5:
/**
* CakeWebTestCase a simple wrapper around WebTestCase
*
* PHP versions 4 and 5
*
* CakePHP(tm) Tests <http://book.cakephp.org/view/1196/Testing>
* Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
*
* Licensed under The Open Group Test Suite License
* Redistributions of files must retain the above copyright notice.
*
* @copyright Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
* @link http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
* @package cake
* @subpackage cake.cake.tests.lib
* @since CakePHP(tm) v 1.2.0.4433
* @license http://www.opensource.org/licenses/opengroup.php The Open Group Test Suite License
*/
/**
* Ignore base class.
*/
SimpleTest::ignore('CakeWebTestCase');
/**
* Simple wrapper for the WebTestCase provided by SimpleTest
*
* @package cake
* @subpackage cake.cake.tests.lib
*/
class CakeWebTestCase extends WebTestCase
{
}
示例6: dirname
<?php
require_once dirname(__FILE__) . '/../autorun.php';
SimpleTest::ignore('HTML5_TokenizerHarness');
abstract class HTML5_TokenizerHarness extends HTML5_JSONHarness
{
public function invoke($test)
{
//echo get_class($this) . ': ' . $test->description ."\n";
if (!isset($test->contentModelFlags)) {
$test->contentModelFlags = array('PCDATA');
}
if (!isset($test->ignoreErrorOrder)) {
$test->ignoreErrorOrder = false;
}
// Get expected result array (and maybe error count).
$expect = array();
$expectedErrorCount = 0;
// This is only used when ignoreErrorOrder = true.
foreach ($test->output as $tok) {
// If we're ignoring error order and this is a parse error, just count.
if ($test->ignoreErrorOrder && $tok === 'ParseError') {
$expectedErrorCount++;
} else {
// Normalize character tokens from the test
if ($expect && $tok[0] === 'Character' && $expect[count($expect) - 1][0] === 'Character') {
$expect[count($expect) - 1][1] .= $tok[1];
} else {
$expect[] = $tok;
}
}
示例7: __construct
<?php
/**
* Implementation specifically for JSON format files.
*/
SimpleTest::ignore('HTML5_JSONHarness');
abstract class HTML5_JSONHarness extends HTML5_DataHarness
{
protected $data;
public function __construct()
{
parent::__construct();
$this->data = json_decode(file_get_contents($this->filename));
}
public function getDescription($test)
{
return $test->description;
}
public function getDataTests()
{
return isset($this->data->tests) ? $this->data->tests : array();
// could be a weird xmlViolationsTest
}
}
示例8: dirname
<?php
// $Id$
require_once dirname(__FILE__) . '/../autorun.php';
require_once dirname(__FILE__) . '/../xml.php';
Mock::generate('SimpleScorer');
if (!function_exists('xml_parser_create')) {
SimpleTest::ignore('TestOfXmlStructureParsing');
SimpleTest::ignore('TestOfXmlResultsParsing');
}
class TestOfNestingTags extends UnitTestCase
{
function testGroupSize()
{
$nesting = new NestingGroupTag(array('SIZE' => 2));
$this->assertEqual($nesting->getSize(), 2);
}
}
class TestOfXmlStructureParsing extends UnitTestCase
{
function testValidXml()
{
$listener = new MockSimpleScorer();
$listener->expectNever('paintGroupStart');
$listener->expectNever('paintGroupEnd');
$listener->expectNever('paintCaseStart');
$listener->expectNever('paintCaseEnd');
$parser = new SimpleTestXmlParser($listener);
$this->assertTrue($parser->parse("<?xml version=\"1.0\"?>\n"));
$this->assertTrue($parser->parse("<run>\n"));
$this->assertTrue($parser->parse("</run>\n"));
示例9: dirname
<?php
// $Id$
require_once dirname(__FILE__) . '/../autorun.php';
require_once dirname(__FILE__) . '/../simpletest.php';
SimpleTest::ignore('ShouldNeverBeRunEither');
class ShouldNeverBeRun extends UnitTestCase
{
function testWithNoChanceOfSuccess()
{
$this->fail('Should be ignored');
}
}
class ShouldNeverBeRunEither extends ShouldNeverBeRun
{
}
class TestOfStackTrace extends UnitTestCase
{
function testCanFindAssertInTrace()
{
$trace = new SimpleStackTrace(array('assert'));
$this->assertEqual($trace->traceMethod(array(array('file' => '/my_test.php', 'line' => 24, 'function' => 'assertSomething'))), ' at [/my_test.php line 24]');
}
}
class DummyResource
{
}
class TestOfContext extends UnitTestCase
{
function testCurrentContextIsUnique()
{
示例10: elseif
* @since CakePHP v 1.2.0.4487
* @version $Revision$
* @modifiedby $LastChangedBy$
* @lastmodified $Date$
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
*/
App::import('Core', 'CakeTestCase');
if (!class_exists('AppController')) {
require_once LIBS . 'controller' . DS . 'app_controller.php';
} elseif (!defined('APP_CONTROLLER_EXISTS')) {
define('APP_CONTROLLER_EXISTS', true);
}
Mock::generate('CakeHtmlReporter');
Mock::generate('CakeTestCase', 'CakeDispatcherMockTestCase');
SimpleTest::ignore('SubjectCakeTestCase');
SimpleTest::ignore('CakeDispatcherMockTestCase');
/**
* SubjectCakeTestCase
*
* @package cake
* @subpackage cake.tests.cases.libs
*/
class SubjectCakeTestCase extends CakeTestCase
{
/**
* Feed a Mocked Reporter to the subject case
* prevents its pass/fails from affecting the real test
*
* @param string $reporter
* @access public
* @return void
示例11: testExpectOneErrorGetTwo
* This test is ignored as it is used by {@link TestRunnerForLeftOverAndNotEnoughErrors}
* to verify that it fails as expected.
*
* @ignore
*/
class TestOfLeftOverErrors extends UnitTestCase
{
function testExpectOneErrorGetTwo()
{
$this->expectError('Error 1');
trigger_error('Error 1');
trigger_error('Error 2');
}
}
SimpleTest::ignore('TestOfAnythingErrors');
SimpleTest::ignore('TestOfLeftOverAnythingErrors');
/**
* This test is ignored as it is used by {@link TestRunnerForLeftOverAndNotEnoughErrors}
* to verify that it fails as expected.
*
* @ignore
*/
class TestOfAnythingErrors extends UnitTestCase
{
function testExpectOneErrorGetTwo()
{
$this->expectError(new AnythingExpectation());
trigger_error('Error 1');
trigger_error('Error 2');
}
}
示例12:
*
* @copyright Copyright 2010, Jeremy Harris
* @link http://42pixels.com Jeremy Harris
* @package extended_test_case
* @subpackage extended_test_case.libs
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
/**
* Includes
*/
require_once APP . 'config' . DS . 'routes.php';
/**
* Ensure SimpleTest doesn't think this is a test case and that it starts from
* scratch
*/
SimpleTest::ignore('ExtendedTestCase');
ClassRegistry::flush();
/**
* ExtendedTestCase class
*
* Extends the functionality of CakeTestCase, namely, `testAction()`
*
* @package extended_test_case
* @subpackage extended_test_case.libs
*/
class ExtendedTestCase extends CakeTestCase
{
/**
* Whether or not the components have initialized yet
*
* @var boolean
示例13: identifyAsWebtest
* CakePHP will connect to the test database. (For more information look at
* DATABASE_CONFIG::__construct() in database.php!)
*
* This function is called automatically in startTest() before a test is run,
* so please remember to call parent::startTest() if you override it in your
* tests!
*/
function identifyAsWebtest()
{
$this->addHeader('User-Agent: CakePHP/Webtest');
}
}
/**
* Ignore base class.
*/
SimpleTest::ignore('CakeWebTestCaseWithFixtures');
/**
* Implements (copies) 1:1 all the variables and methods that CakeTestCase
* defines.
*
* The reason for this is that by default CakeWebTestCase does not offer any
* functionality to load fixtures into the database as it is known from
* CakeTestCase. So we just steal it from there, harhar!
*
* TODO: We may just wrap this stuff instead of copying it! --zivi-muh
*/
class CakeWebTestCaseWithDbFunctionality extends CakeWebTestCase
{
////////////////////////////////////////////////////////////////////
// BEGIN OF CODE COPY&PASTING FROM cake/tests/lib/cake_test_case.php
/**
示例14: getTests
}
function getTests()
{
$test_methods = array();
foreach (array_keys($this->_scenarios) as $num) {
$test_methods[] = 'test' . $num;
}
return $test_methods;
}
function __call($name, $arguments)
{
if (!preg_match('/^test(\\d+)$/', $name, $matches)) {
throw new Exception('Called invalid Test Case: ' . $name);
}
$scenario_num = intval($matches[1]);
$this->runScenario($this->_scenarios[$scenario_num]);
}
function runScenario($scenario)
{
$this->get('http://localdev.mytribehr.com/');
foreach ($scenario->getSteps() as $step) {
$this->runStep($this, $step);
}
}
function runStep(&$browser, $step)
{
FeatureContext::step($browser, $step);
}
}
SimpleTest::ignore('FeatureTestCase');
示例15: dirname
<?php
// $Id$
require_once dirname(__FILE__) . '/../simpletest.php';
SimpleTest::ignore('ShouldNeverBeRun');
class ShouldNeverBeRun extends UnitTestCase
{
function testWithNoChanceOfSuccess()
{
$this->fail('Should be ignored');
}
}