• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP newStoryFor函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中newStoryFor函数的典型用法代码示例。如果您正苦于以下问题:PHP newStoryFor函数的具体用法?PHP newStoryFor怎么用?PHP newStoryFor使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



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

示例1: newStoryFor

<?php

// ========================================================================
//
// STORY DETAILS
//
// ------------------------------------------------------------------------
$story = newStoryFor('Storyplayer')->inGroup(['Modules', 'Host'])->called('Can detect when a screen session fails to start');
$story->requiresStoryplayerVersion(2);
// ========================================================================
//
// TEST SETUP / TEARDOWN
//
// ------------------------------------------------------------------------
$story->addTestSetup(function () {
    // use the checkpoint to share the name of our screen session
    $checkpoint = getCheckpoint();
    $checkpoint->session = "storyplayer_test_session";
    // make sure the session isn't running on the host
    foreach (hostWithRole('host_target') as $hostId) {
        $details = fromHost($hostId)->getScreenSessionDetails($checkpoint->session);
        if ($details) {
            usingHost($hostId)->stopProcess($details->pid);
        }
    }
});
$story->addTestTeardown(function () {
    $checkpoint = getCheckpoint();
    // if we've left the session running, go and kill it off
    foreach (hostWithRole('host_target') as $hostId) {
        $details = fromHost($hostId)->getScreenSessionDetails($checkpoint->session);
开发者ID:datasift,项目名称:storyplayer,代码行数:31,代码来源:20-CanDetectWhenScreenSessionFailsToStartStory.php


示例2: newStoryFor

<?php

// ========================================================================
//
// STORY DETAILS
//
// ------------------------------------------------------------------------
$story = newStoryFor('Storyplayer')->inGroup(['Modules', 'AssertsString'])->called('Can check that a string is empty');
$story->requiresStoryplayerVersion(2);
// ========================================================================
//
// STORY SETUP / TEAR-DOWN
//
// ------------------------------------------------------------------------
// ========================================================================
//
// POSSIBLE ACTION(S)
//
// ------------------------------------------------------------------------
$story->addAction(function () {
    $checkpoint = getCheckpoint();
    // this should pass
    $stringData = "hello, Storyplayer";
    assertsString($stringData)->isNotEmpty();
    // and these should fail
    try {
        $nullData = null;
        assertsString($nullData)->isNotEmpty();
    } catch (Exception $e) {
        $checkpoint->nullTestPassed = true;
    }
开发者ID:datasift,项目名称:storyplayer,代码行数:31,代码来源:60b-CanAssertStringIsNotEmptyStory.php


示例3: newStoryFor

<?php

// ========================================================================
//
// STORY DETAILS
//
// ------------------------------------------------------------------------
$story = newStoryFor('Storyplayer')->inGroup(['Modules', 'ZeroMQ'])->called('Can send and receive a single message');
$story->requiresStoryplayerVersion(2);
// ========================================================================
//
// PRE-TEST PREDICTION
//
// ------------------------------------------------------------------------
$story->addTestCanRunCheck(function () {
    // do we have the ZMQ extension installed?
    expectsZmq()->requirementsAreMet();
});
// ========================================================================
//
// STORY SETUP / TEAR-DOWN
//
// ------------------------------------------------------------------------
$story->addTestSetup(function () {
    // let's decide on the message we're sending and expecting back
    $checkpoint = getCheckpoint();
    $checkpoint->expectedMessage = "hello, Storyplayer";
    $checkpoint->actualMessage = null;
});
// ========================================================================
//
开发者ID:datasift,项目名称:storyplayer,代码行数:31,代码来源:CanSendAndReceiveSingleZeromqMessageStory.php


示例4: newStoryFor

<?php

// ========================================================================
//
// STORY DETAILS
//
// ------------------------------------------------------------------------
$story = newStoryFor('Storyplayer')->inGroup(['Modules', 'AssertsObject'])->called('Can check that data is an object');
$story->requiresStoryplayerVersion(2);
// ========================================================================
//
// STORY SETUP / TEAR-DOWN
//
// ------------------------------------------------------------------------
// ========================================================================
//
// POSSIBLE ACTION(S)
//
// ------------------------------------------------------------------------
$story->addAction(function () {
    $checkpoint = getCheckpoint();
    // this should pass
    $objectData = new stdClass();
    assertsObject($objectData)->isObject();
    // and these should fail
    try {
        $nullData = null;
        assertsObject($nullData)->isObject();
    } catch (Exception $e) {
        $checkpoint->nullTestPassed = true;
    }
开发者ID:datasift,项目名称:storyplayer,代码行数:31,代码来源:50a-CanAssertIsObjectStory.php


示例5: newStoryFor

<?php

// ========================================================================
//
// STORY DETAILS
//
// ------------------------------------------------------------------------
$story = newStoryFor('Storyplayer')->inGroup(['Modules', 'AssertsDouble'])->called('Can check that a double is greater than an integer');
$story->requiresStoryplayerVersion(2);
// ========================================================================
//
// STORY SETUP / TEAR-DOWN
//
// ------------------------------------------------------------------------
// ========================================================================
//
// POSSIBLE ACTION(S)
//
// ------------------------------------------------------------------------
$story->addAction(function () {
    $checkpoint = getCheckpoint();
    // this should pass
    $actualData = 2.0;
    $expectedData1 = 1;
    assertsDouble($actualData)->isGreaterThan($expectedData1);
    // and these should fail
    try {
        $expectedData2 = 2;
        assertsDouble($actualData)->isGreaterThan($expectedData2);
    } catch (Exception $e) {
        $checkpoint->test2Passed = true;
开发者ID:datasift,项目名称:storyplayer,代码行数:31,代码来源:30b-CanAssertDoubleIsGreaterThanIntegerStory.php


示例6: newStoryFor

<?php

// ========================================================================
//
// STORY DETAILS
//
// ------------------------------------------------------------------------
$story = newStoryFor('Storyplayer')->inGroup('Hosts')->called('Can download a file');
$story->requiresStoryplayerVersion(2);
// ========================================================================
//
// STORY SETUP / TEAR-DOWN
//
// ------------------------------------------------------------------------
$story->addTestSetup(function () {
    // cleanup after ourselves
    foreach (hostWithRole('upload_target') as $hostname) {
        usingHost($hostname)->uploadFile(__DIR__ . '/testfile.txt', "testfile.txt");
    }
});
$story->addTestTeardown(function () {
    // cleanup after ourselves
    foreach (hostWithRole('upload_target') as $hostname) {
        // remove the file from the test environment
        usingHost($hostname)->runCommand("if [[ -e testfile.txt ]] ; then rm -f testfile.txt ; fi");
        // remove the file from our computer too
        $filename = '/tmp/testfile-' . $hostname . '.txt';
        if (file_exists($filename)) {
            // tidy up
            unlink($filename);
        }
开发者ID:datasift,项目名称:storyplayer,代码行数:31,代码来源:CanDownloadAFileStory.php


示例7: newStoryFor

<?php

// ========================================================================
//
// STORY DETAILS
//
// ------------------------------------------------------------------------
$story = newStoryFor('Storyplayer')->inGroup(['Modules', 'AssertsDouble'])->called('Can check that a double is less than or equal to an integer');
$story->requiresStoryplayerVersion(2);
// ========================================================================
//
// STORY SETUP / TEAR-DOWN
//
// ------------------------------------------------------------------------
// ========================================================================
//
// POSSIBLE ACTION(S)
//
// ------------------------------------------------------------------------
$story->addAction(function () {
    $checkpoint = getCheckpoint();
    // these should pass
    $actualData = 2.0;
    $expectedData1 = 3;
    assertsDouble($actualData)->isLessThanOrEqualTo($expectedData1);
    $actualData = 2.0;
    $expectedData2 = 2;
    assertsDouble($actualData)->isLessThanOrEqualTo($expectedData2);
    // and these should fail
    try {
        $expectedData3 = 1;
开发者ID:datasift,项目名称:storyplayer,代码行数:31,代码来源:30b-CanAssertDoubleIsLessThanOrEqualToAnIntegerStory.php


示例8: newStoryFor

<?php

// ========================================================================
//
// STORY DETAILS
//
// ------------------------------------------------------------------------
$story = newStoryFor('Storyplayer')->inGroup(['Modules', 'AssertsString'])->called('Can check that a string does not end with a given suffix');
$story->requiresStoryplayerVersion(2);
// ========================================================================
//
// STORY SETUP / TEAR-DOWN
//
// ------------------------------------------------------------------------
// ========================================================================
//
// POSSIBLE ACTION(S)
//
// ------------------------------------------------------------------------
$story->addAction(function () {
    $checkpoint = getCheckpoint();
    // these should pass
    $stringData = "filename.json";
    assertsString($stringData)->doesNotEndWith("name");
    $stringData = "filename.json";
    assertsString($stringData)->doesNotEndWith(".jso");
    $stringData = "filename.json";
    assertsString($stringData)->doesNotEndWith("file");
    // and these should fail
    try {
        $stringData = "hello, Storyplayer";
开发者ID:datasift,项目名称:storyplayer,代码行数:31,代码来源:60b-CanAssertStringDoesNotEndWithGivenSuffixStory.php


示例9: newStoryFor

<?php

// ========================================================================
//
// STORY DETAILS
//
// ------------------------------------------------------------------------
$story = newStoryFor('Storyplayer')->inGroup(['Modules', 'AssertsInteger'])->called('Can check that an integer is greater than or equal to a double');
$story->requiresStoryplayerVersion(2);
// ========================================================================
//
// STORY SETUP / TEAR-DOWN
//
// ------------------------------------------------------------------------
// ========================================================================
//
// POSSIBLE ACTION(S)
//
// ------------------------------------------------------------------------
$story->addAction(function () {
    $checkpoint = getCheckpoint();
    // these should pass
    $actualData = 2;
    $expectedData1 = 1.0;
    assertsInteger($actualData)->isGreaterThanOrEqualTo($expectedData1);
    $actualData = 2;
    $expectedData2 = 2.0;
    assertsInteger($actualData)->isGreaterThanOrEqualTo($expectedData2);
    // and these should fail
    try {
        $expectedData3 = 3.0;
开发者ID:datasift,项目名称:storyplayer,代码行数:31,代码来源:40b-CanAssertIntegerIsGreaterThanOrEqualToADoubleStory.php


示例10: newStoryFor

<?php

// ========================================================================
//
// STORY DETAILS
//
// ------------------------------------------------------------------------
$story = newStoryFor('Storyplayer')->inGroup('Modules')->called('AssertsArray: Can check that array contains a given key');
$story->requiresStoryplayerVersion(2);
// ========================================================================
//
// STORY SETUP / TEAR-DOWN
//
// ------------------------------------------------------------------------
// ========================================================================
//
// POSSIBLE ACTION(S)
//
// ------------------------------------------------------------------------
$story->addAction(function () {
    $checkpoint = getCheckpoint();
    // this should pass
    $testData = ["alpha" => "a", "bravo" => "b", "charlie" => "c", "delta" => "d"];
    assertsArray($testData)->hasKey("alpha");
    // and this should fail
    $checkpoint->test2Exception = false;
    try {
        assertsArray($testData)->hasKey("zulu");
    } catch (Exception $e) {
        $checkpoint->test2Exception = true;
    }
开发者ID:datasift,项目名称:storyplayer,代码行数:31,代码来源:10b-CanAssertArrayContainsKeyStory.php


示例11: newStoryFor

<?php

// ========================================================================
//
// STORY DETAILS
//
// ------------------------------------------------------------------------
$story = newStoryFor("Storyplayer")->inGroup(["Modules", "Browser"])->called('Can open remote web page');
$story->requiresStoryplayerVersion(2);
// ========================================================================
//
// STORY SETUP / TEAR-DOWN
//
// ------------------------------------------------------------------------
// ========================================================================
//
// PRE-TEST PREDICTION
//
// ------------------------------------------------------------------------
// ========================================================================
//
// PRE-TEST INSPECTION
//
// ------------------------------------------------------------------------
// ========================================================================
//
// POSSIBLE ACTION(S)
//
// ------------------------------------------------------------------------
$story->addAction(function () {
    // get the checkpoint, to store data in
开发者ID:datasift,项目名称:storyplayer,代码行数:31,代码来源:CanOpenRemoteWebPageStory.php


示例12: newStoryFor

<?php

// ========================================================================
//
// STORY DETAILS
//
// ------------------------------------------------------------------------
$story = newStoryFor('Storyplayer')->inGroup(['Modules', 'AssertsInteger'])->called('Can check that two integers are equal');
$story->requiresStoryplayerVersion(2);
// ========================================================================
//
// STORY SETUP / TEAR-DOWN
//
// ------------------------------------------------------------------------
// ========================================================================
//
// POSSIBLE ACTION(S)
//
// ------------------------------------------------------------------------
$story->addAction(function () {
    $checkpoint = getCheckpoint();
    // this should pass
    $expectedData1 = 1;
    $actualData1 = 1;
    assertsInteger($actualData1)->equals($expectedData1);
    // and these should fail
    try {
        $expectedData2 = 2;
        assertsInteger($actualData1)->equals($expectedData2);
    } catch (Exception $e) {
        $checkpoint->test2Passed = true;
开发者ID:datasift,项目名称:storyplayer,代码行数:31,代码来源:40b-CanAssertTwoIntegersAreEqualStory.php


示例13: newStoryFor

<?php

// ========================================================================
//
// STORY DETAILS
//
// ------------------------------------------------------------------------
$story = newStoryFor('Storyplayer')->inGroup(['Modules', 'AssertsBoolean'])->called('Can check that a boolean is not null');
$story->requiresStoryplayerVersion(2);
// ========================================================================
//
// STORY SETUP / TEAR-DOWN
//
// ------------------------------------------------------------------------
// ========================================================================
//
// POSSIBLE ACTION(S)
//
// ------------------------------------------------------------------------
$story->addAction(function () {
    $checkpoint = getCheckpoint();
    $checkpoint->test3Passed = false;
    // this should pass
    $testData1 = true;
    assertsBoolean($testData1)->isNotNull();
    $testData2 = false;
    assertsBoolean($testData2)->isNotNull();
    // these should all fail
    $testData3 = null;
    try {
        assertsBoolean($testData3)->isNotNull();
开发者ID:datasift,项目名称:storyplayer,代码行数:31,代码来源:20b-CanAssertBooleanIsNotNullStory.php


示例14: newStoryFor

<?php

// ========================================================================
//
// STORY DETAILS
//
// ------------------------------------------------------------------------
$story = newStoryFor('Storyplayer')->inGroup('Stories > Checkpoint')->called('Each story starts with empty checkpoint (pt 1)');
$story->requiresStoryplayerVersion(2);
// ========================================================================
//
// TEST SETUP / TEARDOWN
//
// ------------------------------------------------------------------------
$story->addTestSetup(function () {
    // do nothing
});
// ========================================================================
//
// POSSIBLE ACTION(S)
//
// ------------------------------------------------------------------------
$story->addAction(function () {
    $checkpoint = getCheckpoint();
    $checkpoint->thisDataShouldDisappearInPt2 = true;
});
// ========================================================================
//
// POST-TEST INSPECTION
//
// ------------------------------------------------------------------------
开发者ID:datasift,项目名称:storyplayer,代码行数:31,代码来源:01a-EachStoryStartsWithEmptyCheckpointStory.php


示例15: newStoryFor

<?php

// ========================================================================
//
// STORY DETAILS
//
// ------------------------------------------------------------------------
$story = newStoryFor('Storyplayer')->inGroup(['Modules', 'AssertsObject'])->called('Can check that an object has an attribute with a given value');
$story->requiresStoryplayerVersion(2);
// ========================================================================
//
// STORY SETUP / TEAR-DOWN
//
// ------------------------------------------------------------------------
// ========================================================================
//
// POSSIBLE ACTION(S)
//
// ------------------------------------------------------------------------
$story->addAction(function () {
    $checkpoint = getCheckpoint();
    // we'll use this in our comparisons
    $actualData = new stdClass();
    $actualData->attribute1 = null;
    $actualData->attribute2 = [];
    $actualData->attribute3 = true;
    $actualData->attribute4 = false;
    $actualData->attribute5 = 0.0;
    $actualData->attribute6 = 3.1415927;
    $actualData->attribute7 = 0;
    $actualData->attribute8 = 99;
开发者ID:datasift,项目名称:storyplayer,代码行数:31,代码来源:50b-CanAssertObjectHasAnAttributeWithAGivenValueStory.php


示例16: newStoryFor

<?php

// ========================================================================
//
// STORY DETAILS
//
// ------------------------------------------------------------------------
$story = newStoryFor('Storyplayer')->inGroup('Modules')->called('AssertsArray: Can check that two complex arrays are equal');
$story->requiresStoryplayerVersion(2);
// ========================================================================
//
// STORY SETUP / TEAR-DOWN
//
// ------------------------------------------------------------------------
// ========================================================================
//
// POSSIBLE ACTION(S)
//
// ------------------------------------------------------------------------
$story->addAction(function () {
    $checkpoint = getCheckpoint();
    // this should pass
    $testData1 = ["alpha" => "a", "bravo" => "b", "charlie" => "c", "delta" => "d", "echo" => [1, 2, 3, 4, 5]];
    $testData2 = ["alpha" => "a", "bravo" => "b", "charlie" => "c", "delta" => "d", "echo" => [1, 2, 3, 4, 5]];
    assertsArray($testData1)->equals($testData2);
    // and this should fail
    $testData3 = [1];
    $checkpoint->test2Exception = false;
    try {
        assertsArray($testData3)->equals($testData1);
    } catch (Exception $e) {
开发者ID:datasift,项目名称:storyplayer,代码行数:31,代码来源:10b-CanAssertTwoComplexArraysAreEqualStory.php


示例17: newStoryFor

<?php

// ========================================================================
//
// STORY DETAILS
//
// ------------------------------------------------------------------------
$story = newStoryFor('Storyplayer')->inGroup(['Modules', 'AssertsObject'])->called('Can check that an object is an instance of a given class');
$story->requiresStoryplayerVersion(2);
// ========================================================================
//
// STORY SETUP / TEAR-DOWN
//
// ------------------------------------------------------------------------
// ========================================================================
//
// POSSIBLE ACTION(S)
//
// ------------------------------------------------------------------------
$story->addAction(function () use($story) {
    $checkpoint = getCheckpoint();
    // these should pass
    assertsObject($story)->isInstanceOf('DataSift\\Storyplayer\\PlayerLib\\Story');
    assertsObject($checkpoint)->isInstanceOf('DataSift\\Storyplayer\\PlayerLib\\Story_Checkpoint');
    // and this should fail
    try {
        assertsObject($story)->isInstanceOf('Prose\\Prose');
    } catch (Exception $e) {
        $checkpoint->test1Passed = true;
    }
});
开发者ID:datasift,项目名称:storyplayer,代码行数:31,代码来源:50b-CanAssertObjectIsInstanceOfGivenClassStory.php


示例18: newStoryFor

<?php

// ========================================================================
//
// STORY DETAILS
//
// ------------------------------------------------------------------------
$story = newStoryFor('Storyplayer')->inGroup(['Modules', 'AssertsObject'])->called('Can check that two simple objects are the same');
$story->requiresStoryplayerVersion(2);
// ========================================================================
//
// STORY SETUP / TEAR-DOWN
//
// ------------------------------------------------------------------------
// ========================================================================
//
// POSSIBLE ACTION(S)
//
// ------------------------------------------------------------------------
$story->addAction(function () {
    $checkpoint = getCheckpoint();
    // we'll use this in our comparisons
    $actualData = new stdClass();
    $actualData->attribute1 = "hello";
    $actualData->attribute2 = "world";
    // this should pass
    $expectedData1 = $actualData;
    assertsObject($actualData)->isSameAs($expectedData1);
    // and these should fail
    try {
        $expectedData2 = new stdClass();
开发者ID:datasift,项目名称:storyplayer,代码行数:31,代码来源:50b-CanAssertTwoSimpleObjectsAreTheSameStory.php


示例19: newStoryFor

<?php

// ========================================================================
//
// STORY DETAILS
//
// ------------------------------------------------------------------------
$story = newStoryFor('Storyplayer')->inGroup('Config')->called('Can get system-under-test storySettings');
$story->requiresStoryplayerVersion(2);
// ========================================================================
//
// POSSIBLE ACTION(S)
//
// ------------------------------------------------------------------------
$story->addAction(function () {
    // nothing to do
});
// ========================================================================
//
// POST-TEST INSPECTION
//
// ------------------------------------------------------------------------
$story->addPostTestInspection(function () {
    $storySettings = fromSystemUnderTest()->getStorySetting('testData');
    assertsObject($storySettings)->isNotNull();
    assertsObject($storySettings)->hasAttribute('name');
    assertsObject($storySettings)->hasAttribute('version');
    assertsObject($storySettings)->hasAttribute('isStorySettings');
});
开发者ID:datasift,项目名称:storyplayer,代码行数:29,代码来源:CanGetSystemUnderTestStorySettingsStory.php


示例20: newStoryFor

<?php

// ========================================================================
//
// STORY DETAILS
//
// ------------------------------------------------------------------------
$story = newStoryFor('Storyplayer')->inGroup(['Modules', 'AssertsInteger'])->called('Can check that an integer is null');
$story->requiresStoryplayerVersion(2);
// ========================================================================
//
// STORY SETUP / TEAR-DOWN
//
// ------------------------------------------------------------------------
// ========================================================================
//
// POSSIBLE ACTION(S)
//
// ------------------------------------------------------------------------
$story->addAction(function () {
    $checkpoint = getCheckpoint();
    // this should pass
    $nullData = null;
    assertsInteger($nullData)->isNull();
    // and these should fail
    try {
        $doubleData = 1.1;
        assertsInteger($doubleData)->isNull();
    } catch (Exception $e) {
        $checkpoint->doubleTestPassed = true;
    }
开发者ID:datasift,项目名称:storyplayer,代码行数:31,代码来源:40b-CanAssertIntegerIsNullStory.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP newUser函数代码示例发布时间:2022-05-15
下一篇:
PHP newObject函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap