PHP Класс DataSift\Storyplayer\PlayerLib\Story

Автор: Stuart Herbert ([email protected])
Показать файл Открыть проект Примеры использования класса

Защищенные свойства (Protected)

Свойство Тип Описание
$actionsCallbacks array this is an array of callbacks. Each callback is a single set of actions to execute the story. Each callback is an alternative way to execute the story. Each callback is meant to be equivalent; ie they achieve the same thing, just in different ways. If any of the callbacks has different outcomes, then they belong in separate user stories. NO EXCEPTIONS. This is a fundamental assumption of Storyplayer; ignore it, and Storyplayer's no use to you!
$category string the category that this story belongs to
$compatibleVersion integer you HAVE to set this in your story, otherwise we will skip your story
$deviceSetupCallback array the function that provides any story-specific setup work that happens when we start a device
$deviceTeardownCallback array the function that provides any story-specific teardown work that happens just before we stop a device
$group array the group that this story belongs to
$hintsCallback callable the function that provides hints about how this story changes the state of the system or user
$name string the name of this story
$params array the parameters that get passed into virtual machines et al, and which can be overridden on the command-line
$parserTrees array the raw parser tree of this story, and of any templates that we use
$perPhaseSetupCallback array the function that provides any story-specific setup work that happens before each phase of the test
$perPhaseTeardownCallback array the function that provides any story-specific teardown work that happens at the end of each phase of the test
$persistDevice boolean does the story want the test device kept open between phases?
$postTestInspectionCallback array the callback used to see if the action *did* change the state of the system under test
$preTestInspectionCallback array the callback used to remember the state of the system *before* the action occurs
$preTestPredictionCallback array the callback that dynamically determines in advance whether the story actions should succeed or fail
$reportTestResultsCallback array the callback that dynamically determines afterwards whether or not the story actions actually did succeed
$requiredTestEnvRoles array a list of the roles that the test environment must have defined, otherwise we cannot run
$roleChangesCallback array the function that provides information about how this story has changed the state of the system or user
$storyFilename string the file that contains the story
$storyResult Story_Result what happened to this story?
$storyTemplates array a list of the StoryTemplates that this story is based on. can be empty
$testCanRunCheckCallback array the function that checks to see if the test should run at all, or should be skipped
$testSetupCallback array the function that provides any story-specific setup work
$testTeardownCallback array the function that provides any story-specific teardown action
$whitelistedEnvironments by default, a story is allowed to run on all environments, *but* if an environment's config sets 'mustBeWhitelisted' to TRUE, then the story is only allowed to run on that environment if the story declares itself safe to run we believe that this is the safest approach to handling those stories that simply aren't safe to run absolutely everywhere

Открытые методы

