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


PHP assertsObject函数代码示例

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


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

示例1: 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

示例2: getCheckpoint

    $checkpoint = getCheckpoint();
    // load our test page
    usingBrowser()->gotoPage("file://" . __DIR__ . '/../../testpages/WorkingWithWindows.html');
    // get the h1
    $checkpoint->mainHeader = fromBrowser()->getText()->fromHeadingWithId('storyplayer_working_with_windows');
    // open the second window
    usingBrowser()->click()->linkWithText('open a second window');
    // switch to the second window
    usingBrowser()->switchToWindow("Storyplayer: Second Window");
    // get the h1
    $checkpoint->secondHeader = fromBrowser()->getText()->fromHeadingWithId('storyplayer_second_window');
    // close the second window
    // this leaves the browser in a bit of a state
    usingBrowser()->closeCurrentWindow();
    // switch back to the first window
    usingBrowser()->switchToWindow("Storyplayer: Working With Windows");
});
// ========================================================================
//
// POST-TEST INSPECTION
//
// ------------------------------------------------------------------------
$story->addPostTestInspection(function () {
    // get the checkpoint
    $checkpoint = getCheckpoint();
    // do we have the content we expected?
    assertsObject($checkpoint)->hasAttribute('mainHeader');
    assertsString($checkpoint->mainHeader)->equals("Storyplayer: Working With Windows");
    assertsObject($checkpoint)->hasAttribute('secondHeader');
    assertsString($checkpoint->secondHeader)->equals("Storyplayer: Second Window");
});
开发者ID:datasift,项目名称:storyplayer,代码行数:31,代码来源:CanSwitchBrowserWindowsStory.php

示例3: assertsObject

        $checkpoint->test108Passed = true;
    }
    try {
        assertsObject($actualData)->hasAttributeWithValue('attribute11', 99);
    } catch (Exception $e) {
        $checkpoint->test109Passed = true;
    }
    try {
        assertsObject($actualData)->hasAttributeWithValue('attribute11', $checkpoint);
    } catch (Exception $e) {
        $checkpoint->test110Passed = true;
    }
    try {
        assertsObject($actualData)->hasAttributeWithValue('attribute11', "");
    } catch (Exception $e) {
        $checkpoint->test111Passed = true;
    }
});
// ========================================================================
//
// POST-TEST INSPECTION
//
// ------------------------------------------------------------------------
$story->addPostTestInspection(function () {
    $checkpoint = getCheckpoint();
    for ($x = 1; $x <= 111; $x++) {
        $attributeName = "test{$x}Passed";
        assertsObject($checkpoint)->hasAttribute($attributeName);
        assertsBoolean($checkpoint->{$attributeName})->equals(true);
    }
});
开发者ID:datasift,项目名称:storyplayer,代码行数:31,代码来源:50b-CanAssertObjectHasAnAttributeWithAGivenValueStory.php

示例4: newStoryFor

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

示例5: assertsString

    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";
        assertsString($stringData)->doesNotEndWith("player");
    } catch (Exception $e) {
        $checkpoint->test1Passed = true;
    }
    try {
        $stringData = "filename.json";
        assertsString($stringData)->doesNotEndWith(".json");
    } catch (Exception $e) {
        $checkpoint->test2Passed = true;
    }
});
// ========================================================================
//
// POST-TEST INSPECTION
//
// ------------------------------------------------------------------------
$story->addPostTestInspection(function () {
    $checkpoint = getCheckpoint();
    for ($i = 1; $i <= 2; $i++) {
        $attribute = "test{$i}Passed";
        assertsObject($checkpoint)->hasAttributeWithValue($attribute, true);
    }
});
开发者ID:datasift,项目名称:storyplayer,代码行数:31,代码来源:60b-CanAssertStringDoesNotEndWithGivenSuffixStory.php

示例6: getCheckpoint

// ------------------------------------------------------------------------
// ========================================================================
//
// 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) {
        $checkpoint->test2Exception = true;
    }
});
// ========================================================================
//
// POST-TEST INSPECTION
//
// ------------------------------------------------------------------------
$story->addPostTestInspection(function () {
    $checkpoint = getCheckpoint();
    assertsObject($checkpoint)->hasAttribute("test2Exception");
    assertsBoolean($checkpoint->test2Exception)->isTrue();
});
开发者ID:datasift,项目名称:storyplayer,代码行数:31,代码来源:10b-CanAssertTwoComplexArraysAreEqualStory.php

