本文整理汇总了PHP中getCheckpoint函数的典型用法代码示例。如果您正苦于以下问题:PHP getCheckpoint函数的具体用法?PHP getCheckpoint怎么用?PHP getCheckpoint使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了getCheckpoint函数的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: set
public function set($fieldName, $value)
{
// convert $value into something that can appear in our logs
$convertor = new DataPrinter();
$printable = $convertor->convertToString($value);
// what are we doing?
$log = usingLog()->startAction("set checkpoint field '{$fieldName}' to '{$printable}'");
// get the checkpoint
$checkpoint = getCheckpoint();
// set the value
$checkpoint->{$fieldName} = $value;
// all done
$log->endAction();
}
示例2: get
public function get($fieldName)
{
// what are we doing?
$log = usingLog()->startAction("get value of checkpoint field '{$fieldName}'");
// get the checkpoint
$checkpoint = getCheckpoint();
// does the value exist?
if (!isset($checkpoint->{$fieldName})) {
throw new E5xx_ActionFailed(__METHOD__);
}
// all done
$log->endAction();
return $checkpoint->{$fieldName};
}
示例3: getCheckpoint
//
// ------------------------------------------------------------------------
// ========================================================================
//
// POSSIBLE ACTION(S)
//
// ------------------------------------------------------------------------
$story->addAction(function () {
// we're going to store the received message in here
$checkpoint = getCheckpoint();
foreach (firstHostWithRole("zmq_target") as $hostId) {
$context = usingZmqContext()->getZmqContext();
$inPort = fromHost($hostId)->getStorySetting("zmq.single.inPort");
$outPort = fromHost($hostId)->getStorySetting("zmq.single.outPort");
$inSocket = usingZmqContext($context)->connectToHost($hostId, $inPort, 'PUSH');
$outSocket = usingZmqContext($context)->connectToHost($hostId, $outPort, 'PULL');
usingZmqSocket($inSocket)->send($checkpoint->expectedMessage);
$checkpoint->actualMessage = fromZmqSocket($outSocket)->recv();
}
});
// ========================================================================
//
// POST-TEST INSPECTION
//
// ------------------------------------------------------------------------
$story->addPostTestInspection(function () {
$checkpoint = getCheckpoint();
assertsObject($checkpoint)->hasAttribute("expectedMessage");
assertsObject($checkpoint)->hasAttribute("actualMessage");
assertsString($checkpoint->actualMessage)->equals($checkpoint->expectedMessage);
});