Метод Описание
__toString ( ) : string return a string representation of the story, for things like logging
addAction ( $newCallback ) : void
addActions ( $newCallback ) : void
addDeviceSetup ( $newCallback ) : void
addDeviceTeardown ( $newCallback ) : void
addHints ( $newCallback ) : void
addPerPhaseSetup ( $newCallback ) : void
addPerPhaseTeardown ( $newCallback ) : void
addPostTestInspection ( $newCallback ) : void
addPreTestInspection ( $newCallback ) : void
addPreTestPrediction ( $newCallback ) : void
addTestCanRunCheck ( $newCallback ) : void
addTestEnvironmentSetup ( $newCallback )
addTestEnvironmentTeardown ( $newCallback )
addTestSetup ( $newCallback )
addTestTeardown ( $newCallback ) : void
addValidRole ( $role ) --------------------------------------------------------------------
andOn ( $envName ) : Story
andValidRole ( $role ) Synonym for addValidRole()
basedOn ( StoryTemplate $tmpl ) : Story set up any templated methods from a predefined class
called ( $userStoryText ) : Story
determineStoryFilename ( ) : void
generateGroup ( ) : Story Set the group name as the file system path of the directory where the test is located
generateName ( ) : Story Set the name as the filename of the test
getCategory ( ) : string Get the category that this story belongs to
getDeviceSetup ( ) : array get the callback for device setup work
getDeviceTeardown ( ) : array get the callback for device teardown work
getGroup ( ) : array Get the group that this story belongs to
getGroupAsString ( ) : string return the story's group as a printable string
getHints ( ) : callable get the hints callback
getName ( ) : string Get the name of this story
getOneAction ( ) : callable pick one action at random, and return it to the caller
getParams ( ) : array
getPerPhaseSetup ( ) : array get the callback for per-phase setup work
getPerPhaseTeardown ( ) : array get the callback for per-phase teardown work
getPersistDevice ( ) : boolean does this story want to keep the web browser open between phases?
getPostTestInspection ( ) : array get the callback to use to work out the test results
getPreTestInspection ( ) : array get the callback to use to perform the preflight checkpoint
getPreTestPrediction ( ) : array get the callback to use to perform the preflight checks
getRequiredStoryplayerVersion ( ) : integer
getRequiredTestEnvironmentRoles ( ) : array
getResult ( ) : Story_Result
getRoleChanges ( ) get the role changes callback
getStoryFilename ( ) : string
getStoryTemplates ( ) : array get a list of the templates that this story is based on, in order or precedence
getTestCanRunCheck ( ) : array get the callback which allows the story to be skipped
getTestSetup ( ) : array get the callback for per-story setup work
getTestTeardown ( ) : array get the callback for post-story teardown work
getWhitelistedEnvironments ( ) : array
hasActions ( ) : boolean does this story have any actions?
hasDeviceSetup ( ) : boolean do we have a device setup callback?
hasDeviceTeardown ( ) : boolean do we have a device teardown callback?
hasHints ( ) : boolean have any hints been set?
hasPerPhaseSetup ( ) : boolean do we have a per-phase setup callback?
hasPerPhaseTeardown ( ) : boolean do we have a per-phase teardown callback?
hasPostTestInspection ( ) : boolean
hasPreTestInspection ( ) : boolean do we have a callback
hasPreTestPrediction ( ) : boolean do we have a callback
hasRole ( $roleName )
hasRoleChanges ( ) has the role changes callback been set?
hasTestCanRunCheck ( ) : boolean do we have a 'check story can run' callback?
hasTestSetup ( ) : boolean do we have a pre-story setup callback?
hasTestTeardown ( ) : boolean do we have a post-story teardown callback?
inGroup ( array | string $groupName ) : Story which group of tests does this story belong to?
requiresStoryplayerVersion ( $version ) : Story
requiresTestEnvironmentWithRoles ( $roles ) : void
runsOn ( $envName ) : Story
setCategory ( string $newCategory ) : Story Set the category that this story belongs to
setDefaultCallbacks ( ) : void
setGroup ( array $newGroup ) : Story Set the group that this story belongs to
setHints ( $newCallback ) : void
setName ( string $newName ) : Story Set the name of this story
setParams ( array $defaults ) Set the parameters for this story
setPersistDevice ( ) tell Storyplayer to keep the web browser open between test phases
setRoleChanges ( $newCallback )
setTestEnvironmentSetup ( $newCallback ) --------------------------------------------------------------------
setTestEnvironmentTeardown ( $newCallback )

Описание методов

__toString() публичный Метод

return a string representation of the story, for things like logging
public __toString ( ) : string
Результат string

addAction() публичный Метод

public addAction ( $newCallback ) : void
Результат void

addActions() публичный Метод

public addActions ( $newCallback ) : void
Результат void

addDeviceSetup() публичный Метод

public addDeviceSetup ( $newCallback ) : void
Результат void

addDeviceTeardown() публичный Метод

public addDeviceTeardown ( $newCallback ) : void
Результат void

addHints() публичный Метод

public addHints ( $newCallback ) : void
Результат void

addPerPhaseSetup() публичный Метод

