File tree 3 files changed +7
-7
lines changed
3 files changed +7
-7
lines changed Original file line number Diff line number Diff line change @@ -89,7 +89,7 @@ We are now ready to write our first test::
89
89
90
90
private function getFrameworkForException($exception)
91
91
{
92
- $matcher = $this->getMock ('Symfony\Component\Routing\Matcher\UrlMatcherInterface');
92
+ $matcher = $this->createMock ('Symfony\Component\Routing\Matcher\UrlMatcherInterface');
93
93
$matcher
94
94
->expects($this->once())
95
95
->method('match')
@@ -98,9 +98,9 @@ We are now ready to write our first test::
98
98
$matcher
99
99
->expects($this->once())
100
100
->method('getContext')
101
- ->will($this->returnValue($this->getMock ('Symfony\Component\Routing\RequestContext')))
101
+ ->will($this->returnValue($this->createMock ('Symfony\Component\Routing\RequestContext')))
102
102
;
103
- $resolver = $this->getMock ('Symfony\Component\HttpKernel\Controller\ControllerResolverInterface');
103
+ $resolver = $this->createMock ('Symfony\Component\HttpKernel\Controller\ControllerResolverInterface');
104
104
105
105
return new Framework($matcher, $resolver);
106
106
}
@@ -144,7 +144,7 @@ Response::
144
144
145
145
public function testControllerResponse()
146
146
{
147
- $matcher = $this->getMock ('Symfony\Component\Routing\Matcher\UrlMatcherInterface');
147
+ $matcher = $this->createMock ('Symfony\Component\Routing\Matcher\UrlMatcherInterface');
148
148
$matcher
149
149
->expects($this->once())
150
150
->method('match')
@@ -159,7 +159,7 @@ Response::
159
159
$matcher
160
160
->expects($this->once())
161
161
->method('getContext')
162
- ->will($this->returnValue($this->getMock ('Symfony\Component\Routing\RequestContext')))
162
+ ->will($this->returnValue($this->createMock ('Symfony\Component\Routing\RequestContext')))
163
163
;
164
164
$resolver = new ControllerResolver();
165
165
Original file line number Diff line number Diff line change @@ -185,7 +185,7 @@ allows you to return a list of extensions to register::
185
185
{
186
186
protected function getExtensions()
187
187
{
188
- $validator = $this->getMock ('\Symfony\Component\Validator\Validator\ValidatorInterface');
188
+ $validator = $this->createMock ('\Symfony\Component\Validator\Validator\ValidatorInterface');
189
189
$validator->method('validate')->will($this->returnValue(new ConstraintViolationList()));
190
190
191
191
return array(
Original file line number Diff line number Diff line change @@ -66,7 +66,7 @@ it's easy to pass a mock object within a test::
66
66
public function testCalculateTotalSalary()
67
67
{
68
68
// First, mock the object to be used in the test
69
- $employee = $this->getMock ('\AppBundle\Entity\Employee');
69
+ $employee = $this->createMock ('\AppBundle\Entity\Employee');
70
70
$employee->expects($this->once())
71
71
->method('getSalary')
72
72
->will($this->returnValue(1000));
You can’t perform that action at this time.
0 commit comments