dox Executable Documentation

Migrater

Single step

Given the step 'OnlyOne'
When I start the migration
Then the new state should be 'OnlyOne'
Then the executed steps should be array('OnlyOneUp')

Two steps

Given the step 'StepOneOfTwo' with the next step 'StepTwoOfTwo'
Given the step 'StepTwoOfTwo'
When I start the migration
Then the new state should be 'StepTwoOfTwo'
Then the executed steps should be array('StepOneOfTwoUp', 'StepTwoOfTwoUp')

With state

Given the current state is 'WithStateTwo'
Given the step 'WithStateOne' with the next step 'WithStateTwo'
Given the step 'WithStateTwo' with the next step 'WithStateThree'
Given the step 'WithStateThree' with the next step 'WithStateFour'
Given the step 'WithStateFour'
When I start the migration
Then the new state should be 'WithStateFour'
Then the executed steps should be array('WithStateThreeUp', 'WithStateFourUp')

Migrate up to target

Given the step 'TargetOne' with the next step 'TargetTwo'
Given the step 'TargetTwo' with the next step 'TargetThree'
Given the step 'TargetThree'
When I start the migration to 'TargetTwo'
Then the new state should be 'TargetTwo'
Then the executed steps should be array('TargetOneUp', 'TargetTwoUp')

Target is current state

Given the current state is 'SameStateTwo'
Given the step 'SameStateOne' with the next step 'SameStateTwo'
Given the step 'SameStateTwo' with the next step 'SameStateThree'
Given the step 'SameStateThree'
When I start the migration to 'SameStateTwo'
Then the new state should be 'SameStateTwo'
Then the executed steps should be array()

Migrate down

Given the current state is 'DownThree'
Given the step 'DownOne' with the next step 'DownTwo'
Given the step 'DownTwo' with the next step 'DownThree'
Given the step 'DownThree'
When I start the migration to 'DownOne'
Then the new state should be 'DownOne'
Then the executed steps should be array('DownThreeDown', 'DownTwoDown')

Impossible down migration

Given the current state is 'ImpossibleThree'
Given the step 'ImpossibleOne' with the next step 'ImpossibleTwo'
Given the step 'ImpossibleTwo' with the next step 'ImpossibleThree' which cannot be undone
Given the step 'ImpossibleThree'
When I try to migration to 'ImpossibleOne'
Then an exception containing 'Cannot migrate down. Step [ImpossibleTwo] cannot be undone.' should be thrown

Invalid state

Given the current state is 'invalid'
Given the step 'InvalidStateOne' with the next step 'InvalidStateTwo'
Given the step 'InvalidStateTwo'
When I try to migration to 'InvalidStateTwo'
Then an exception containing 'Cannot migrate. Invalid state: [invalid]' should be thrown

Invalid target

Given the current state is 'InvalidTargetOne'
Given the step 'InvalidTargetOne' with the next step 'InvalidTargetTwo'
Given the step 'InvalidTargetTwo'
When I try to migration to 'NonExisting'
Then an exception containing 'Cannot migrate. Invalid target: [NonExisting]' should be thrown

Circular steps

Given the step 'CircularOne' with the next step 'CircularTwo'
Given the step 'CircularTwo' with the next step 'CircularThree'
Given the step 'CircularThree' with the next step 'CircularOne'
When I try to migration to 'CircularThree'
Then an exception containing 'Circular step detected: [CircularThree]' should be thrown