public addPerPhaseSetup ( $newCallback ) : void
Результат void

addPerPhaseTeardown() публичный Метод

public addPerPhaseTeardown ( $newCallback ) : void
Результат void

addPostTestInspection() публичный Метод

public addPostTestInspection ( $newCallback ) : void
Результат void

addPreTestInspection() публичный Метод

public addPreTestInspection ( $newCallback ) : void
Результат void

addPreTestPrediction() публичный Метод

public addPreTestPrediction ( $newCallback ) : void
Результат void

addTestCanRunCheck() публичный Метод

public addTestCanRunCheck ( $newCallback ) : void
Результат void

addTestEnvironmentSetup() публичный Метод

public addTestEnvironmentSetup ( $newCallback )

addTestEnvironmentTeardown() публичный Метод

public addTestEnvironmentTeardown ( $newCallback )

addTestSetup() публичный Метод

public addTestSetup ( $newCallback )

addTestTeardown() публичный Метод

public addTestTeardown ( $newCallback ) : void
Результат void

addValidRole() публичный Метод

--------------------------------------------------------------------
public addValidRole ( $role )

andOn() публичный Метод

public andOn ( $envName ) : Story
Результат Story

andValidRole() публичный Метод

Synonym for addValidRole()
См. также: Story::addValidRole
public andValidRole ( $role )

basedOn() публичный Метод

set up any templated methods from a predefined class
public basedOn ( StoryTemplate $tmpl ) : Story
$tmpl StoryTemplate
Результат Story

called() публичный Метод

public called ( $userStoryText ) : Story
Результат Story

determineStoryFilename() публичный Метод

public determineStoryFilename ( ) : void
Результат void

generateGroup() публичный Метод

Set the group name as the file system path of the directory where the test is located
public generateGroup ( ) : Story
Результат Story $this for fluent interface

generateName() публичный Метод

Set the name as the filename of the test
public generateName ( ) : Story
Результат Story $this for fluent interface

getCategory() публичный Метод

Systems under test can grow to encompass hundreds, if not thousands of user stories. To make this manageable at scale, we break down each user story like this: Name : Starts as a free user with 10 USD in credit Category: Billing User Stories Group : User States The 'name' is the summary text of the user story itself, which should be no longer than a single sentence, please. The 'category' is the general group that the user story belongs to. These are the top-level groups, such as 'Registration', 'Billing' and so forth. The 'group' is the specific group _inside_ the category that the user story belongs to. The groups are specific to the category.
public getCategory ( ) : string
Результат string the category that this story belongs to

getDeviceSetup() публичный Метод

get the callback for device setup work
public getDeviceSetup ( ) : array
Результат array

getDeviceTeardown() публичный Метод

get the callback for device teardown work
public getDeviceTeardown ( ) : array
Результат array

getGroup() публичный Метод

Systems under test can grow to encompass hundreds, if not thousands of user stories. To make this manageable at scale, we break down each user story like this: Name : Starts as a free user with 10 USD in credit Category: Billing User Stories Group : User States The 'name' is the summary text of the user story itself, which should be no longer than a single sentence, please. The 'category' is the general group that the user story belongs to. These are the top-level groups, such as 'Registration', 'Billing' and so forth. The 'group' is the specific group _inside_ the category that the user story belongs to. The groups are specific to the category.
public getGroup ( ) : array
Результат array

getGroupAsString() публичный Метод

return the story's group as a printable string
public getGroupAsString ( ) : string
Результат string

getHints() публичный Метод

get the hints callback
public getHints ( ) : callable
Результат callable

getName() публичный Метод

Systems under test can grow to encompass hundreds, if not thousands of user stories. To make this manageable at scale, we break down each user story like this: Name : Starts as a free user with 10 USD in credit Category: Billing User Stories Group : User States The 'name' is the summary text of the user story itself, which should be no longer than a single sentence, please. The 'category' is the general group that the user story belongs to. These are the top-level groups, such as 'Registration', 'Billing' and so forth. The 'group' is the specific group _inside_ the category that the user story belongs to. The groups are specific to the category.
public getName ( ) : string
Результат string the name of this story

