From 0045fc480d69922da035654c195491231509f225 Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Wed, 27 Jan 2021 12:24:50 +0100 Subject: [PATCH] More cleanups and fixes --- .../Tests/Form/DoctrineOrmTypeGuesserTest.php | 2 +- .../SwitchUserTokenProcessorTest.php | 2 +- .../EarlyExpirationDispatcherTest.php | 4 ++-- .../ViolationMapper/ViolationMapperTest.php | 10 ++++---- .../Component/Lock/Tests/LockFactoryTest.php | 4 ++-- src/Symfony/Component/Lock/Tests/LockTest.php | 4 ++-- .../Tests/Transport/ConnectionTest.php | 4 ++-- .../Transport/BeanstalkdReceiverTest.php | 6 ++--- .../Tests/Transport/BeanstalkdSenderTest.php | 6 ++--- .../Redis/Tests/Transport/ConnectionTest.php | 2 +- .../Component/Messenger/Tests/WorkerTest.php | 2 +- .../Controller/UserValueResolverTest.php | 2 +- ...PasswordJsonAuthenticationListenerTest.php | 2 +- .../Semaphore/Tests/SemaphoreFactoryTest.php | 8 +++---- .../Semaphore/Tests/SemaphoreTest.php | 24 +++++++++---------- .../AbstractObjectNormalizerTest.php | 2 +- 16 files changed, 41 insertions(+), 43 deletions(-) diff --git a/src/Symfony/Bridge/Doctrine/Tests/Form/DoctrineOrmTypeGuesserTest.php b/src/Symfony/Bridge/Doctrine/Tests/Form/DoctrineOrmTypeGuesserTest.php index 76f68da02f..652f9d67eb 100644 --- a/src/Symfony/Bridge/Doctrine/Tests/Form/DoctrineOrmTypeGuesserTest.php +++ b/src/Symfony/Bridge/Doctrine/Tests/Form/DoctrineOrmTypeGuesserTest.php @@ -28,7 +28,7 @@ class DoctrineOrmTypeGuesserTest extends TestCase */ public function testTypeGuesser(string $type, $expected) { - $classMetadata = $this->getMockBuilder(ClassMetadata::class)->disableOriginalConstructor()->getMock(); + $classMetadata = $this->createMock(ClassMetadata::class); $classMetadata->fieldMappings['field'] = true; $classMetadata->expects($this->once())->method('getTypeOfField')->with('field')->willReturn($type); diff --git a/src/Symfony/Bridge/Monolog/Tests/Processor/SwitchUserTokenProcessorTest.php b/src/Symfony/Bridge/Monolog/Tests/Processor/SwitchUserTokenProcessorTest.php index 8a71157cca..7107993b9c 100644 --- a/src/Symfony/Bridge/Monolog/Tests/Processor/SwitchUserTokenProcessorTest.php +++ b/src/Symfony/Bridge/Monolog/Tests/Processor/SwitchUserTokenProcessorTest.php @@ -28,7 +28,7 @@ class SwitchUserTokenProcessorTest extends TestCase { $originalToken = new UsernamePasswordToken('original_user', 'password', 'provider', ['ROLE_SUPER_ADMIN']); $switchUserToken = new SwitchUserToken('user', 'passsword', 'provider', ['ROLE_USER'], $originalToken); - $tokenStorage = $this->getMockBuilder(TokenStorageInterface::class)->getMock(); + $tokenStorage = $this->createMock(TokenStorageInterface::class); $tokenStorage->method('getToken')->willReturn($switchUserToken); $processor = new SwitchUserTokenProcessor($tokenStorage); diff --git a/src/Symfony/Component/Cache/Tests/Messenger/EarlyExpirationDispatcherTest.php b/src/Symfony/Component/Cache/Tests/Messenger/EarlyExpirationDispatcherTest.php index 56c505f4b0..4b90d18303 100644 --- a/src/Symfony/Component/Cache/Tests/Messenger/EarlyExpirationDispatcherTest.php +++ b/src/Symfony/Component/Cache/Tests/Messenger/EarlyExpirationDispatcherTest.php @@ -57,7 +57,7 @@ class EarlyExpirationDispatcherTest extends TestCase $reverseContainer = new ReverseContainer($container, new ServiceLocator([])); - $bus = $this->getMockBuilder(MessageBusInterface::class)->getMock(); + $bus = $this->createMock(MessageBusInterface::class); $dispatcher = new EarlyExpirationDispatcher($bus, $reverseContainer); @@ -107,7 +107,7 @@ class EarlyExpirationDispatcherTest extends TestCase $reverseContainer = new ReverseContainer($container, new ServiceLocator([])); $msg = EarlyExpirationMessage::create($reverseContainer, $computationService, $item, $pool); - $bus = $this->getMockBuilder(MessageBusInterface::class)->getMock(); + $bus = $this->createMock(MessageBusInterface::class); $bus->expects($this->once()) ->method('dispatch') ->with($msg) diff --git a/src/Symfony/Component/Form/Tests/Extension/Validator/ViolationMapper/ViolationMapperTest.php b/src/Symfony/Component/Form/Tests/Extension/Validator/ViolationMapper/ViolationMapperTest.php index d636f9fe40..32975f74a5 100644 --- a/src/Symfony/Component/Form/Tests/Extension/Validator/ViolationMapper/ViolationMapperTest.php +++ b/src/Symfony/Component/Form/Tests/Extension/Validator/ViolationMapper/ViolationMapperTest.php @@ -1603,7 +1603,7 @@ class ViolationMapperTest extends TestCase ->disableOriginalConstructor() ->getMock() ; - $translator = $this->getMockBuilder(TranslatorInterface::class)->getMock(); + $translator = $this->createMock(TranslatorInterface::class); $translator->expects($this->any())->method('trans')->willReturnMap([ ['Name', [], null, null, 'Custom Name'], ]); @@ -1630,7 +1630,7 @@ class ViolationMapperTest extends TestCase public function testMessageWithLabel2() { - $translator = $this->getMockBuilder(TranslatorInterface::class)->getMock(); + $translator = $this->createMock(TranslatorInterface::class); $translator->expects($this->any())->method('trans')->willReturnMap([ ['options_label', [], null, null, 'Translated Label'], ]); @@ -1668,7 +1668,7 @@ class ViolationMapperTest extends TestCase public function testMessageWithLabelFormat1() { - $translator = $this->getMockBuilder(TranslatorInterface::class)->getMock(); + $translator = $this->createMock(TranslatorInterface::class); $translator->expects($this->any())->method('trans')->willReturnMap([ ['form.custom', [], null, null, 'Translated 1st Custom Label'], ]); @@ -1706,7 +1706,7 @@ class ViolationMapperTest extends TestCase public function testMessageWithLabelFormat2() { - $translator = $this->getMockBuilder(TranslatorInterface::class)->getMock(); + $translator = $this->createMock(TranslatorInterface::class); $translator->expects($this->any())->method('trans')->willReturnMap([ ['form_custom-id', [], null, null, 'Translated 2nd Custom Label'], ]); @@ -1793,7 +1793,7 @@ class ViolationMapperTest extends TestCase ->disableOriginalConstructor() ->getMock() ; - $translator = $this->getMockBuilder(TranslatorInterface::class)->getMock(); + $translator = $this->createMock(TranslatorInterface::class); $translator->expects($this->never())->method('trans'); $this->mapper = new ViolationMapper($renderer, $translator); diff --git a/src/Symfony/Component/Lock/Tests/LockFactoryTest.php b/src/Symfony/Component/Lock/Tests/LockFactoryTest.php index ea209e6bd3..2437f905b5 100644 --- a/src/Symfony/Component/Lock/Tests/LockFactoryTest.php +++ b/src/Symfony/Component/Lock/Tests/LockFactoryTest.php @@ -54,7 +54,7 @@ class LockFactoryTest extends TestCase public function testCreateLockFromKey() { - $store = $this->getMockBuilder(PersistingStoreInterface::class)->getMock(); + $store = $this->createMock(PersistingStoreInterface::class); $store->expects($this->any())->method('exists')->willReturn(false); $keys = []; @@ -68,7 +68,7 @@ class LockFactoryTest extends TestCase })) ->willReturn(true); - $logger = $this->getMockBuilder(LoggerInterface::class)->getMock(); + $logger = $this->createMock(LoggerInterface::class); $factory = new LockFactory($store); $factory->setLogger($logger); diff --git a/src/Symfony/Component/Lock/Tests/LockTest.php b/src/Symfony/Component/Lock/Tests/LockTest.php index 17662006b2..37fcf246e4 100644 --- a/src/Symfony/Component/Lock/Tests/LockTest.php +++ b/src/Symfony/Component/Lock/Tests/LockTest.php @@ -63,7 +63,7 @@ class LockTest extends TestCase public function testAcquireBlockingWithPersistingStoreInterface() { $key = new Key(uniqid(__METHOD__, true)); - $store = $this->getMockBuilder(PersistingStoreInterface::class)->getMock(); + $store = $this->createMock(PersistingStoreInterface::class); $lock = new Lock($key, $store); $store @@ -79,7 +79,7 @@ class LockTest extends TestCase public function testAcquireBlockingRetryWithPersistingStoreInterface() { $key = new Key(uniqid(__METHOD__, true)); - $store = $this->getMockBuilder(PersistingStoreInterface::class)->getMock(); + $store = $this->createMock(PersistingStoreInterface::class); $lock = new Lock($key, $store); $store diff --git a/src/Symfony/Component/Messenger/Bridge/AmazonSqs/Tests/Transport/ConnectionTest.php b/src/Symfony/Component/Messenger/Bridge/AmazonSqs/Tests/Transport/ConnectionTest.php index 2f442c7de5..0090a343f6 100644 --- a/src/Symfony/Component/Messenger/Bridge/AmazonSqs/Tests/Transport/ConnectionTest.php +++ b/src/Symfony/Component/Messenger/Bridge/AmazonSqs/Tests/Transport/ConnectionTest.php @@ -90,7 +90,7 @@ class ConnectionTest extends TestCase public function testFromDsnAsQueueUrl() { - $httpClient = $this->getMockBuilder(HttpClientInterface::class)->getMock(); + $httpClient = $this->createMock(HttpClientInterface::class); $this->assertEquals( new Connection(['queue_name' => 'ab1-MyQueue-A2BCDEF3GHI4', 'account' => '123456789012'], new SqsClient(['region' => 'us-east-2', 'endpoint' => 'https://sqs.us-east-2.amazonaws.com', 'accessKeyId' => null, 'accessKeySecret' => null], null, $httpClient), 'https://sqs.us-east-2.amazonaws.com/123456789012/ab1-MyQueue-A2BCDEF3GHI4'), Connection::fromDsn('https://sqs.us-east-2.amazonaws.com/123456789012/ab1-MyQueue-A2BCDEF3GHI4', [], $httpClient) @@ -304,7 +304,7 @@ class ConnectionTest extends TestCase public function testGetQueueUrlNotCalled() { - $client = $this->getMockBuilder(SqsClient::class)->getMock(); + $client = $this->createMock(SqsClient::class); $connection = new Connection(['queue_name' => 'ab1-MyQueue-A2BCDEF3GHI4', 'account' => '123456789012'], $client, 'https://sqs.us-east-2.amazonaws.com/123456789012/ab1-MyQueue-A2BCDEF3GHI4'); $client->expects($this->never())->method('getQueueUrl'); diff --git a/src/Symfony/Component/Messenger/Bridge/Beanstalkd/Tests/Transport/BeanstalkdReceiverTest.php b/src/Symfony/Component/Messenger/Bridge/Beanstalkd/Tests/Transport/BeanstalkdReceiverTest.php index 612f83a03b..ed3c7f2d7e 100644 --- a/src/Symfony/Component/Messenger/Bridge/Beanstalkd/Tests/Transport/BeanstalkdReceiverTest.php +++ b/src/Symfony/Component/Messenger/Bridge/Beanstalkd/Tests/Transport/BeanstalkdReceiverTest.php @@ -32,7 +32,7 @@ final class BeanstalkdReceiverTest extends TestCase $tube = 'foo bar'; $beanstalkdEnvelope = $this->createBeanstalkdEnvelope(); - $connection = $this->getMockBuilder(Connection::class)->disableOriginalConstructor()->getMock(); + $connection = $this->createMock(Connection::class); $connection->expects($this->once())->method('get')->willReturn($beanstalkdEnvelope); $connection->expects($this->once())->method('getTube')->willReturn($tube); @@ -53,7 +53,7 @@ final class BeanstalkdReceiverTest extends TestCase { $serializer = $this->createSerializer(); - $connection = $this->getMockBuilder(Connection::class)->disableOriginalConstructor()->getMock(); + $connection = $this->createMock(Connection::class); $connection->expects($this->once())->method('get')->willReturn(null); $receiver = new BeanstalkdReceiver($connection, $serializer); @@ -70,7 +70,7 @@ final class BeanstalkdReceiverTest extends TestCase $serializer->expects($this->once())->method('decode')->willThrowException(new MessageDecodingFailedException()); $beanstalkdEnvelope = $this->createBeanstalkdEnvelope(); - $connection = $this->getMockBuilder(Connection::class)->disableOriginalConstructor()->getMock(); + $connection = $this->createMock(Connection::class); $connection->expects($this->once())->method('get')->willReturn($beanstalkdEnvelope); $connection->expects($this->once())->method('reject'); diff --git a/src/Symfony/Component/Messenger/Bridge/Beanstalkd/Tests/Transport/BeanstalkdSenderTest.php b/src/Symfony/Component/Messenger/Bridge/Beanstalkd/Tests/Transport/BeanstalkdSenderTest.php index ee919ec6a9..cfc5b8fdba 100644 --- a/src/Symfony/Component/Messenger/Bridge/Beanstalkd/Tests/Transport/BeanstalkdSenderTest.php +++ b/src/Symfony/Component/Messenger/Bridge/Beanstalkd/Tests/Transport/BeanstalkdSenderTest.php @@ -26,12 +26,10 @@ final class BeanstalkdSenderTest extends TestCase $envelope = new Envelope(new DummyMessage('Oy')); $encoded = ['body' => '...', 'headers' => ['type' => DummyMessage::class]]; - $connection = $this->getMockBuilder(Connection::class) - ->disableOriginalConstructor() - ->getMock(); + $connection = $this->createMock(Connection::class); $connection->expects($this->once())->method('send')->with($encoded['body'], $encoded['headers'], 0); - $serializer = $this->getMockBuilder(SerializerInterface::class)->getMock(); + $serializer = $this->createMock(SerializerInterface::class); $serializer->method('encode')->with($envelope)->willReturnOnConsecutiveCalls($encoded); $sender = new BeanstalkdSender($connection, $serializer); diff --git a/src/Symfony/Component/Messenger/Bridge/Redis/Tests/Transport/ConnectionTest.php b/src/Symfony/Component/Messenger/Bridge/Redis/Tests/Transport/ConnectionTest.php index 9b59ac68e6..554b1f92cd 100644 --- a/src/Symfony/Component/Messenger/Bridge/Redis/Tests/Transport/ConnectionTest.php +++ b/src/Symfony/Component/Messenger/Bridge/Redis/Tests/Transport/ConnectionTest.php @@ -361,7 +361,7 @@ class ConnectionTest extends TestCase public function testDeleteAfterReject() { - $redis = $this->getMockBuilder(\Redis::class)->disableOriginalConstructor()->getMock(); + $redis = $this->createMock(\Redis::class); $redis->expects($this->exactly(1))->method('xack') ->with('queue', 'symfony', ['1']) diff --git a/src/Symfony/Component/Messenger/Tests/WorkerTest.php b/src/Symfony/Component/Messenger/Tests/WorkerTest.php index 3efaf11d5b..c105cdad53 100644 --- a/src/Symfony/Component/Messenger/Tests/WorkerTest.php +++ b/src/Symfony/Component/Messenger/Tests/WorkerTest.php @@ -250,7 +250,7 @@ class WorkerTest extends TestCase $envelope = new Envelope(new DummyMessage('Hello')); $receiver = new DummyReceiver([[$envelope]]); - $bus = $this->getMockBuilder(MessageBusInterface::class)->getMock(); + $bus = $this->createMock(MessageBusInterface::class); $bus->method('dispatch')->willReturnArgument(0); $eventDispatcher = new EventDispatcher(); diff --git a/src/Symfony/Component/Security/Http/Tests/Controller/UserValueResolverTest.php b/src/Symfony/Component/Security/Http/Tests/Controller/UserValueResolverTest.php index b58db105a7..b95aa465c3 100644 --- a/src/Symfony/Component/Security/Http/Tests/Controller/UserValueResolverTest.php +++ b/src/Symfony/Component/Security/Http/Tests/Controller/UserValueResolverTest.php @@ -71,7 +71,7 @@ class UserValueResolverTest extends TestCase public function testResolveWithAttribute() { - $user = $this->getMockBuilder(UserInterface::class)->getMock(); + $user = $this->createMock(UserInterface::class); $token = new UsernamePasswordToken($user, 'password', 'provider'); $tokenStorage = new TokenStorage(); $tokenStorage->setToken($token); diff --git a/src/Symfony/Component/Security/Http/Tests/Firewall/UsernamePasswordJsonAuthenticationListenerTest.php b/src/Symfony/Component/Security/Http/Tests/Firewall/UsernamePasswordJsonAuthenticationListenerTest.php index 34f1eff95f..0a2e6e991a 100644 --- a/src/Symfony/Component/Security/Http/Tests/Firewall/UsernamePasswordJsonAuthenticationListenerTest.php +++ b/src/Symfony/Component/Security/Http/Tests/Firewall/UsernamePasswordJsonAuthenticationListenerTest.php @@ -98,7 +98,7 @@ class UsernamePasswordJsonAuthenticationListenerTest extends TestCase { $this->createListener([], false, true, false); $request = new Request([], [], [], [], [], ['HTTP_CONTENT_TYPE' => 'application/json'], '{"username": "dunglas", "password": "foo"}'); - $event = new RequestEvent($this->getMockBuilder(KernelInterface::class)->getMock(), $request, KernelInterface::MASTER_REQUEST); + $event = new RequestEvent($this->createMock(KernelInterface::class), $request, KernelInterface::MASTER_REQUEST); ($this->listener)($event); $this->assertSame(['error' => 'An authentication exception occurred.'], json_decode($event->getResponse()->getContent(), true)); diff --git a/src/Symfony/Component/Semaphore/Tests/SemaphoreFactoryTest.php b/src/Symfony/Component/Semaphore/Tests/SemaphoreFactoryTest.php index 5156f64671..8f42009aef 100644 --- a/src/Symfony/Component/Semaphore/Tests/SemaphoreFactoryTest.php +++ b/src/Symfony/Component/Semaphore/Tests/SemaphoreFactoryTest.php @@ -25,7 +25,7 @@ class SemaphoreFactoryTest extends TestCase { public function testCreateSemaphore() { - $store = $this->getMockBuilder(PersistingStoreInterface::class)->getMock(); + $store = $this->createMock(PersistingStoreInterface::class); $keys = []; $store @@ -38,7 +38,7 @@ class SemaphoreFactoryTest extends TestCase })) ->willReturn(true); - $logger = $this->getMockBuilder(LoggerInterface::class)->getMock(); + $logger = $this->createMock(LoggerInterface::class); $factory = new SemaphoreFactory($store); $factory->setLogger($logger); @@ -54,7 +54,7 @@ class SemaphoreFactoryTest extends TestCase public function testCreateSemaphoreFromKey() { - $store = $this->getMockBuilder(PersistingStoreInterface::class)->getMock(); + $store = $this->createMock(PersistingStoreInterface::class); $keys = []; $store @@ -67,7 +67,7 @@ class SemaphoreFactoryTest extends TestCase })) ->willReturn(true); - $logger = $this->getMockBuilder(LoggerInterface::class)->getMock(); + $logger = $this->createMock(LoggerInterface::class); $factory = new SemaphoreFactory($store); $factory->setLogger($logger); diff --git a/src/Symfony/Component/Semaphore/Tests/SemaphoreTest.php b/src/Symfony/Component/Semaphore/Tests/SemaphoreTest.php index 556c8aad23..994b02e804 100644 --- a/src/Symfony/Component/Semaphore/Tests/SemaphoreTest.php +++ b/src/Symfony/Component/Semaphore/Tests/SemaphoreTest.php @@ -29,7 +29,7 @@ class SemaphoreTest extends TestCase public function testAcquireReturnsTrue() { $key = new Key('key', 1); - $store = $this->getMockBuilder(PersistingStoreInterface::class)->getMock(); + $store = $this->createMock(PersistingStoreInterface::class); $semaphore = new Semaphore($key, $store); $store @@ -45,7 +45,7 @@ class SemaphoreTest extends TestCase public function testAcquireReturnsFalse() { $key = new Key('key', 1); - $store = $this->getMockBuilder(PersistingStoreInterface::class)->getMock(); + $store = $this->createMock(PersistingStoreInterface::class); $semaphore = new Semaphore($key, $store); $store @@ -62,7 +62,7 @@ class SemaphoreTest extends TestCase public function testAcquireThrowException() { $key = new Key('key', 1); - $store = $this->getMockBuilder(PersistingStoreInterface::class)->getMock(); + $store = $this->createMock(PersistingStoreInterface::class); $semaphore = new Semaphore($key, $store); $store @@ -81,7 +81,7 @@ class SemaphoreTest extends TestCase public function testRefresh() { $key = new Key('key', 1); - $store = $this->getMockBuilder(PersistingStoreInterface::class)->getMock(); + $store = $this->createMock(PersistingStoreInterface::class); $semaphore = new Semaphore($key, $store, 10.0); $store @@ -97,7 +97,7 @@ class SemaphoreTest extends TestCase public function testRefreshWithCustomTtl() { $key = new Key('key', 1); - $store = $this->getMockBuilder(PersistingStoreInterface::class)->getMock(); + $store = $this->createMock(PersistingStoreInterface::class); $semaphore = new Semaphore($key, $store, 10.0); $store @@ -113,7 +113,7 @@ class SemaphoreTest extends TestCase public function testRefreshWhenItFails() { $key = new Key('key', 1); - $store = $this->getMockBuilder(PersistingStoreInterface::class)->getMock(); + $store = $this->createMock(PersistingStoreInterface::class); $semaphore = new Semaphore($key, $store); $store @@ -132,7 +132,7 @@ class SemaphoreTest extends TestCase public function testRefreshWhenItFailsHard() { $key = new Key('key', 1); - $store = $this->getMockBuilder(PersistingStoreInterface::class)->getMock(); + $store = $this->createMock(PersistingStoreInterface::class); $semaphore = new Semaphore($key, $store); $store @@ -151,7 +151,7 @@ class SemaphoreTest extends TestCase public function testRelease() { $key = new Key('key', 1); - $store = $this->getMockBuilder(PersistingStoreInterface::class)->getMock(); + $store = $this->createMock(PersistingStoreInterface::class); $semaphore = new Semaphore($key, $store); $store @@ -166,7 +166,7 @@ class SemaphoreTest extends TestCase public function testReleaseWhenItFails() { $key = new Key('key', 1); - $store = $this->getMockBuilder(PersistingStoreInterface::class)->getMock(); + $store = $this->createMock(PersistingStoreInterface::class); $semaphore = new Semaphore($key, $store); $store @@ -185,7 +185,7 @@ class SemaphoreTest extends TestCase public function testReleaseWhenItFailsHard() { $key = new Key('key', 1); - $store = $this->getMockBuilder(PersistingStoreInterface::class)->getMock(); + $store = $this->createMock(PersistingStoreInterface::class); $semaphore = new Semaphore($key, $store); $store @@ -241,7 +241,7 @@ class SemaphoreTest extends TestCase public function testExpiration() { - $store = $this->getMockBuilder(PersistingStoreInterface::class)->getMock(); + $store = $this->createMock(PersistingStoreInterface::class); $key = new Key('key', 1); $semaphore = new Semaphore($key, $store); @@ -258,7 +258,7 @@ class SemaphoreTest extends TestCase */ public function testExpirationResetAfter() { - $store = $this->getMockBuilder(PersistingStoreInterface::class)->getMock(); + $store = $this->createMock(PersistingStoreInterface::class); $key = new Key('key', 1); $semaphore = new Semaphore($key, $store, 1); diff --git a/src/Symfony/Component/Serializer/Tests/Normalizer/AbstractObjectNormalizerTest.php b/src/Symfony/Component/Serializer/Tests/Normalizer/AbstractObjectNormalizerTest.php index 4557d9ceea..1d500271f4 100644 --- a/src/Symfony/Component/Serializer/Tests/Normalizer/AbstractObjectNormalizerTest.php +++ b/src/Symfony/Component/Serializer/Tests/Normalizer/AbstractObjectNormalizerTest.php @@ -322,7 +322,7 @@ class AbstractObjectNormalizerTest extends TestCase private function getDenormalizerForObjectWithBasicProperties() { - $extractor = $this->getMockBuilder(PhpDocExtractor::class)->getMock(); + $extractor = $this->createMock(PhpDocExtractor::class); $extractor->method('getTypes') ->will($this->onConsecutiveCalls( [new Type('bool')],