Skip to content

Commit 326817f

Browse files
committed
removed some duplicate code in tests
1 parent 2e2c900 commit 326817f

File tree

2 files changed

+9
-17
lines changed

2 files changed

+9
-17
lines changed

Tests/Form/FormFlowBcMethodsTest.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ class FormFlowBcMethodsTest extends UnitTestCase {
2020
private $deprecatedMessage = 'Method Craue\FormFlowBundle\Form\FormFlow::%s is deprecated since version 2.0. Use method %s instead.';
2121

2222
public function testBcMethodDelegation_getCurrentStep() {
23-
$flow = $this->getMock('\Craue\FormFlowBundle\Form\FormFlow', array('getName', 'getCurrentStepNumber'));
23+
$flow = $this->getFlowWithMockedMethods(array('getName', 'getCurrentStepNumber'));
2424

2525
$flow
2626
->expects($this->once())
@@ -33,7 +33,7 @@ public function testBcMethodDelegation_getCurrentStep() {
3333
}
3434

3535
public function testBcMethodDelegation_getCurrentStepDescription() {
36-
$flow = $this->getMock('\Craue\FormFlowBundle\Form\FormFlow', array('getName', 'getCurrentStepLabel'));
36+
$flow = $this->getFlowWithMockedMethods(array('getName', 'getCurrentStepLabel'));
3737

3838
$flow
3939
->expects($this->once())
@@ -46,7 +46,7 @@ public function testBcMethodDelegation_getCurrentStepDescription() {
4646
}
4747

4848
public function testBcMethodDelegation_getMaxSteps() {
49-
$flow = $this->getMock('\Craue\FormFlowBundle\Form\FormFlow', array('getName', 'getStepCount'));
49+
$flow = $this->getFlowWithMockedMethods(array('getName', 'getStepCount'));
5050

5151
$flow
5252
->expects($this->once())
@@ -59,7 +59,7 @@ public function testBcMethodDelegation_getMaxSteps() {
5959
}
6060

6161
public function testBcMethodDelegation_getStepDescriptions() {
62-
$flow = $this->getMock('\Craue\FormFlowBundle\Form\FormFlow', array('getName', 'getStepLabels'));
62+
$flow = $this->getFlowWithMockedMethods(array('getName', 'getStepLabels'));
6363

6464
$flow
6565
->expects($this->once())
@@ -72,7 +72,7 @@ public function testBcMethodDelegation_getStepDescriptions() {
7272
}
7373

7474
public function testBcMethodDelegation_getFirstStep() {
75-
$flow = $this->getMock('\Craue\FormFlowBundle\Form\FormFlow', array('getName', 'getFirstStepNumber'));
75+
$flow = $this->getFlowWithMockedMethods(array('getName', 'getFirstStepNumber'));
7676

7777
$flow
7878
->expects($this->once())
@@ -85,7 +85,7 @@ public function testBcMethodDelegation_getFirstStep() {
8585
}
8686

8787
public function testBcMethodDelegation_getLastStep() {
88-
$flow = $this->getMock('\Craue\FormFlowBundle\Form\FormFlow', array('getName', 'getLastStepNumber'));
88+
$flow = $this->getFlowWithMockedMethods(array('getName', 'getLastStepNumber'));
8989

9090
$flow
9191
->expects($this->once())
@@ -98,7 +98,7 @@ public function testBcMethodDelegation_getLastStep() {
9898
}
9999

100100
public function testBcMethodDelegation_hasSkipStep() {
101-
$flow = $this->getMock('\Craue\FormFlowBundle\Form\FormFlow', array('getName', 'isStepSkipped'));
101+
$flow = $this->getFlowWithMockedMethods(array('getName', 'isStepSkipped'));
102102

103103
$flow
104104
->expects($this->once())

Tests/Util/FormFlowUtilTest.php

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
namespace Craue\FormFlowBundle\Tests\Util;
44

5-
use Craue\FormFlowBundle\Form\FormFlow;
5+
use Craue\FormFlowBundle\Tests\UnitTestCase;
66
use Craue\FormFlowBundle\Util\FormFlowUtil;
77

88
/**
@@ -12,7 +12,7 @@
1212
* @copyright 2011-2015 Christian Raue
1313
* @license http://opensource.org/licenses/mit-license.php MIT License
1414
*/
15-
class FormFlowUtilTest extends \PHPUnit_Framework_TestCase {
15+
class FormFlowUtilTest extends UnitTestCase {
1616

1717
/**
1818
* @var FormFlowUtil
@@ -67,12 +67,4 @@ public function testRemoveRouteParameters() {
6767
$this->assertEquals(array('key' => 'value'), $actualParameters);
6868
}
6969

70-
/**
71-
* @param string[] $methodNames Names of methods to be mocked.
72-
* @return PHPUnit_Framework_MockObject_MockObject|FormFlow
73-
*/
74-
protected function getFlowWithMockedMethods(array $methodNames) {
75-
return $this->getMock('\Craue\FormFlowBundle\Form\FormFlow', $methodNames);
76-
}
77-
7870
}

0 commit comments

Comments
 (0)