getOneAction() публичный Метод

pick one action at random, and return it to the caller
public getOneAction ( ) : callable
Результат callable

getParams() публичный Метод

public getParams ( ) : array
Результат array

getPerPhaseSetup() публичный Метод

get the callback for per-phase setup work
public getPerPhaseSetup ( ) : array
Результат array

getPerPhaseTeardown() публичный Метод

get the callback for per-phase teardown work
public getPerPhaseTeardown ( ) : array
Результат array

getPersistDevice() публичный Метод

does this story want to keep the web browser open between phases?
public getPersistDevice ( ) : boolean
Результат boolean

getPostTestInspection() публичный Метод

get the callback to use to work out the test results
public getPostTestInspection ( ) : array
Результат array

getPreTestInspection() публичный Метод

get the callback to use to perform the preflight checkpoint
public getPreTestInspection ( ) : array
Результат array

getPreTestPrediction() публичный Метод

get the callback to use to perform the preflight checks
public getPreTestPrediction ( ) : array
Результат array

getRequiredStoryplayerVersion() публичный Метод

public getRequiredStoryplayerVersion ( ) : integer
Результат integer

getRequiredTestEnvironmentRoles() публичный Метод

public getRequiredTestEnvironmentRoles ( ) : array
Результат array

getResult() публичный Метод

public getResult ( ) : Story_Result
Результат Story_Result

getRoleChanges() публичный Метод

get the role changes callback
public getRoleChanges ( )

getStoryFilename() публичный Метод

public getStoryFilename ( ) : string
Результат string

getStoryTemplates() публичный Метод

can be empty
public getStoryTemplates ( ) : array
Результат array

getTestCanRunCheck() публичный Метод

get the callback which allows the story to be skipped
public getTestCanRunCheck ( ) : array
Результат array

getTestSetup() публичный Метод

get the callback for per-story setup work
public getTestSetup ( ) : array
Результат array

getTestTeardown() публичный Метод

get the callback for post-story teardown work
public getTestTeardown ( ) : array
Результат array

getWhitelistedEnvironments() публичный Метод

public getWhitelistedEnvironments ( ) : array
Результат array

hasActions() публичный Метод

does this story have any actions?
public hasActions ( ) : boolean
Результат boolean true if this story has any actions

hasDeviceSetup() публичный Метод

do we have a device setup callback?
public hasDeviceSetup ( ) : boolean
Результат boolean true if there is a device setup callback

hasDeviceTeardown() публичный Метод

do we have a device teardown callback?
public hasDeviceTeardown ( ) : boolean
Результат boolean true if there is a device teardown callback

hasHints() публичный Метод

have any hints been set?
public hasHints ( ) : boolean
Результат boolean true if the callback has been set

hasPerPhaseSetup() публичный Метод

do we have a per-phase setup callback?
public hasPerPhaseSetup ( ) : boolean
Результат boolean true if there is a per-phase setup callback

hasPerPhaseTeardown() публичный Метод

do we have a per-phase teardown callback?
public hasPerPhaseTeardown ( ) : boolean
Результат boolean true if there is a per-phase teardown callback

hasPostTestInspection() публичный Метод

public hasPostTestInspection ( ) : boolean
Результат boolean

hasPreTestInspection() публичный Метод

do we have a callback
public hasPreTestInspection ( ) : boolean
Результат boolean [description]

hasPreTestPrediction() публичный Метод

do we have a callback
public hasPreTestPrediction ( ) : boolean
Результат boolean [description]

hasRole() публичный Метод

public hasRole ( $roleName )

hasRoleChanges() публичный Метод

has the role changes callback been set?
public hasRoleChanges ( )

hasTestCanRunCheck() публичный Метод

