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


PHP Stub::consecutive方法代码示例

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


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

示例1: testGetMetrics

 public function testGetMetrics()
 {
     $diObj = new DI();
     $expectedMetric = new Metric();
     $expectedMetric->setName('DiskUsage');
     $expectedMetric->setUnit('Percent');
     $expectedMetric->setValue('56');
     $expectedMetric->setNamespace('CustomMetric/Test');
     $fakeCmdRunner = Stub::make('\\AWSCustomMetric\\CommandRunner', ['execute' => function () {
     }, 'getReturnCode' => 0, 'getReturnValue' => Stub::consecutive('Darwin', '56')]);
     $diObj->setCommandRunner($fakeCmdRunner);
     $diskUsage = new DiskUsage($diObj, 'CustomMetric/Test');
     $returnArray = $diskUsage->getMetrics();
     $this->assertCount(1, $returnArray, 'Disk usage return array failed');
     $this->assertEquals($expectedMetric, $returnArray[0], 'DiskUsage return metric object failed!');
     $fakeCmdRunner = Stub::make('\\AWSCustomMetric\\CommandRunner', ['execute' => function () {
     }, 'getReturnCode' => 0, 'getReturnValue' => Stub::consecutive('Linux', '0')]);
     $diObj->setCommandRunner($fakeCmdRunner);
     $diskUsage = new DiskUsage($diObj, 'CustomMetric/Test');
     $returnArray = $diskUsage->getMetrics();
     $this->assertNull($returnArray, 'DiskUsage return null failed!');
 }
开发者ID:fustundag,项目名称:awscw-custom-metrics,代码行数:22,代码来源:DiskUsageTest.php

示例2: testConsecutive

 public function testConsecutive()
 {
     $dummy = Stub::make('DummyClass', array('helloWorld' => Stub::consecutive('david', 'emma', 'sam', 'amy')));
     $this->assertEquals('david', $dummy->helloWorld());
     $this->assertEquals('emma', $dummy->helloWorld());
     $this->assertEquals('sam', $dummy->helloWorld());
     $this->assertEquals('amy', $dummy->helloWorld());
     // Expected null value when no more values
     $this->assertNull($dummy->helloWorld());
 }
开发者ID:hitechdk,项目名称:Codeception,代码行数:10,代码来源:StubTest.php

示例3: testValidateNotAllowEmpty

 public function testValidateNotAllowEmpty()
 {
     $validation = Stub::make('Phalcon\\Validation', array('getValue' => Stub::consecutive('', 'val2'), 'appendMessage' => true));
     $validator = new ConfirmationOf(array('origField' => 'original', 'allowEmpty' => false));
     $this->assertFalse($validator->validate($validation, 'confirmation'));
 }
开发者ID:phalcon,项目名称:incubator,代码行数:6,代码来源:ConfirmationOfTest.php


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