Skip to content

Commit

Permalink
[#6925] Removing more instances of the deprecated getMock()
Browse files Browse the repository at this point in the history
  • Loading branch information
weaverryan committed Sep 18, 2016
1 parent b669e8a commit c52839a
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
10 changes: 5 additions & 5 deletions create_framework/unit_testing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ We are now ready to write our first test::

private function getFrameworkForException($exception)
{
$matcher = $this->getMock('Symfony\Component\Routing\Matcher\UrlMatcherInterface');
$matcher = $this->createMock('Symfony\Component\Routing\Matcher\UrlMatcherInterface');
$matcher
->expects($this->once())
->method('match')
Expand All @@ -98,9 +98,9 @@ We are now ready to write our first test::
$matcher
->expects($this->once())
->method('getContext')
->will($this->returnValue($this->getMock('Symfony\Component\Routing\RequestContext')))
->will($this->returnValue($this->createMock('Symfony\Component\Routing\RequestContext')))
;
$resolver = $this->getMock('Symfony\Component\HttpKernel\Controller\ControllerResolverInterface');
$resolver = $this->createMock('Symfony\Component\HttpKernel\Controller\ControllerResolverInterface');

return new Framework($matcher, $resolver);
}
Expand Down Expand Up @@ -144,7 +144,7 @@ Response::

public function testControllerResponse()
{
$matcher = $this->getMock('Symfony\Component\Routing\Matcher\UrlMatcherInterface');
$matcher = $this->createMock('Symfony\Component\Routing\Matcher\UrlMatcherInterface');
$matcher
->expects($this->once())
->method('match')
Expand All @@ -159,7 +159,7 @@ Response::
$matcher
->expects($this->once())
->method('getContext')
->will($this->returnValue($this->getMock('Symfony\Component\Routing\RequestContext')))
->will($this->returnValue($this->createMock('Symfony\Component\Routing\RequestContext')))
;
$resolver = new ControllerResolver();

Expand Down
2 changes: 1 addition & 1 deletion form/unit_testing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ allows you to return a list of extensions to register::
{
protected function getExtensions()
{
$validator = $this->getMock('\Symfony\Component\Validator\Validator\ValidatorInterface');
$validator = $this->createMock('\Symfony\Component\Validator\Validator\ValidatorInterface');
$validator->method('validate')->will($this->returnValue(new ConstraintViolationList()));

return array(
Expand Down
2 changes: 1 addition & 1 deletion testing/database.rst
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ it's easy to pass a mock object within a test::
public function testCalculateTotalSalary()
{
// First, mock the object to be used in the test
$employee = $this->getMock('\AppBundle\Entity\Employee');
$employee = $this->createMock('\AppBundle\Entity\Employee');
$employee->expects($this->once())
->method('getSalary')
->will($this->returnValue(1000));
Expand Down

0 comments on commit c52839a

Please sign in to comment.