do we have a 'check story can run' callback?
public hasTestCanRunCheck ( ) : boolean
Результат boolean true if the callback exists

hasTestSetup() публичный Метод

do we have a pre-story setup callback?
public hasTestSetup ( ) : boolean
Результат boolean true if there is a pre-story setup callback

hasTestTeardown() публичный Метод

do we have a post-story teardown callback?
public hasTestTeardown ( ) : boolean
Результат boolean true if there is a post-story teardown callback

inGroup() публичный Метод

which group of tests does this story belong to?
public inGroup ( array | string $groupName ) : Story
$groupName array | string the group to use
Результат Story $this for fluent interface

requiresStoryplayerVersion() публичный Метод

public requiresStoryplayerVersion ( $version ) : Story
Результат Story

requiresTestEnvironmentWithRoles() публичный Метод

public requiresTestEnvironmentWithRoles ( $roles ) : void
Результат void

runsOn() публичный Метод

public runsOn ( $envName ) : Story
Результат Story

setCategory() публичный Метод

Systems under test can grow to encompass hundreds, if not thousands of user stories. To make this manageable at scale, we break down each user story like this: Name : Starts as a free user with 10 USD in credit Category: Billing User Stories Group : User States The 'name' is the summary text of the user story itself, which should be no longer than a single sentence, please. The 'category' is the general group that the user story belongs to. These are the top-level groups, such as 'Registration', 'Billing' and so forth. The 'group' is the specific group _inside_ the category that the user story belongs to. The groups are specific to the category.
public setCategory ( string $newCategory ) : Story
$newCategory string the category that this story belongs to
Результат Story $this

setDefaultCallbacks() публичный Метод

public setDefaultCallbacks ( ) : void
Результат void

setGroup() публичный Метод

Systems under test can grow to encompass hundreds, if not thousands of user stories. To make this manageable at scale, we break down each user story like this: Name : Starts as a free user with 10 USD in credit Category: Billing User Stories Group : User States The 'name' is the summary text of the user story itself, which should be no longer than a single sentence, please. The 'category' is the general group that the user story belongs to. These are the top-level groups, such as 'Registration', 'Billing' and so forth. The 'group' is the specific group _inside_ the category that the user story belongs to. The groups are specific to the category.
public setGroup ( array $newGroup ) : Story
$newGroup array
Результат Story $this

setHints() публичный Метод

public setHints ( $newCallback ) : void
Результат void

setName() публичный Метод

Systems under test can grow to encompass hundreds, if not thousands of user stories. To make this manageable at scale, we break down each user story like this: Name : Starts as a free user with 10 USD in credit Category: Billing User Stories Group : User States The 'name' is the summary text of the user story itself, which should be no longer than a single sentence, please. The 'category' is the general group that the user story belongs to. These are the top-level groups, such as 'Registration', 'Billing' and so forth. The 'group' is the specific group _inside_ the category that the user story belongs to. The groups are specific to the category.
public setName ( string $newName ) : Story
$newName string the name of this story
Результат Story $this

setParams() публичный Метод

Parameters are a way of passing settings between Stories and StoryTemplates. Order of precedence: 1) Story 2) StoryTemplates (in 'basedOn()' order) (templates cannot override each other)
public setParams ( array $defaults )
$defaults array a list of the parameters for this story

setPersistDevice() публичный Метод

by default, we close the browser after every phase, to make sure that the next phase always starts with a browser in a known state
public setPersistDevice ( )

setRoleChanges() публичный Метод

public setRoleChanges ( $newCallback )

setTestEnvironmentSetup() публичный Метод

--------------------------------------------------------------------
public setTestEnvironmentSetup ( $newCallback )

setTestEnvironmentTeardown() публичный Метод

public setTestEnvironmentTeardown ( $newCallback )

Описание свойств

$actionsCallbacks защищенное свойство

