Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions spec/SM/StateMachine/StateMachineSpec.php
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,16 @@ function it_returns_current_object($object)
$this->getObject()->shouldReturn($object);
}

function it_returns_current_config()
{
$this->getConfig()->shouldReturn($this->config);
}

function it_returns_current_config_item()
{
$this->getConfig('graph')->shouldReturn($this->config['graph']);
}

function it_returns_possible_transitions($object, $callbackFactory, CallbackInterface $guard)
{
$object->getState()->shouldBeCalled()->willReturn('checkout');
Expand Down
11 changes: 11 additions & 0 deletions src/SM/StateMachine/StateMachine.php
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,17 @@ public function getObject()
return $this->object;
}

/**
* {@inheritDoc}
*/
public function getConfig($key = null)
{
if ($key == null) {
return $this->config;
}
return $this->config[$key];
}

/**
* {@inheritDoc}
*/
Expand Down
7 changes: 7 additions & 0 deletions src/SM/StateMachine/StateMachineInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,13 @@ public function getState();
*/
public function getObject();

/**
* Returns the whole config
*
* @return object
*/
public function getConfig($key = null);

/**
* Returns the current graph
*
Expand Down