-
Notifications
You must be signed in to change notification settings - Fork 126
Expand file tree
/
Copy pathFormFlowUtilTest.php
More file actions
70 lines (51 loc) · 1.73 KB
/
Copy pathFormFlowUtilTest.php
File metadata and controls
70 lines (51 loc) · 1.73 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
<?php
namespace Craue\FormFlowBundle\Tests\Util;
use Craue\FormFlowBundle\Tests\UnitTestCase;
use Craue\FormFlowBundle\Util\FormFlowUtil;
/**
* @group unit
*
* @author Christian Raue <christian.raue@gmail.com>
* @copyright 2011-2015 Christian Raue
* @license http://opensource.org/licenses/mit-license.php MIT License
*/
class FormFlowUtilTest extends UnitTestCase {
/**
* @var FormFlowUtil
*/
protected $util;
/**
* {@inheritDoc}
*/
protected function setUp() {
$this->util = new FormFlowUtil();
}
public function testAddRouteParameters() {
$flow = $this->getFlowWithMockedMethods(array('getName', 'loadStepsConfig'));
$flow
->expects($this->once())
->method('loadStepsConfig')
->will($this->returnValue(array(
array(),
array(),
)))
;
$instanceId = 'xyz';
$flow->setInstanceId($instanceId);
$flow->nextStep();
$actualParameters = $this->util->addRouteParameters(array('key' => 'value'), $flow);
$this->assertEquals(array('key' => 'value', 'instance' => $instanceId, 'step' => 1), $actualParameters);
}
public function testAddRouteParameters_explicitStepNumber() {
$flow = $this->getFlowWithMockedMethods(array('getName'));
$instanceId = 'xyz';
$flow->setInstanceId($instanceId);
$actualParameters = $this->util->addRouteParameters(array('key' => 'value'), $flow, 5);
$this->assertEquals(array('key' => 'value', 'instance' => $instanceId, 'step' => 5), $actualParameters);
}
public function testRemoveRouteParameters() {
$flow = $this->getFlowWithMockedMethods(array('getName'));
$actualParameters = $this->util->removeRouteParameters(array('key' => 'value', 'instance' => 'xyz', 'step' => 2), $flow);
$this->assertEquals(array('key' => 'value'), $actualParameters);
}
}