diff --git a/test/src/Tests/Hydrator/DoctrineHydratorTest.php b/test/src/Tests/Hydrator/DoctrineHydratorTest.php index 93895a7..c86b8c5 100644 --- a/test/src/Tests/Hydrator/DoctrineHydratorTest.php +++ b/test/src/Tests/Hydrator/DoctrineHydratorTest.php @@ -3,11 +3,12 @@ namespace PhproTest\DoctrineHydrationModule\Tests\Hydrator; use Phpro\DoctrineHydrationModule\Hydrator\DoctrineHydrator; +use PHPUnit\Framework\TestCase; /** * Class DoctrineHydratorTest. */ -class DoctrineHydratorTest extends \PHPUnit_Framework_TestCase +class DoctrineHydratorTest extends TestCase { /** * @param null $hydrateService @@ -17,8 +18,8 @@ class DoctrineHydratorTest extends \PHPUnit_Framework_TestCase */ protected function createHydrator($hydrateService = null, $extractService = null) { - $hydrateService = $hydrateService ? $hydrateService : $this->getMock('Zend\Hydrator\HydratorInterface'); - $extractService = $extractService ? $extractService : $this->getMock('Zend\Hydrator\HydratorInterface'); + $hydrateService = $hydrateService ? $hydrateService : $this->getMockBuilder('Zend\Hydrator\HydratorInterface')->getMock(); + $extractService = $extractService ? $extractService : $this->getMockBuilder('Zend\Hydrator\HydratorInterface')->getMock(); return new DoctrineHydrator($extractService, $hydrateService); } @@ -57,7 +58,7 @@ public function it_should_extract_an_object() { $object = new \stdClass(); $extracted = array('extracted' => true); - $extractService = $this->getMock('Zend\Hydrator\HydratorInterface'); + $extractService = $this->getMockBuilder('Zend\Hydrator\HydratorInterface')->getMock(); $extractService ->expects($this->any()) ->method('extract') @@ -77,7 +78,7 @@ public function it_should_hydrate_an_object() $object = new \stdClass(); $data = array('field' => 'value'); - $hydrateService = $this->getMock('Zend\Hydrator\HydratorInterface'); + $hydrateService = $this->getMockBuilder('Zend\Hydrator\HydratorInterface')->getMock(); $hydrateService ->expects($this->any()) ->method('hydrate') @@ -98,7 +99,7 @@ public function it_should_use_a_generated_doctrine_hydrator_while_hydrating_an_o $object = new \stdClass(); $data = array('field' => 'value'); - $hydrateService = $this->getMock('Doctrine\ODM\MongoDB\Hydrator\HydratorInterface'); + $hydrateService = $this->getMockBuilder('Doctrine\ODM\MongoDB\Hydrator\HydratorInterface')->getMock(); $hydrateService ->expects($this->any()) ->method('hydrate') diff --git a/test/src/Tests/Hydrator/ODM/MongoDB/DoctrineObjectTest.php b/test/src/Tests/Hydrator/ODM/MongoDB/DoctrineObjectTest.php index c41504d..4f82156 100644 --- a/test/src/Tests/Hydrator/ODM/MongoDB/DoctrineObjectTest.php +++ b/test/src/Tests/Hydrator/ODM/MongoDB/DoctrineObjectTest.php @@ -22,7 +22,9 @@ class DoctrineObjectTest extends BaseTest */ protected function createHydrator($objectManager = null) { - $objectManager = $objectManager ? $objectManager : $this->getMock('Doctrine\ODM\MongoDB\DocumentManager', array(), array(), '', false); + $objectManager = $objectManager ? $objectManager : $this->getMockBuilder('Doctrine\ODM\MongoDB\DocumentManager') + ->disableOriginalConstructor() + ->getMock(); $hydrator = new DoctrineObject($objectManager); return $hydrator; diff --git a/test/src/Tests/Hydrator/ODM/MongoDB/Strategy/DateTimeFieldTest.php b/test/src/Tests/Hydrator/ODM/MongoDB/Strategy/DateTimeFieldTest.php index f82045d..f88e22e 100644 --- a/test/src/Tests/Hydrator/ODM/MongoDB/Strategy/DateTimeFieldTest.php +++ b/test/src/Tests/Hydrator/ODM/MongoDB/Strategy/DateTimeFieldTest.php @@ -3,11 +3,12 @@ namespace PhproTest\DoctrineHydrationModule\Tests\Hydrator\ODM\MongoDB\Strategy; use Phpro\DoctrineHydrationModule\Hydrator\ODM\MongoDB\Strategy\DateTimeField; +use PHPUnit\Framework\TestCase; /** * Class DateTimeFieldTest. */ -class DateTimeFieldTest extends \PHPUnit_Framework_TestCase +class DateTimeFieldTest extends TestCase { /** * @param bool $isTimestamp diff --git a/test/src/Tests/ModuleTest.php b/test/src/Tests/ModuleTest.php index 42453bb..13d5dd2 100644 --- a/test/src/Tests/ModuleTest.php +++ b/test/src/Tests/ModuleTest.php @@ -3,11 +3,12 @@ namespace PhproTest\DoctrineHydrationModule\Tests; use Phpro\DoctrineHydrationModule\Module; +use PHPUnit\Framework\TestCase; /** * Class ModuleTest. */ -class ModuleTest extends \PHPUnit_Framework_TestCase +class ModuleTest extends TestCase { /** * @test diff --git a/test/src/Tests/Service/DoctrineHydratorFactoryTest.php b/test/src/Tests/Service/DoctrineHydratorFactoryTest.php index b0417ee..731e2ce 100644 --- a/test/src/Tests/Service/DoctrineHydratorFactoryTest.php +++ b/test/src/Tests/Service/DoctrineHydratorFactoryTest.php @@ -4,10 +4,11 @@ use PhproTest\DoctrineHydrationModule\Hydrator\CustomBuildHydratorFactory; use Phpro\DoctrineHydrationModule\Service\DoctrineHydratorFactory; +use PHPUnit\Framework\TestCase; use Zend\ServiceManager\ServiceManager; use Zend\Hydrator\HydratorPluginManager; -class DoctrineHydratorFactoryTest extends \PHPUnit_Framework_TestCase +class DoctrineHydratorFactoryTest extends TestCase { /** * @var array @@ -34,9 +35,18 @@ protected function setUp() $this->serviceManager = new ServiceManager(); $this->serviceManager->setAllowOverride(true); $this->serviceManager->setService('config', $this->serviceConfig); - $this->serviceManager->setService('custom.strategy', $this->getMock('Zend\Hydrator\Strategy\StrategyInterface')); - $this->serviceManager->setService('custom.filter', $this->getMock('Zend\Hydrator\Filter\FilterInterface')); - $this->serviceManager->setService('custom.naming_strategy', $this->getMock('Zend\Hydrator\NamingStrategy\NamingStrategyInterface')); + $this->serviceManager->setService( + 'custom.strategy', + $this->getMockBuilder('Zend\Hydrator\Strategy\StrategyInterface')->getMock() + ); + $this->serviceManager->setService( + 'custom.filter', + $this->getMockBuilder('Zend\Hydrator\Filter\FilterInterface')->getMock() + ); + $this->serviceManager->setService( + 'custom.naming_strategy', + $this->getMockBuilder('Zend\Hydrator\NamingStrategy\NamingStrategyInterface')->getMock() + ); $this->hydratorManager = $this->getMockBuilder(HydratorPluginManager::class) ->disableOriginalConstructor() @@ -55,7 +65,9 @@ protected function setUp() */ protected function stubObjectManager($objectManagerClass) { - $objectManager = $this->getMock($objectManagerClass, array(), array(), '', false); + $objectManager = $this->getMockBuilder($objectManagerClass) + ->disableOriginalConstructor() + ->getMock(); $this->serviceManager->setService('doctrine.default.object-manager', $objectManager); return $objectManager; @@ -153,8 +165,10 @@ public function it_should_create_a_custom_ODM_hydrator_which_uses_the_auto_gener $this->serviceManager->setService('config', $this->serviceConfig); $objectManager = $this->stubObjectManager('Doctrine\ODM\MongoDb\DocumentManager'); - $hydratorFactory = $this->getMock('Doctrine\ODM\MongoDB\Hydrator\HydratorFactory', array(), array(), '', false); - $generatedHydrator = $this->getMock('Doctrine\ODM\MongoDB\Hydrator\HydratorInterface'); + $hydratorFactory = $this->getMockBuilder('Doctrine\ODM\MongoDB\Hydrator\HydratorFactory') + ->disableOriginalConstructor() + ->getMock(); + $generatedHydrator = $this->getMockBuilder('Doctrine\ODM\MongoDB\Hydrator\HydratorInterface')->getMock(); $objectManager ->expects($this->any()) @@ -183,7 +197,10 @@ public function it_should_be_possible_to_configure_a_custom_hydrator() $this->serviceConfig['doctrine-hydrator']['custom-hydrator']['hydrator'] = 'custom.hydrator'; $this->serviceManager->setService('config', $this->serviceConfig); - $this->serviceManager->setService('custom.hydrator', $this->getMock('Zend\Hydrator\ArraySerializable')); + $this->serviceManager->setService( + 'custom.hydrator', + $this->getMockBuilder('Zend\Hydrator\ArraySerializable')->getMock() + ); $hydrator = $this->createOrmHydrator();