this is an array of callbacks. Each callback is a single set of actions to execute the story. Each callback is an alternative way to execute the story. Each callback is meant to be equivalent; ie they achieve the same thing, just in different ways. If any of the callbacks has different outcomes, then they belong in separate user stories. NO EXCEPTIONS. This is a fundamental assumption of Storyplayer; ignore it, and Storyplayer's no use to you!
protected array $actionsCallbacks
Результат array

$category защищенное свойство

the category that this story belongs to
protected string $category
Результат string

$compatibleVersion защищенное свойство

you HAVE to set this in your story, otherwise we will skip your story
protected int $compatibleVersion
Результат integer

$deviceSetupCallback защищенное свойство

the function that provides any story-specific setup work that happens when we start a device
protected array $deviceSetupCallback
Результат array

$deviceTeardownCallback защищенное свойство

the function that provides any story-specific teardown work that happens just before we stop a device
protected array $deviceTeardownCallback
Результат array

$group защищенное свойство

the group that this story belongs to
protected array $group
Результат array

$hintsCallback защищенное свойство

the function that provides hints about how this story changes the state of the system or user
protected callable $hintsCallback
Результат callable

$name защищенное свойство

the name of this story
protected string $name
Результат string

$params защищенное свойство

the parameters that get passed into virtual machines et al, and which can be overridden on the command-line
protected array $params
Результат array

$parserTrees защищенное свойство

the raw parser tree of this story, and of any templates that we use
protected array $parserTrees
Результат array

$perPhaseSetupCallback защищенное свойство

the function that provides any story-specific setup work that happens before each phase of the test
protected array $perPhaseSetupCallback
Результат array

$perPhaseTeardownCallback защищенное свойство

the function that provides any story-specific teardown work that happens at the end of each phase of the test
protected array $perPhaseTeardownCallback
Результат array

$persistDevice защищенное свойство

does the story want the test device kept open between phases?
protected bool $persistDevice
Результат boolean

$postTestInspectionCallback защищенное свойство

the callback used to see if the action *did* change the state of the system under test
protected array $postTestInspectionCallback
Результат array

$preTestInspectionCallback защищенное свойство

the callback used to remember the state of the system *before* the action occurs
protected array $preTestInspectionCallback
Результат array

$preTestPredictionCallback защищенное свойство

the callback that dynamically determines in advance whether the story actions should succeed or fail
protected array $preTestPredictionCallback
Результат array

$reportTestResultsCallback защищенное свойство

the callback that dynamically determines afterwards whether or not the story actions actually did succeed
protected array $reportTestResultsCallback
Результат array

$requiredTestEnvRoles защищенное свойство

a list of the roles that the test environment must have defined, otherwise we cannot run
protected array $requiredTestEnvRoles
Результат array

$roleChangesCallback защищенное свойство

the function that provides information about how this story has changed the state of the system or user
protected array $roleChangesCallback
Результат array

$storyFilename защищенное свойство

the file that contains the story
protected string $storyFilename
Результат string

$storyResult защищенное свойство

what happened to this story?
protected Story_Result,DataSift\Storyplayer\PlayerLib $storyResult
Результат Story_Result

$storyTemplates защищенное свойство

a list of the StoryTemplates that this story is based on. can be empty
protected array $storyTemplates
Результат array

$testCanRunCheckCallback защищенное свойство

the function that checks to see if the test should run at all, or should be skipped
protected array $testCanRunCheckCallback
Результат array

$testSetupCallback защищенное свойство

the function that provides any story-specific setup work
protected array $testSetupCallback
Результат array

$testTeardownCallback защищенное свойство

the function that provides any story-specific teardown action
protected array $testTeardownCallback
Результат array

$whitelistedEnvironments защищенное свойство

by default, a story is allowed to run on all environments, *but* if an environment's config sets 'mustBeWhitelisted' to TRUE, then the story is only allowed to run on that environment if the story declares itself safe to run we believe that this is the safest approach to handling those stories that simply aren't safe to run absolutely everywhere
protected $whitelistedEnvironments