示例7: assertsDouble

    try {
        $stringData = "";
        assertsDouble($stringData)->isDouble();
    } catch (Exception $e) {
        $checkpoint->stringTestPassed = true;
    }
});
// ========================================================================
//
// POST-TEST INSPECTION
//
// ------------------------------------------------------------------------
$story->addPostTestInspection(function () {
    $checkpoint = getCheckpoint();
    assertsObject($checkpoint)->hasAttribute("nullTestPassed");
    assertsBoolean($checkpoint->nullTestPassed)->isTrue();
    assertsObject($checkpoint)->hasAttribute("arrayTestPassed");
    assertsBoolean($checkpoint->arrayTestPassed)->isTrue();
    assertsObject($checkpoint)->hasAttribute("booleanTest1Passed");
    assertsBoolean($checkpoint->booleanTest1Passed)->isTrue();
    assertsObject($checkpoint)->hasAttribute("booleanTest2Passed");
    assertsBoolean($checkpoint->booleanTest2Passed)->isTrue();
    assertsObject($checkpoint)->hasAttribute("intTest1Passed");
    assertsBoolean($checkpoint->intTest1Passed)->isTrue();
    assertsObject($checkpoint)->hasAttribute("intTest2Passed");
    assertsBoolean($checkpoint->intTest2Passed)->isTrue();
    assertsObject($checkpoint)->hasAttribute("objectTestPassed");
    assertsBoolean($checkpoint->objectTestPassed)->isTrue();
    assertsObject($checkpoint)->hasAttribute("stringTestPassed");
    assertsBoolean($checkpoint->stringTestPassed)->isTrue();
});
开发者ID:datasift,项目名称:storyplayer,代码行数:31,代码来源:30a-CanAssertIsDoubleStory.php

示例8: fromUsers

    $checkpoint->expectedData = "new test data";
});
$story->addTestTeardown(function () {
    $test1 = fromUsers()->getUser("test1");
    if (isset($test1->extraData)) {
        unset($test1->extraData);
    }
});
// ========================================================================
//
// POSSIBLE ACTION(S)
//
// ------------------------------------------------------------------------
$story->addAction(function () {
    $checkpoint = getCheckpoint();
    $test1 = fromUsers()->getUser("test1");
    assertsObject($test1)->doesNotHaveAttribute("extraData");
    $test1->extraData = $checkpoint->expectedData;
});
// ========================================================================
//
// POST-TEST INSPECTION
//
// ------------------------------------------------------------------------
$story->addPostTestInspection(function ($st) {
    $checkpoint = getCheckpoint();
    $test1 = fromUsers()->getUser("test1");
    assertsObject($test1)->isObject();
    assertsObject($test1)->hasAttribute("extraData");
    assertsString($test1->extraData)->equals($checkpoint->expectedData);
});
开发者ID:datasift,项目名称:storyplayer,代码行数:31,代码来源:UserDataChangesPersistAcrossPhasesStory.php

示例9: getCheckpoint

// ========================================================================
//
// POSSIBLE ACTION(S)
//
// ------------------------------------------------------------------------
$story->addAction(function () {
    // get the checkpoint, to store data in
    $checkpoint = getCheckpoint();
    // load our test page
    usingBrowser()->gotoPage("file://" . __DIR__ . '/../../testpages/WorkingWithIFrames.html');
    // get a h1
    $checkpoint->mainHeader = fromBrowser()->getText()->fromHeadingWithId('storyplayer_working_with_iframes');
    // switch to the iFrame
    usingBrowser()->switchToIframe('iframe1');
    // get the h1 now
    $checkpoint->iFrameHeader = fromBrowser()->getText()->fromHeadingWithId('storyplayer_working_with_iframes');
});
// ========================================================================
//
// POST-TEST INSPECTION
//
// ------------------------------------------------------------------------
$story->addPostTestInspection(function () {
    // get the checkpoint
    $checkpoint = getCheckpoint();
    // do we have the content we expected?
    assertsObject($checkpoint)->hasAttribute('mainHeader');
    assertsString($checkpoint->mainHeader)->equals("Storyplayer: Working With IFrames");
    assertsObject($checkpoint)->hasAttribute('iFrameHeader');
    assertsString($checkpoint->iFrameHeader)->equals("IFrame Content");
});
开发者ID:datasift,项目名称:storyplayer,代码行数:31,代码来源:CanSeeInsideIFramesStory.php

示例10: newStoryFor

<?php

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

示例11: getCheckpoint

