本文整理汇总了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!');
}
示例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());
}
示例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'));
}