diff --git a/Tests/Config/Resource/TranslationManagerResourceTest.php b/Tests/Config/Resource/TranslationManagerResourceTest.php index de04919..b4fdd9a 100644 --- a/Tests/Config/Resource/TranslationManagerResourceTest.php +++ b/Tests/Config/Resource/TranslationManagerResourceTest.php @@ -59,14 +59,9 @@ public function testToString() private function createDatabaseLoader() { - $this->databaseLoader = $this->getMock( - '\Asm\TranslationLoaderBundle\Translation\DatabaseLoader', - array( - 'isFresh' - ), - array(), - '', - false - ); + $this->databaseLoader = $this->getMockBuilder('\Asm\TranslationLoaderBundle\Translation\DatabaseLoader') + ->disableOriginalConstructor() + ->setMethods(array('isFresh')) + ->getMock(); } } diff --git a/Tests/DependencyInjection/Compiler/AddResourcePassTest.php b/Tests/DependencyInjection/Compiler/AddResourcePassTest.php index 13d0190..16e32cf 100644 --- a/Tests/DependencyInjection/Compiler/AddResourcePassTest.php +++ b/Tests/DependencyInjection/Compiler/AddResourcePassTest.php @@ -95,10 +95,9 @@ public function testMultipleLocalesWithMultipleDomains() public function testWithoutTranslator() { - $container = $this->getMock( - '\Symfony\Component\DependencyInjection\ContainerBuilder', - array('getParameter', 'findDefinition') - ); + $container = $this->getMockBuilder('\Symfony\Component\DependencyInjection\ContainerBuilder') + ->setMethods(array('getParameter', 'findDefinition')) + ->getMock(); $container ->expects($this->once()) ->method('findDefinition') @@ -115,10 +114,9 @@ public function testWithoutTranslator() public function testWithoutTranslatorAndWithoutLocales() { - $container = $this->getMock( - '\Symfony\Component\DependencyInjection\ContainerBuilder', - array('getParameter', 'findDefinition') - ); + $container = $this->getMockBuilder('\Symfony\Component\DependencyInjection\ContainerBuilder') + ->setMethods(array('getParameter', 'findDefinition')) + ->getMock(); $container ->expects($this->once()) ->method('findDefinition') @@ -137,11 +135,10 @@ public function testWithoutTranslatorAndWithoutLocales() */ private function createContainer() { - $container = $this->getMock( - '\Symfony\Component\DependencyInjection\ContainerBuilder', - array('getParameter', 'findDefinition') - ); - $this->translator = $this->getMock('\Symfony\Component\DependencyInjection\Definition'); + $container = $this->getMockBuilder('\Symfony\Component\DependencyInjection\ContainerBuilder') + ->setMethods(array('getParameter', 'findDefinition')) + ->getMock(); + $this->translator = $this->getMockBuilder('\Symfony\Component\DependencyInjection\Definition')->getMock(); $container ->expects($this->any()) ->method('findDefinition') diff --git a/Tests/Doctrine/TranslationHistoryManagerTest.php b/Tests/Doctrine/TranslationHistoryManagerTest.php index 203af9c..8dd7e7b 100644 --- a/Tests/Doctrine/TranslationHistoryManagerTest.php +++ b/Tests/Doctrine/TranslationHistoryManagerTest.php @@ -89,19 +89,15 @@ public function testUpdateTranslationHistoryAndClear() private function createRepository() { - $this->repository = $this->getMock( - 'Doctrine\ORM\EntityRepository', - array(), - array(), - '', - false - ); + $this->repository = $this->getMockBuilder('Doctrine\ORM\EntityRepository') + ->disableOriginalConstructor() + ->getMock(); } private function createObjectManager() { $this->createRepository(); - $this->objectManager = $this->getMock('Doctrine\Common\Persistence\ObjectManager'); + $this->objectManager = $this->getMockBuilder('Doctrine\Common\Persistence\ObjectManager')->getMock(); $this->objectManager ->expects($this->any()) ->method('getRepository') @@ -113,6 +109,6 @@ private function createObjectManager() */ private function createTranslationHistory() { - return $this->getMock('Asm\TranslationLoaderBundle\Entity\TranslationHistory'); + return $this->getMockBuilder('Asm\TranslationLoaderBundle\Entity\TranslationHistory')->getMock(); } } diff --git a/Tests/Doctrine/TranslationManagerTest.php b/Tests/Doctrine/TranslationManagerTest.php index 618c43c..6b8d3dc 100644 --- a/Tests/Doctrine/TranslationManagerTest.php +++ b/Tests/Doctrine/TranslationManagerTest.php @@ -172,19 +172,15 @@ protected function createNonFreshTranslation() private function createRepository() { - $this->repository = $this->getMock( - 'Doctrine\ORM\EntityRepository', - array(), - array(), - '', - false - ); + $this->repository = $this->getMockBuilder('Doctrine\ORM\EntityRepository') + ->disableOriginalConstructor() + ->getMock(); } private function createObjectManager() { $this->createRepository(); - $this->objectManager = $this->getMock('Doctrine\Common\Persistence\ObjectManager'); + $this->objectManager = $this->getMockBuilder('Doctrine\Common\Persistence\ObjectManager')->getMock(); $this->objectManager ->expects($this->any()) ->method('getRepository') @@ -196,6 +192,6 @@ private function createObjectManager() */ private function createTranslation() { - return $this->getMock('Asm\TranslationLoaderBundle\Entity\Translation'); + return $this->getMockBuilder('Asm\TranslationLoaderBundle\Entity\Translation')->getMock(); } } diff --git a/Tests/EventListener/TranslationHistorySubscriberTest.php b/Tests/EventListener/TranslationHistorySubscriberTest.php index a080c4a..2d2cbe0 100644 --- a/Tests/EventListener/TranslationHistorySubscriberTest.php +++ b/Tests/EventListener/TranslationHistorySubscriberTest.php @@ -110,7 +110,7 @@ public function updateHistoryProvider() */ private function createTranslationHistoryManager() { - $manager = $this->getMock('Asm\TranslationLoaderBundle\Model\TranslationHistoryManagerInterface'); + $manager = $this->getMockBuilder('Asm\TranslationLoaderBundle\Model\TranslationHistoryManagerInterface')->getMock(); $manager ->expects($this->any()) ->method('createTranslationHistory') @@ -132,7 +132,7 @@ private function createAnonymousSecurityContext() */ private function createAuthenticatedSecurityContext() { - $token = $this->getMock('Symfony\Component\Security\Core\Authentication\Token\TokenInterface'); + $token = $this->getMockBuilder('Symfony\Component\Security\Core\Authentication\Token\TokenInterface')->getMock(); $token ->expects($this->any()) ->method('getUsername') @@ -160,9 +160,9 @@ private function createRandomDummyTranslation() private function mockTokenStorage() { if (interface_exists('Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface')) { - return $this->getMock('Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface'); + return $this->getMockBuilder('Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface')->getMock(); } else { - return $this->getMock('Symfony\Component\Security\Core\SecurityContextInterface'); + return $this->getMockBuilder('Symfony\Component\Security\Core\SecurityContextInterface')->getMock(); } } } diff --git a/Tests/Model/TranslationManagerTest.php b/Tests/Model/TranslationManagerTest.php index 7ed611f..94c479e 100644 --- a/Tests/Model/TranslationManagerTest.php +++ b/Tests/Model/TranslationManagerTest.php @@ -32,7 +32,7 @@ abstract class TranslationManagerTest extends \PHPUnit_Framework_TestCase protected function setUp() { - $this->eventDispatcher = $this->getMock('Symfony\Component\EventDispatcher\EventDispatcherInterface'); + $this->eventDispatcher = $this->getMockBuilder('Symfony\Component\EventDispatcher\EventDispatcherInterface')->getMock(); $this->translationManager = $this->createTranslationManager(); } diff --git a/Tests/Translation/DatabaseLoaderTest.php b/Tests/Translation/DatabaseLoaderTest.php index b15cffb..64be0e3 100644 --- a/Tests/Translation/DatabaseLoaderTest.php +++ b/Tests/Translation/DatabaseLoaderTest.php @@ -107,13 +107,9 @@ public function testGetResource() private function createTranslationManager() { - $this->translationManager = $this->getMock( - 'Asm\TranslationLoaderBundle\Model\TranslationManager', - array(), - array(), - '', - false - ); + $this->translationManager = $this->getMockBuilder('Asm\TranslationLoaderBundle\Model\TranslationManager') + ->disableOriginalConstructor() + ->getMock(); $this->translationManager ->expects($this->once()) ->method('findTranslationsByLocaleAndDomain')