// STORY SETUP / TEAR-DOWN
//
// ------------------------------------------------------------------------
// ========================================================================
//
// POSSIBLE ACTION(S)
//
// ------------------------------------------------------------------------
$story->addAction(function () {
    $checkpoint = getCheckpoint();
    // this should pass
    $objectData = new stdClass();
    assertsObject($objectData)->isNotNull();
    // and these should fail
    try {
        $nullData = null;
        assertsObject($nullData)->isNotNull();
    } catch (Exception $e) {
        $checkpoint->nullTestPassed = true;
    }
});
// ========================================================================
//
// POST-TEST INSPECTION
//
// ------------------------------------------------------------------------
$story->addPostTestInspection(function () {
    $checkpoint = getCheckpoint();
    assertsObject($checkpoint)->hasAttribute("nullTestPassed");
    assertsBoolean($checkpoint->nullTestPassed)->isTrue();
});
开发者ID:datasift,项目名称:storyplayer,代码行数:31,代码来源:50b-CanAssertObjectIsNotNullStory.php

示例12: expectsUuid

    // do we have the UUID extension installed?
    expectsUuid()->requirementsAreMet();
});
// ========================================================================
//
// PRE-TEST INSPECTION
//
// ------------------------------------------------------------------------
// ========================================================================
//
// POSSIBLE ACTION(S)
//
// ------------------------------------------------------------------------
$story->addAction(function () {
    // get the checkpoint, to store data in
    $checkpoint = getCheckpoint();
    // create a UUID
    $checkpoint->uuid = fromUuid()->generateUuid();
});
// ========================================================================
//
// POST-TEST INSPECTION
//
// ------------------------------------------------------------------------
$story->addPostTestInspection(function () {
    // get the checkpoint
    $checkpoint = getCheckpoint();
    // do we have the content we expected?
    assertsObject($checkpoint)->hasAttribute('uuid');
    assertsString($checkpoint->uuid)->isUuid();
});
开发者ID:datasift,项目名称:storyplayer,代码行数:31,代码来源:CanGenerateUuidsUsingPeclExtensionStory.php

示例13: newStoryFor

// ========================================================================
//
// STORY DETAILS
//
// ------------------------------------------------------------------------
$story = newStoryFor('Storyplayer')->inGroup('Modules')->called('Users: Has loaded test users file');
$story->requiresStoryplayerVersion(2);
// ========================================================================
//
// POSSIBLE ACTION(S)
//
// ------------------------------------------------------------------------
$story->addAction(function () {
    // no op
});
// ========================================================================
//
// POST-TEST INSPECTION
//
// ------------------------------------------------------------------------
$story->addPostTestInspection(function ($st) {
    $test1 = fromUsers()->getUser("test1");
    $test2 = fromUsers()->getUser("test2");
    assertsObject($test1)->isObject();
    assertsObject($test1)->hasAttribute("username");
    assertsString($test1->username)->equals("test 1");
    assertsObject($test2)->isObject();
    assertsObject($test2)->hasAttribute("username");
    assertsString($test2->username)->equals("test 2");
});
开发者ID:datasift,项目名称:storyplayer,代码行数:30,代码来源:HasLoadedTestUsersFileStory.php

示例14: getCheckpoint

// ------------------------------------------------------------------------
// ========================================================================
//
// PRE-TEST INSPECTION
//
// ------------------------------------------------------------------------
// ========================================================================
//
// POSSIBLE ACTION(S)
//
// ------------------------------------------------------------------------
$story->addAction(function () {
    // get the checkpoint, to store data in
    $checkpoint = getCheckpoint();
    // load our test page
    usingBrowser()->gotoPage("file://" . __DIR__ . '/../../testpages/WorkingWithForms.html');
    // get a field from a form
    $checkpoint->field1 = fromForm("test_form")->getValue()->fieldLabelled('Page Name');
});
// ========================================================================
//
// POST-TEST INSPECTION
//
// ------------------------------------------------------------------------
$story->addPostTestInspection(function () {
    // get the checkpoint
    $checkpoint = getCheckpoint();
    // do we have the title we expected?
    assertsObject($checkpoint)->hasAttribute('field1');
    assertsString($checkpoint->field1)->equals("Storyplayer: Working With Forms");
});
开发者ID:datasift,项目名称:storyplayer,代码行数:31,代码来源:CanRetrieveFormFieldByItsLabelStory.php

示例15: getCheckpoint

// ========================================================================
//
// 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();
    } catch (Exception $e) {
        $checkpoint->test3Passed = true;
    }
});
// ========================================================================
//
// POST-TEST INSPECTION
//
// ------------------------------------------------------------------------
$story->addPostTestInspection(function () {
    $checkpoint = getCheckpoint();
    assertsObject($checkpoint)->hasAttribute('test3Passed');
    assertsBoolean($checkpoint->test3Passed)->isTrue();
});
开发者ID:datasift,项目名称:storyplayer,代码行数:31,代码来源:20b-CanAssertBooleanIsNotNullStory.php


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