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


PHP SimpleTest::getContext方法代码示例

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


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

示例1: run

 function run($reporter)
 {
     $context = SimpleTest::getContext();
     $context->setTest($this);
     $context->setReporter($reporter);
     $this->reporter = $reporter;
     $this->reporter->paintCaseStart($this->getLabel());
     if ($this->needPDO) {
         $this->reporter->makeDry(!$this->assertTrue(class_exists('PDO', false), 'PDO does not exists ! You should install PDO because tests need it.'));
     }
     $this->setUpRun();
     foreach ($this->getTests() as $method) {
         if ($this->reporter->shouldInvoke($this->getLabel(), $method)) {
             $this->skip();
             if ($this->shouldSkip()) {
                 break;
             }
             $invoker = $this->reporter->createInvoker($this->createInvoker());
             $invoker->before($method);
             $invoker->invoke($method);
             $invoker->after($method);
         }
     }
     $this->tearDownRun();
     $this->reporter->paintCaseEnd($this->getLabel());
     unset($this->reporter);
     return $reporter->getStatus();
 }
开发者ID:CREASIG,项目名称:lizmap-web-client,代码行数:28,代码来源:junittestcase.class.php

示例2: tests_have_run

/**
 *    Checks the current test context to see if a test has
 *    ever been run.
 *    @return boolean        True if tests have run.
 */
function tests_have_run()
{
    if ($context = SimpleTest::getContext()) {
        return (bool) $context->getTest();
    }
    return false;
}
开发者ID:saurabh947,项目名称:MoodleLearning,代码行数:12,代码来源:autorun.php

示例3: createErrorQueue

 /**
  *    Wires up the error queue for a single test.
  *    @return SimpleErrorQueue    Queue connected to the test.
  *    @access private
  */
 protected function createErrorQueue()
 {
     $context = SimpleTest::getContext();
     $test = $this->getTestCase();
     $queue = $context->get('SimpleErrorQueue');
     $queue->setTestCase($test);
     return $queue;
 }
开发者ID:JamesLinus,项目名称:platform,代码行数:13,代码来源:errors.php

示例4: shouldPaintMethod

 /**
  * @param string $testName
  */
 protected function shouldPaintMethod($testName)
 {
     $testCase = SimpleTest::getContext()->getTest();
     if (!$testCase instanceof CakeTestCase) {
         return true;
     }
     return !in_array(strtolower($testName), $testCase->methods);
 }
开发者ID:rsky,项目名称:makegood,代码行数:11,代码来源:JUnitXMLReporter.php

示例5: shouldInvoke

 /**
  * @param string $testCase
  * @param string $method
  * @return boolean
  */
 public function shouldInvoke($testCase, $method)
 {
     $test = SimpleTest::getContext()->getTest();
     if ($test instanceof CakeTestCase && in_array(strtolower($method), $test->methods)) {
         return true;
     }
     return parent::shouldInvoke($testCase, $method);
 }
开发者ID:nojimage,项目名称:stagehand-testrunner,代码行数:13,代码来源:MethodFilterReporter.php

示例6:

 /**
  *    Wires up the error queue for a single test.
  *
  *    @return SimpleErrorQueue    Queue connected to the test.
  */
 public function &_createErrorQueue()
 {
     $context =& SimpleTest::getContext();
     $test =& $this->getTestCase();
     $queue =& $context->get('SimpleErrorQueue');
     $queue->setTestCase($test);
     return $queue;
 }
开发者ID:kapai69,项目名称:fl-ru-damp,代码行数:13,代码来源:errors.php

示例7: invoke

 /**
  *    Invokes a test method and dispatches any
  *    untrapped errors. Called back from
  *    the visiting runner.
  *    @param string $method    Test method to call.
  *    @access public
  */
 function invoke($method)
 {
     $context =& SimpleTest::getContext();
     $queue =& $context->get('SimpleErrorQueue');
     $queue->setTestCase($this->GetTestCase());
     set_error_handler('SimpleTestErrorHandler');
     parent::invoke($method);
     while (list($severity, $message, $file, $line) = $queue->extract()) {
         $severity = SimpleErrorQueue::getSeverityAsString($severity);
         $test =& $this->getTestCase();
         $test->error($severity, $message, $file, $line);
     }
     restore_error_handler();
 }
开发者ID:JackCanada,项目名称:moodle-hacks,代码行数:21,代码来源:errors.php

