8000 [#6925] Removing more instances of the deprecated getMock() · symfony/symfony-docs@c52839a · GitHub
[go: up one dir, main page]

Skip to content
Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit c52839a

Browse files
committed
[#6925] Removing more instances of the deprecated getMock()
1 parent b669e8a commit c52839a

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

create_framework/unit_testing.rst

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ We are now ready to write our first test::
8989

9090
private function getFrameworkForException($exception)
9191
{
92-
$matcher = $this->getMock('Symfony\Component\Routing\Matcher\UrlMatcherInterface');
92+
$matcher = $this->createMock('Symfony\Component\Routing\Matcher\UrlMatcherInterface');
9393
$matcher
9494
->expects($this->once())
9595
->method('match')
@@ -98,9 +98,9 @@ We are now ready to write our first test::
9898
$matcher
9999
->expects($this->once())
100100
->method('getContext')
101-
->will($this->returnValue($this->getMock('Symfony\Component\Routing\RequestContext')))
101+
->will($this->returnValue($this->createMock('Symfony\Component\Routing\RequestContext')))
102102
;
103-
$resolver = $this->getMock('Symfony\Component\HttpKernel\Controller\ControllerResolverInterface');
103+
$resolver = $this->createMock('Symfony\Component\HttpKernel\Controller\ControllerResolverInterface');
104104

105105
return new Framework($matcher, $resolver);
106106
}
@@ -144,7 +144,7 @@ Response::
144144

145145
public function testControllerResponse()
146146
{
147-
$matcher = $this->getMock('Symfony\Component\Routing\Matcher\UrlMatcherInterface');
147+
$matcher = $this->createMock('Symfony\Component\Routing\Matcher\UrlMatcherInterface');
148148
$matcher
149149
->expects($this->once())
150150
->method('match')
@@ -159,7 +159,7 @@ Response::
159159
$matcher
160160
->expects($this->once())
161161
->method('getContext')
162-
->will($this->returnValue($this->getMock('Symfony\Component\Routing\RequestContext')))
162+
->will($this->returnValue($this->createMock('Symfony\Component\Routing\RequestContext')))
163163
;
164164
$resolver = new ControllerResolver();
165165

form/unit_testing.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ allows you to return a list of extensions to register::
185< C8F6 code>185
{
186186
protected function getExtensions()
187187
{
188-
$validator = $this->getMock('\Symfony\Component\Validator\Validator\ValidatorInterface');
188+
$validator = $this->createMock('\Symfony\Component\Validator\Validator\ValidatorInterface');
189189
$validator->method('validate')->will($this->returnValue(new ConstraintViolationList()));
190190

191191
return array(

testing/database.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ it's easy to pass a mock object within a test::
6666
public function testCalculateTotalSalary()
6767
{
6868
// First, mock the object to be used in the test
69-
$employee = $this->getMock('\AppBundle\Entity\Employee');
69+
$employee = $this->createMock('\AppBundle\Entity\Employee');
7070
$employee->expects($this->once())
7171
->method('getSalary')
7272
->will($this->returnValue(1000));

0 commit comments

Comments
 (0)
0