diff --git a/create_framework/unit_testing.rst b/create_framework/unit_testing.rst index 82efc2f0fef..3a852745141 100644 --- a/create_framework/unit_testing.rst +++ b/create_framework/unit_testing.rst @@ -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') @@ -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); } @@ -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') @@ -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(); diff --git a/form/unit_testing.rst b/form/unit_testing.rst index 3638a9f7cac..b5302a446c5 100644 --- a/form/unit_testing.rst +++ b/form/unit_testing.rst @@ -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( diff --git a/testing/database.rst b/testing/database.rst index b252cfc0640..5eeb90ffd00 100644 --- a/testing/database.rst +++ b/testing/database.rst @@ -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));