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


PHP core_php_time_limit::get_and_clear_unit_test_data方法代码示例

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


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

示例1: test_basic

 /**
  * Tests for basic use with simple numeric progress.
  */
 public function test_basic()
 {
     $progress = new core_mock_progress();
     // Check values of empty progress things.
     $this->assertFalse($progress->is_in_progress_section());
     // Start progress counting, check basic values and check that update
     // gets called.
     $progress->start_progress('hello', 10);
     $this->assertTrue($progress->was_update_called());
     $this->assertTrue($progress->is_in_progress_section());
     $this->assertEquals('hello', $progress->get_current_description());
     // Check numeric position and indeterminate count.
     $this->assert_min_max(0.0, 0.0, $progress);
     $this->assertEquals(0, $progress->get_progress_count());
     // Make some progress and check that the time limit gets added.
     $progress->step_time();
     core_php_time_limit::get_and_clear_unit_test_data();
     $progress->progress(2);
     $this->assertTrue($progress->was_update_called());
     $this->assertEquals(array(\core\progress\base::TIME_LIMIT_WITHOUT_PROGRESS), core_php_time_limit::get_and_clear_unit_test_data());
     // Check the new value.
     $this->assert_min_max(0.2, 0.2, $progress);
     // Do another progress run at same time, it should be ignored.
     $progress->progress(3);
     $this->assertFalse($progress->was_update_called());
     $this->assert_min_max(0.3, 0.3, $progress);
     // End the section. This should cause an update.
     $progress->end_progress();
     $this->assertTrue($progress->was_update_called());
     // Because there are no sections left open, it thinks we finished.
     $this->assert_min_max(1.0, 1.0, $progress);
     // There was 1 progress call.
     $this->assertEquals(1, $progress->get_progress_count());
 }
开发者ID:evltuma,项目名称:moodle,代码行数:37,代码来源:progress_test.php


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