示例8: invoke

 /**
  *    Lists rather then invokes a test method. Consequently,
  *    we do not invoke the setUp() and tearDown() calls either.
  *    @param string $method    Test method to call.
  *    @access public
  */
 function invoke($method)
 {
     $context = SimpleTest::getContext();
     $test = $this->getTestCase();
     // $context->getTest();
     $reporter = $context->getReporter();
     // use 'user signal' as the way to render the list entry:
     $case = get_class($test);
     if ($case != $test->getLabel()) {
         $case = sprintf("%s [%s]", $case, $test->getLabel());
     }
     $show_breadcrumb = $reporter->includeBreadCrumb(false);
     $reporter->paintSignal("Test", sprintf("Case: %s | Method: %s", $case, $method));
     $reporter->includeBreadCrumb($show_breadcrumb);
 }
开发者ID:GerHobbelt,项目名称:simpletest,代码行数:21,代码来源:test_list.php

示例9: invoke

 /**
  *    Invokes a test method whilst trapping expected
  *    exceptions. Any left over unthrown exceptions
  *    are then reported as failures.
  *    @param string $method    Test method to call.
  */
 function invoke($method)
 {
     $trap = SimpleTest::getContext()->get('SimpleExceptionTrap');
     $trap->clear();
     try {
         parent::invoke($method);
     } catch (Exception $exception) {
         if (!$trap->isExpected($this->getTestCase(), $exception)) {
             $this->getTestCase()->exception($exception);
         }
         $trap->clear();
     }
     if ($message = $trap->getOutstanding()) {
         $this->getTestCase()->fail($message);
     }
 }
开发者ID:hafizubikm,项目名称:bakeme,代码行数:22,代码来源:exceptions.php

示例10: send

 public function send($v1, $v2)
 {
     // test for context
     $context = SimpleTest::getContext();
     $test = $context->getTest();
     $mock = $this->mock;
     foreach ($this->_expected_context as $key => $value) {
         $test->assertEqual($value, $this->_context->get($key));
     }
     $step = $mock->getCallCount('send');
     if (isset($this->_expected_context_at[$step])) {
         foreach ($this->_expected_context_at[$step] as $key => $value) {
             $test->assertEqual($value, $this->_context->get($key));
         }
     }
     // boilerplate mock code, does not have return value or references
     $args = func_get_args();
     $mock->invoke('send', $args);
 }
开发者ID:sebbie42,项目名称:casebox,代码行数:19,代码来源:ErrorCollectorEMock.php

示例11: invoke

 /**
  *    Invokes a test method whilst trapping expected
  *    exceptions. Any left over unthrown exceptions
  *    are then reported as failures.
  *
  *    @param string $method    Test method to call.
  */
 public function invoke($method)
 {
     $trap = SimpleTest::getContext()->get('SimpleExceptionTrap');
     $trap->clear();
     try {
         $has_thrown = false;
         parent::invoke($method);
     } catch (Exception $exception) {
         $has_thrown = true;
         if (!$trap->isExpected($this->getTestCase(), $exception)) {
             $this->getTestCase()->exception($exception);
         }
         $trap->clear();
     }
     if ($message = $trap->getOutstanding()) {
         $this->getTestCase()->fail($message);
     }
     if ($has_thrown) {
         try {
             parent::getTestCase()->tearDown();
         } catch (Exception $e) {
         }
     }
 }
开发者ID:kapai69,项目名称:fl-ru-damp,代码行数:31,代码来源:exceptions.php

示例12: testQueueStartsEmpty

 public function testQueueStartsEmpty()
 {
     $context = SimpleTest::getContext();
     $queue = $context->get('SimpleErrorQueue');
     $this->assertFalse($queue->extract());
 }
开发者ID:Clansuite,项目名称:Clansuite,代码行数:6,代码来源:errors_test.php

示例13: _getCurrentTestCase

 /**
  *    Finds currently running test.
  *    @return SimpeTestCase    Current test case.
  *    @access protected
  */
 function _getCurrentTestCase()
 {
     $context =& SimpleTest::getContext();
     return $context->getTest();
 }
开发者ID:Bremaweb,项目名称:streber-1,代码行数:10,代码来源:mock_objects.php

示例14: getCurrentTestCase

 /**
  *    Finds currently running test.
  *    @return SimpeTestCase    Current test case.
  */
 protected function getCurrentTestCase()
 {
     return SimpleTest::getContext()->getTest();
 }
开发者ID:Boris-de,项目名称:videodb,代码行数:8,代码来源:mock_objects.php

示例15: paintMethodStart

 /**
  * @param string $testName
  */
 public function paintMethodStart($testName)
 {
     parent::paintMethodStart($testName);
     $this->xmlWriter->startTestCase($testName, SimpleTest::getContext()->getTest());
     $this->methodStartTime = microtime(true);
     $this->assertionCount = 0;
 }
开发者ID:kumatch,项目名称:stagehand-testrunner,代码行数:10,代码来源:JUnitXMLReporter.php


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