From 009e8af937c328a3afe0d49abe4cee7111d666f0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9goire=20Paris?= Date: Sat, 11 Apr 2020 16:15:49 +0200 Subject: [PATCH 1/2] Use createStub whenever possible --- tests/Action/DashboardActionTest.php | 2 +- tests/Admin/AdminHelperTest.php | 26 +++--- tests/Admin/AdminTest.php | 82 +++++++++---------- tests/Admin/BaseAdminModelManagerTest.php | 2 +- tests/Admin/PoolTest.php | 8 +- tests/Command/ExplainAdminCommandTest.php | 26 +++--- tests/Command/ListAdminCommandTest.php | 4 +- tests/Command/SetupAclCommandTest.php | 2 +- tests/Controller/CRUDControllerTest.php | 56 ++++++------- tests/Controller/CoreControllerTest.php | 4 +- tests/Datagrid/DatagridMapperTest.php | 12 +-- tests/Datagrid/ListMapperTest.php | 4 +- tests/Datagrid/PagerTest.php | 8 +- tests/Export/ExporterTest.php | 2 +- tests/Form/FormMapperTest.php | 6 +- tests/Maker/AdminMakerTest.php | 2 +- tests/Mapper/BaseGroupedMapperTest.php | 2 +- tests/Menu/Matcher/Voter/AdminVoterTest.php | 6 +- tests/Route/DefaultRouteGeneratorTest.php | 4 +- tests/Show/ShowMapperTest.php | 2 +- .../Extension/SonataAdminExtensionTest.php | 10 +-- 21 files changed, 135 insertions(+), 135 deletions(-) diff --git a/tests/Action/DashboardActionTest.php b/tests/Action/DashboardActionTest.php index 5c1c07948b..f0aecb4953 100644 --- a/tests/Action/DashboardActionTest.php +++ b/tests/Action/DashboardActionTest.php @@ -42,7 +42,7 @@ protected function setUp(): void $pool = new Pool($container, 'title', 'logo.png'); $pool->setTemplateRegistry($templateRegistry->reveal()); - $twig = $this->createMock(Environment::class); + $twig = $this->createStub(Environment::class); $breadcrumbsBuilder = $this->getMockForAbstractClass(BreadcrumbsBuilderInterface::class); diff --git a/tests/Admin/AdminHelperTest.php b/tests/Admin/AdminHelperTest.php index 2cba1432e7..301ec670a1 100644 --- a/tests/Admin/AdminHelperTest.php +++ b/tests/Admin/AdminHelperTest.php @@ -48,8 +48,8 @@ public function setUp(): void public function testGetChildFormBuilder(): void { - $formFactory = $this->createMock(FormFactoryInterface::class); - $eventDispatcher = $this->createMock(EventDispatcherInterface::class); + $formFactory = $this->createStub(FormFactoryInterface::class); + $eventDispatcher = $this->createStub(EventDispatcherInterface::class); $formBuilder = new FormBuilder('test', \stdClass::class, $eventDispatcher, $formFactory); @@ -198,7 +198,7 @@ public function testAppendFormFieldElement(): void $pool = new Pool($container, 'title', 'logo.png', [], $propertyAccesor); $helper = new AdminHelper($pool); - $admin = $this->createMock(AdminInterface::class); + $admin = $this->createStub(AdminInterface::class); $admin ->method('getClass') ->willReturn(Foo::class); @@ -210,7 +210,7 @@ public function testAppendFormFieldElement(): void 'isOwningSide' => false, ]; - $fieldDescription = $this->createMock(FieldDescriptionInterface::class); + $fieldDescription = $this->createStub(FieldDescriptionInterface::class); $fieldDescription->method('getAssociationAdmin')->willReturn($admin); $fieldDescription->method('getAssociationMapping')->willReturn($associationMapping); $fieldDescription->method('getParentAssociationMappings')->willReturn([]); @@ -225,7 +225,7 @@ public function testAppendFormFieldElement(): void 'bar' => $fieldDescription, ]); - $request = $this->createMock(Request::class); + $request = $this->createStub(Request::class); $request ->method('get') ->willReturn([ @@ -245,14 +245,14 @@ public function testAppendFormFieldElement(): void ->method('getRequest') ->will($this->onConsecutiveCalls($request, $request, $request, null, $request, $request, $request, $request, null, $request)); - $foo = $this->createMock(Foo::class); + $foo = $this->createStub(Foo::class); - $collection = $this->createMock(Collection::class); + $collection = $this->createStub(Collection::class); $foo->setBar($collection); - $dataMapper = $this->createMock(DataMapperInterface::class); - $formFactory = $this->createMock(FormFactoryInterface::class); - $eventDispatcher = $this->createMock(EventDispatcherInterface::class); + $dataMapper = $this->createStub(DataMapperInterface::class); + $formFactory = $this->createStub(FormFactoryInterface::class); + $eventDispatcher = $this->createStub(EventDispatcherInterface::class); $formBuilder = new FormBuilder('test', \get_class($foo), $eventDispatcher, $formFactory); $childFormBuilder = new FormBuilder('bar', \stdClass::class, $eventDispatcher, $formFactory); $childFormBuilder->setCompound(true); @@ -304,9 +304,9 @@ public function testAppendFormFieldElementNested(): void $sub3Object = $this->getMockBuilder(\stdClass::class) ->setMethods(['getFinalData']) ->getMock(); - $dataMapper = $this->createMock(DataMapperInterface::class); - $formFactory = $this->createMock(FormFactoryInterface::class); - $eventDispatcher = $this->createMock(EventDispatcherInterface::class); + $dataMapper = $this->createStub(DataMapperInterface::class); + $formFactory = $this->createStub(FormFactoryInterface::class); + $eventDispatcher = $this->createStub(EventDispatcherInterface::class); $formBuilder = new FormBuilder('test', \get_class($simpleObject), $eventDispatcher, $formFactory); $childFormBuilder = new FormBuilder('subObject', \get_class($subObject), $eventDispatcher, $formFactory); diff --git a/tests/Admin/AdminTest.php b/tests/Admin/AdminTest.php index 37583f4764..9ca50ff675 100644 --- a/tests/Admin/AdminTest.php +++ b/tests/Admin/AdminTest.php @@ -845,7 +845,7 @@ public function testGetLabelTranslatorStrategy(): void $this->assertNull($admin->getLabelTranslatorStrategy()); - $labelTranslatorStrategy = $this->createMock(LabelTranslatorStrategyInterface::class); + $labelTranslatorStrategy = $this->createStub(LabelTranslatorStrategyInterface::class); $admin->setLabelTranslatorStrategy($labelTranslatorStrategy); $this->assertSame($labelTranslatorStrategy, $admin->getLabelTranslatorStrategy()); } @@ -856,7 +856,7 @@ public function testGetRouteBuilder(): void $this->assertNull($admin->getRouteBuilder()); - $routeBuilder = $this->createMock(RouteBuilderInterface::class); + $routeBuilder = $this->createStub(RouteBuilderInterface::class); $admin->setRouteBuilder($routeBuilder); $this->assertSame($routeBuilder, $admin->getRouteBuilder()); } @@ -867,7 +867,7 @@ public function testGetMenuFactory(): void $this->assertNull($admin->getMenuFactory()); - $menuFactory = $this->createMock(FactoryInterface::class); + $menuFactory = $this->createStub(FactoryInterface::class); $admin->setMenuFactory($menuFactory); $this->assertSame($menuFactory, $admin->getMenuFactory()); } @@ -878,8 +878,8 @@ public function testGetExtensions(): void $this->assertSame([], $admin->getExtensions()); - $adminExtension1 = $this->createMock(AdminExtensionInterface::class); - $adminExtension2 = $this->createMock(AdminExtensionInterface::class); + $adminExtension1 = $this->createStub(AdminExtensionInterface::class); + $adminExtension2 = $this->createStub(AdminExtensionInterface::class); $admin->addExtension($adminExtension1); $admin->addExtension($adminExtension2); @@ -925,7 +925,7 @@ public function testGetSecurityHandler(): void $this->assertNull($admin->getSecurityHandler()); - $securityHandler = $this->createMock(SecurityHandlerInterface::class); + $securityHandler = $this->createStub(SecurityHandlerInterface::class); $admin->setSecurityHandler($securityHandler); $this->assertSame($securityHandler, $admin->getSecurityHandler()); } @@ -961,7 +961,7 @@ public function testGetModelManager(): void $this->assertNull($admin->getModelManager()); - $modelManager = $this->createMock(ModelManagerInterface::class); + $modelManager = $this->createStub(ModelManagerInterface::class); $admin->setModelManager($modelManager); $this->assertSame($modelManager, $admin->getModelManager()); @@ -1012,7 +1012,7 @@ public function testGetRouteGenerator(): void $this->assertNull($admin->getRouteGenerator()); - $routeGenerator = $this->createMock(RouteGeneratorInterface::class); + $routeGenerator = $this->createStub(RouteGeneratorInterface::class); $admin->setRouteGenerator($routeGenerator); $this->assertSame($routeGenerator, $admin->getRouteGenerator()); @@ -1038,7 +1038,7 @@ public function testGetShowBuilder(): void $this->assertNull($admin->getShowBuilder()); - $showBuilder = $this->createMock(ShowBuilderInterface::class); + $showBuilder = $this->createStub(ShowBuilderInterface::class); $admin->setShowBuilder($showBuilder); $this->assertSame($showBuilder, $admin->getShowBuilder()); @@ -1050,7 +1050,7 @@ public function testGetListBuilder(): void $this->assertNull($admin->getListBuilder()); - $listBuilder = $this->createMock(ListBuilderInterface::class); + $listBuilder = $this->createStub(ListBuilderInterface::class); $admin->setListBuilder($listBuilder); $this->assertSame($listBuilder, $admin->getListBuilder()); @@ -1062,7 +1062,7 @@ public function testGetDatagridBuilder(): void $this->assertNull($admin->getDatagridBuilder()); - $datagridBuilder = $this->createMock(DatagridBuilderInterface::class); + $datagridBuilder = $this->createStub(DatagridBuilderInterface::class); $admin->setDatagridBuilder($datagridBuilder); $this->assertSame($datagridBuilder, $admin->getDatagridBuilder()); @@ -1074,7 +1074,7 @@ public function testGetFormContractor(): void $this->assertNull($admin->getFormContractor()); - $formContractor = $this->createMock(FormContractorInterface::class); + $formContractor = $this->createStub(FormContractorInterface::class); $admin->setFormContractor($formContractor); $this->assertSame($formContractor, $admin->getFormContractor()); @@ -1121,7 +1121,7 @@ public function testGetTranslator(): void $this->assertNull($admin->getTranslator()); - $translator = $this->createMock(TranslatorInterface::class); + $translator = $this->createStub(TranslatorInterface::class); $admin->setTranslator($translator); $this->assertSame($translator, $admin->getTranslator()); @@ -1297,7 +1297,7 @@ public function testIsGranted(): void $entity = new \stdClass(); - $securityHandler = $this->createMock(AclSecurityHandlerInterface::class); + $securityHandler = $this->createStub(AclSecurityHandlerInterface::class); $securityHandler ->method('isGranted') ->willReturnCallback(static function ( @@ -1345,7 +1345,7 @@ public function testShowIn(): void { $admin = new PostAdmin('sonata.post.admin.post', 'Acme\NewsBundle\Entity\Post', 'Sonata\NewsBundle\Controller\PostAdminController'); - $securityHandler = $this->createMock(AclSecurityHandlerInterface::class); + $securityHandler = $this->createStub(AclSecurityHandlerInterface::class); $securityHandler ->method('isGranted') ->willReturnCallback(static function (AdminInterface $adminIn, array $attributes, $object = null) use ($admin): bool { @@ -1449,7 +1449,7 @@ public function persistFilters(): bool } }; - $filterPersister = $this->createMock(FilterPersisterInterface::class); + $filterPersister = $this->createStub(FilterPersisterInterface::class); $admin->setFilterPersister($filterPersister); $this->assertTrue($admin->persistFilters()); @@ -1593,16 +1593,16 @@ public function testFormAddPostSubmitEventForPreValidation(): void $modelAdmin = new ModelAdmin('sonata.post.admin.model', 'Application\Sonata\FooBundle\Entity\Model', 'Sonata\FooBundle\Controller\ModelAdminController'); $object = new \stdClass(); - $labelTranslatorStrategy = $this->createMock(LabelTranslatorStrategyInterface::class); + $labelTranslatorStrategy = $this->createStub(LabelTranslatorStrategyInterface::class); $modelAdmin->setLabelTranslatorStrategy($labelTranslatorStrategy); - $validator = $this->createMock(ValidatorInterface::class); + $validator = $this->createStub(ValidatorInterface::class); $validator ->method('getMetadataFor') ->willReturn($this->createMock(MemberMetadata::class)); $modelAdmin->setValidator($validator); - $modelManager = $this->createMock(ModelManagerInterface::class); + $modelManager = $this->createStub(ModelManagerInterface::class); $modelManager ->method('getNewFieldDescriptionInstance') ->willReturn(new FieldDescription()); @@ -1614,7 +1614,7 @@ public function testFormAddPostSubmitEventForPreValidation(): void ->method('preValidate') ->with($this->identicalTo($object)); - $event = $this->createMock(FormEvent::class); + $event = $this->createStub(FormEvent::class); $event ->method('getData') ->willReturn($object); @@ -1637,7 +1637,7 @@ public function testFormAddPostSubmitEventForPreValidation(): void $this->greaterThan(0) ); - $formContractor = $this->createMock(FormContractorInterface::class); + $formContractor = $this->createStub(FormContractorInterface::class); $formContractor ->method('getDefaultOptions') ->willReturn([]); @@ -1687,8 +1687,8 @@ public function testGetFilterParameters(): void $commentAdmin->setParentAssociationMapping('post.author'); $commentAdmin->setParent($postAdmin); - $request = $this->createMock(Request::class); - $query = $this->createMock(ParameterBag::class); + $request = $this->createStub(Request::class); + $query = $this->createStub(ParameterBag::class); $query ->method('get') ->willReturn([ @@ -1705,7 +1705,7 @@ public function testGetFilterParameters(): void $commentAdmin->setRequest($request); - $modelManager = $this->createMock(ModelManagerInterface::class); + $modelManager = $this->createStub(ModelManagerInterface::class); $modelManager ->method('getDefaultSortValues') ->willReturn([]); @@ -1758,14 +1758,14 @@ public function testGetFilterFieldDescription(): void $modelAdmin->setModelManager($modelManager); - $pager = $this->createMock(PagerInterface::class); + $pager = $this->createStub(PagerInterface::class); - $datagrid = $this->createMock(DatagridInterface::class); + $datagrid = $this->createStub(DatagridInterface::class); $datagrid->expects($this->once()) ->method('getPager') ->willReturn($pager); - $datagridBuilder = $this->createMock(DatagridBuilderInterface::class); + $datagridBuilder = $this->createStub(DatagridBuilderInterface::class); $datagridBuilder->expects($this->once()) ->method('getBaseDatagrid') ->with($this->identicalTo($modelAdmin), []) @@ -1889,7 +1889,7 @@ public function testGetSubjectWithParentDescription(): void $comment = new Comment(); - $modelManager = $this->createMock(ModelManagerInterface::class); + $modelManager = $this->createStub(ModelManagerInterface::class); $modelManager ->method('find') ->with('NewsBundle\Entity\Comment', $adminId) @@ -1994,7 +1994,7 @@ public function testGetBatchActions(): void $pathInfo = new PathInfoBuilder($this->createMock(AuditManagerInterface::class)); - $labelTranslatorStrategy = $this->createMock(LabelTranslatorStrategyInterface::class); + $labelTranslatorStrategy = $this->createStub(LabelTranslatorStrategyInterface::class); $labelTranslatorStrategy ->method('getLabel') ->willReturnCallback(static function (string $label, string $context = '', string $type = ''): string { @@ -2006,7 +2006,7 @@ public function testGetBatchActions(): void $admin->setTranslationDomain('SonataAdminBundle'); $admin->setLabelTranslatorStrategy($labelTranslatorStrategy); - $routeGenerator = $this->createMock(RouteGeneratorInterface::class); + $routeGenerator = $this->createStub(RouteGeneratorInterface::class); $routeGenerator ->expects($this->once()) ->method('hasAdminRoute') @@ -2014,7 +2014,7 @@ public function testGetBatchActions(): void ->willReturn(true); $admin->setRouteGenerator($routeGenerator); - $securityHandler = $this->createMock(SecurityHandlerInterface::class); + $securityHandler = $this->createStub(SecurityHandlerInterface::class); $securityHandler ->method('isGranted') ->willReturnCallback(static function (AdminInterface $adminIn, string $attributes, $object = null) use ($admin): bool { @@ -2075,7 +2075,7 @@ public function testDefaultDashboardActionsArePresent(string $objFqn, string $ex $admin->setTemplateRegistry($templateRegistry->reveal()); - $securityHandler = $this->createMock(SecurityHandlerInterface::class); + $securityHandler = $this->createStub(SecurityHandlerInterface::class); $securityHandler ->method('isGranted') ->willReturnCallback(static function (AdminInterface $adminIn, string $attributes, $object = null) use ($admin): bool { @@ -2094,8 +2094,8 @@ public function testDefaultFilters(): void $subjectId = uniqid(); - $request = $this->createMock(Request::class); - $query = $this->createMock(ParameterBag::class); + $request = $this->createStub(Request::class); + $query = $this->createStub(ParameterBag::class); $query ->method('get') ->with($this->equalTo('filter')) @@ -2120,7 +2120,7 @@ public function testDefaultFilters(): void $admin->setRequest($request); - $modelManager = $this->createMock(ModelManagerInterface::class); + $modelManager = $this->createStub(ModelManagerInterface::class); $modelManager ->method('getDefaultSortValues') ->willReturn([]); @@ -2184,7 +2184,7 @@ public function testBreadcrumbsBuilderSetter(): void $admin = $this->getMockForAbstractClass(AbstractAdmin::class, [ 'admin.my_code', 'My\Class', 'MyBundle\ClassAdminController', ]); - $this->assertSame($admin, $admin->setBreadcrumbsBuilder($builder = $this->createMock( + $this->assertSame($admin, $admin->setBreadcrumbsBuilder($builder = $this->createStub( BreadcrumbsBuilderInterface::class ))); $this->assertSame($builder, $admin->getBreadcrumbsBuilder()); @@ -2214,7 +2214,7 @@ public function testBuildBreadcrumbs(): void ]); $builder = $this->prophesize(BreadcrumbsBuilderInterface::class); $action = 'myaction'; - $menu = $this->createMock(ItemInterface::class); + $menu = $this->createStub(ItemInterface::class); $builder->buildBreadcrumbs($admin, $action, $menu) ->shouldBeCalledTimes(1) ->willReturn($menu); @@ -2235,7 +2235,7 @@ public function testCreateQueryLegacyCallWorks(): void $admin = $this->getMockForAbstractClass(AbstractAdmin::class, [ 'admin.my_code', 'My\Class', 'MyBundle\ClassAdminController', ]); - $query = $this->createMock(ProxyQueryInterface::class); + $query = $this->createStub(ProxyQueryInterface::class); $modelManager = $this->createMock(ModelManagerInterface::class); $modelManager->expects($this->once()) ->method('createQuery') @@ -2248,7 +2248,7 @@ public function testCreateQueryLegacyCallWorks(): void public function testGetDataSourceIterator(): void { - $datagrid = $this->createMock(DatagridInterface::class); + $datagrid = $this->createStub(DatagridInterface::class); $datagrid->method('buildPager'); $modelManager = $this->createMock(ModelManagerInterface::class); @@ -2468,7 +2468,7 @@ private function createTagAdmin(Post $post): TagAdmin $postAdmin->method('getObject')->willReturn($post); - $formBuilder = $this->createMock(FormBuilderInterface::class); + $formBuilder = $this->createStub(FormBuilderInterface::class); $formBuilder->method('getForm')->willReturn(null); $tagAdmin = $this->getMockBuilder(TagAdmin::class) @@ -2486,7 +2486,7 @@ private function createTagAdmin(Post $post): TagAdmin $tag = new Tag(); $tagAdmin->setSubject($tag); - $request = $this->createMock(Request::class); + $request = $this->createStub(Request::class); $tagAdmin->setRequest($request); $configurationPool = $this->getMockBuilder(Pool::class) diff --git a/tests/Admin/BaseAdminModelManagerTest.php b/tests/Admin/BaseAdminModelManagerTest.php index 35593988a8..8aeef27159 100644 --- a/tests/Admin/BaseAdminModelManagerTest.php +++ b/tests/Admin/BaseAdminModelManagerTest.php @@ -60,7 +60,7 @@ public function testObject(): void public function testCreateQuery(): void { - $query = $this->createMock(ProxyQueryInterface::class); + $query = $this->createStub(ProxyQueryInterface::class); $modelManager = $this->getMockForAbstractClass(ModelManagerInterface::class); $modelManager ->expects($this->once()) diff --git a/tests/Admin/PoolTest.php b/tests/Admin/PoolTest.php index 18bc9cfdbb..39487b0455 100644 --- a/tests/Admin/PoolTest.php +++ b/tests/Admin/PoolTest.php @@ -223,7 +223,7 @@ public function testGetAdminByAdminCodeForChildClass(): void ->method('hasChild') ->willReturn(true); - $childAdmin = $this->createMock(AdminInterface::class); + $childAdmin = $this->createStub(AdminInterface::class); $adminMock->expects($this->once()) ->method('getChild') @@ -244,7 +244,7 @@ public function testGetAdminByAdminCodeForChildClass(): void */ public function testGetAdminByAdminCodeWithInvalidCode(): void { - $adminMock = $this->createMock(AdminInterface::class); + $adminMock = $this->createStub(AdminInterface::class); $adminMock ->method('hasChild') ->willReturn(false); @@ -289,7 +289,7 @@ public function getNonStringAdminServiceNames(): array */ public function testGetAdminByAdminCodeWithCodeNotChild(): void { - $adminMock = $this->createMock(AdminInterface::class); + $adminMock = $this->createStub(AdminInterface::class); $adminMock ->method('hasChild') ->willReturn(false); @@ -385,7 +385,7 @@ public function testHasAdminByAdminCode(string $adminId): void $adminMock = $this->createMock(AdminInterface::class); if (false !== strpos($adminId, '|')) { - $childAdminMock = $this->createMock(AdminInterface::class); + $childAdminMock = $this->createStub(AdminInterface::class); $adminMock ->method('hasChild') ->willReturn(true); diff --git a/tests/Command/ExplainAdminCommandTest.php b/tests/Command/ExplainAdminCommandTest.php index 43436647f1..0e0fc38beb 100644 --- a/tests/Command/ExplainAdminCommandTest.php +++ b/tests/Command/ExplainAdminCommandTest.php @@ -82,7 +82,7 @@ protected function setUp(): void ->method('getRoutes') ->willReturn($routeCollection); - $fieldDescription1 = $this->createMock(FieldDescriptionInterface::class); + $fieldDescription1 = $this->createStub(FieldDescriptionInterface::class); $fieldDescription1 ->method('getType') @@ -92,7 +92,7 @@ protected function setUp(): void ->method('getTemplate') ->willReturn('@SonataAdmin/CRUD/foo_text.html.twig'); - $fieldDescription2 = $this->createMock(FieldDescriptionInterface::class); + $fieldDescription2 = $this->createStub(FieldDescriptionInterface::class); $fieldDescription2 ->method('getType') @@ -134,7 +134,7 @@ protected function setUp(): void $this->admin ->method('getParent') ->willReturnCallback(function () { - $adminParent = $this->createMock(AdminInterface::class); + $adminParent = $this->createStub(AdminInterface::class); $adminParent ->method('getCode') @@ -157,7 +157,7 @@ protected function setUp(): void public function testExecute(): void { - $metadata = $this->createMock(MetadataInterface::class); + $metadata = $this->createStub(MetadataInterface::class); $this->validatorFactory->expects($this->once()) ->method('getMetadataFor') @@ -180,25 +180,25 @@ public function testExecute(): void $metadata->getters = ['email' => $getterMetadata]; - $modelManager = $this->createMock(ModelManagerInterface::class); + $modelManager = $this->createStub(ModelManagerInterface::class); $this->admin ->method('getModelManager') ->willReturn($modelManager); - $formBuilder = $this->createMock(FormBuilderInterface::class); + $formBuilder = $this->createStub(FormBuilderInterface::class); $this->admin ->method('getFormBuilder') ->willReturn($formBuilder); - $datagridBuilder = $this->createMock(DatagridBuilderInterface::class); + $datagridBuilder = $this->createStub(DatagridBuilderInterface::class); $this->admin ->method('getDatagridBuilder') ->willReturn($datagridBuilder); - $listBuilder = $this->createMock(ListBuilderInterface::class); + $listBuilder = $this->createStub(ListBuilderInterface::class); $this->admin ->method('getListBuilder') @@ -220,7 +220,7 @@ public function testExecute(): void public function testExecuteEmptyValidator(): void { - $metadata = $this->createMock(MetadataInterface::class); + $metadata = $this->createStub(MetadataInterface::class); $this->validatorFactory->expects($this->once()) ->method('getMetadataFor') @@ -230,25 +230,25 @@ public function testExecuteEmptyValidator(): void $metadata->properties = []; $metadata->getters = []; - $modelManager = $this->createMock(ModelManagerInterface::class); + $modelManager = $this->createStub(ModelManagerInterface::class); $this->admin ->method('getModelManager') ->willReturn($modelManager); - $formBuilder = $this->createMock(FormBuilderInterface::class); + $formBuilder = $this->createStub(FormBuilderInterface::class); $this->admin ->method('getFormBuilder') ->willReturn($formBuilder); - $datagridBuilder = $this->createMock(DatagridBuilderInterface::class); + $datagridBuilder = $this->createStub(DatagridBuilderInterface::class); $this->admin ->method('getDatagridBuilder') ->willReturn($datagridBuilder); - $listBuilder = $this->createMock(ListBuilderInterface::class); + $listBuilder = $this->createStub(ListBuilderInterface::class); $this->admin ->method('getListBuilder') diff --git a/tests/Command/ListAdminCommandTest.php b/tests/Command/ListAdminCommandTest.php index 96834a93d0..9a17339287 100644 --- a/tests/Command/ListAdminCommandTest.php +++ b/tests/Command/ListAdminCommandTest.php @@ -32,12 +32,12 @@ public function testExecute(): void $container = new Container(); - $admin1 = $this->createMock(AdminInterface::class); + $admin1 = $this->createStub(AdminInterface::class); $admin1 ->method('getClass') ->willReturn('Acme\Entity\Foo'); - $admin2 = $this->createMock(AdminInterface::class); + $admin2 = $this->createStub(AdminInterface::class); $admin2 ->method('getClass') ->willReturn('Acme\Entity\Bar'); diff --git a/tests/Command/SetupAclCommandTest.php b/tests/Command/SetupAclCommandTest.php index 0d836543d9..d8bcd38e42 100644 --- a/tests/Command/SetupAclCommandTest.php +++ b/tests/Command/SetupAclCommandTest.php @@ -35,7 +35,7 @@ class SetupAclCommandTest extends TestCase protected function setUp(): void { $this->container = new Container(); - $admin = $this->createMock(AdminInterface::class); + $admin = $this->createStub(AdminInterface::class); $this->container->set('acme.admin.foo', $admin); } diff --git a/tests/Controller/CRUDControllerTest.php b/tests/Controller/CRUDControllerTest.php index 6d1296a51a..0ef396c1ea 100644 --- a/tests/Controller/CRUDControllerTest.php +++ b/tests/Controller/CRUDControllerTest.php @@ -173,7 +173,7 @@ protected function setUp(): void $this->templateRegistry = $this->prophesize(TemplateRegistryInterface::class); - $templating = $this->createMock(DelegatingEngine::class); + $templating = $this->createStub(DelegatingEngine::class); $templatingRenderReturnCallback = $this->returnCallback(function ( $view, @@ -209,7 +209,7 @@ protected function setUp(): void if (class_exists(Exporter::class)) { $exporter = new Exporter([new JsonWriter('/tmp/sonataadmin/export.json')]); } else { - $exporter = $this->createMock(SonataExporter::class); + $exporter = $this->createStub(SonataExporter::class); $exporter ->method('getResponse') @@ -659,7 +659,7 @@ public function testBatchActionDeleteAccessDenied(): void public function testBatchActionDelete(): void { - $modelManager = $this->createMock(ModelManagerInterface::class); + $modelManager = $this->createStub(ModelManagerInterface::class); $this->admin->expects($this->once()) ->method('checkAccess') @@ -685,7 +685,7 @@ public function testBatchActionDelete(): void public function testBatchActionDeleteWithModelManagerException(): void { - $modelManager = $this->createMock(ModelManagerInterface::class); + $modelManager = $this->createStub(ModelManagerInterface::class); $this->assertLoggerLogsModelManagerException($modelManager, 'batchDelete'); $this->admin->expects($this->once()) @@ -1483,7 +1483,7 @@ public function testEditAction(): void ->method('getForm') ->willReturn($form); - $formView = $this->createMock(FormView::class); + $formView = $this->createStub(FormView::class); $form ->method('createView') @@ -1616,7 +1616,7 @@ public function testEditActionError(string $expectedToStringValue, string $toStr $this->request->setMethod(Request::METHOD_POST); - $formView = $this->createMock(FormView::class); + $formView = $this->createStub(FormView::class); $form ->method('createView') @@ -1781,7 +1781,7 @@ public function testEditActionAjaxErrorWithoutAcceptApplicationJson(): void $this->request->setMethod(Request::METHOD_POST); $this->request->headers->set('X-Requested-With', 'XMLHttpRequest'); - $formView = $this->createMock(FormView::class); + $formView = $this->createStub(FormView::class); $form ->method('createView') ->willReturn($formView); @@ -1853,7 +1853,7 @@ public function testEditActionWithModelManagerException(string $expectedToString ->willReturn(true); $this->request->setMethod(Request::METHOD_POST); - $formView = $this->createMock(FormView::class); + $formView = $this->createStub(FormView::class); $form ->method('createView') @@ -1897,7 +1897,7 @@ public function testEditActionWithPreview(): void ->method('supportsPreviewMode') ->willReturn(true); - $formView = $this->createMock(FormView::class); + $formView = $this->createStub(FormView::class); $form ->method('createView') @@ -1982,7 +1982,7 @@ public function testEditActionWithLockException(): void ->with($this->equalTo($object)) ->willReturn($class); - $formView = $this->createMock(FormView::class); + $formView = $this->createStub(FormView::class); $form ->method('createView') @@ -2092,7 +2092,7 @@ public function testCreateAction(): void ->method('all') ->willReturn(['field' => 'fielddata']); - $formView = $this->createMock(FormView::class); + $formView = $this->createStub(FormView::class); $form ->method('createView') @@ -2155,7 +2155,7 @@ public function testCreateActionSuccess(string $expectedToStringValue, string $t ->method('create') ->willReturnArgument(0); - $form = $this->createMock(Form::class); + $form = $this->createStub(Form::class); $this->admin ->method('getClass') @@ -2220,7 +2220,7 @@ public function testCreateActionAccessDenied2(): void ->method('getNewInstance') ->willReturn($object); - $form = $this->createMock(Form::class); + $form = $this->createStub(Form::class); $this->admin ->method('getClass') @@ -2298,7 +2298,7 @@ public function testCreateActionError(string $expectedToStringValue, string $toS $this->request->setMethod(Request::METHOD_POST); - $formView = $this->createMock(FormView::class); + $formView = $this->createStub(FormView::class); $form ->method('createView') @@ -2369,7 +2369,7 @@ public function testCreateActionWithModelManagerException(string $expectedToStri $this->request->setMethod(Request::METHOD_POST); - $formView = $this->createMock(FormView::class); + $formView = $this->createStub(FormView::class); $form ->method('createView') @@ -2417,7 +2417,7 @@ public function testCreateActionAjaxSuccess(): void ->method('create') ->willReturnArgument(0); - $form = $this->createMock(Form::class); + $form = $this->createStub(Form::class); $this->admin->expects($this->once()) ->method('getForm') @@ -2557,7 +2557,7 @@ public function testCreateActionAjaxErrorWithoutAcceptApplicationJson(): void $this->request->setMethod(Request::METHOD_POST); $this->request->headers->set('X-Requested-With', 'XMLHttpRequest'); - $formView = $this->createMock(FormView::class); + $formView = $this->createStub(FormView::class); $form ->method('createView') ->willReturn($formView); @@ -2610,7 +2610,7 @@ public function testCreateActionWithPreview(): void ->method('supportsPreviewMode') ->willReturn(true); - $formView = $this->createMock(FormView::class); + $formView = $this->createStub(FormView::class); $form ->method('createView') @@ -2689,7 +2689,7 @@ public function testExportAction(): void ->method('getExportFormats') ->willReturn(['json']); - $dataSourceIterator = $this->createMock(SourceIteratorInterface::class); + $dataSourceIterator = $this->createStub(SourceIteratorInterface::class); $this->admin->expects($this->once()) ->method('getDataSourceIterator') @@ -3568,7 +3568,7 @@ public function testBatchActionMethodNotExist(): void ->method('getBatchActions') ->willReturn($batchActions); - $datagrid = $this->createMock(DatagridInterface::class); + $datagrid = $this->createStub(DatagridInterface::class); $this->admin->expects($this->once()) ->method('getDatagrid') ->willReturn($datagrid); @@ -3595,7 +3595,7 @@ public function testBatchActionWithoutConfirmation(): void $datagrid = $this->createMock(DatagridInterface::class); - $query = $this->createMock(ProxyQueryInterface::class); + $query = $this->createStub(ProxyQueryInterface::class); $datagrid->expects($this->once()) ->method('getQuery') ->willReturn($query); @@ -3652,7 +3652,7 @@ public function testBatchActionWithoutConfirmation2(): void $datagrid = $this->createMock(DatagridInterface::class); - $query = $this->createMock(ProxyQueryInterface::class); + $query = $this->createStub(ProxyQueryInterface::class); $datagrid->expects($this->once()) ->method('getQuery') ->willReturn($query); @@ -3765,7 +3765,7 @@ public function testBatchActionNonRelevantAction(): void ->method('getBatchActions') ->willReturn($batchActions); - $datagrid = $this->createMock(DatagridInterface::class); + $datagrid = $this->createStub(DatagridInterface::class); $this->admin->expects($this->once()) ->method('getDatagrid') @@ -3836,7 +3836,7 @@ public function testBatchActionNonRelevantAction2(): void ->method('getBatchActions') ->willReturn($batchActions); - $datagrid = $this->createMock(DatagridInterface::class); + $datagrid = $this->createStub(DatagridInterface::class); $this->admin->expects($this->once()) ->method('getDatagrid') @@ -3869,7 +3869,7 @@ public function testBatchActionNoItems(): void ->method('getBatchActions') ->willReturn($batchActions); - $datagrid = $this->createMock(DatagridInterface::class); + $datagrid = $this->createStub(DatagridInterface::class); $this->admin->expects($this->once()) ->method('getDatagrid') @@ -3907,7 +3907,7 @@ public function testBatchActionNoItemsEmptyQuery(): void $datagrid = $this->createMock(DatagridInterface::class); - $query = $this->createMock(ProxyQueryInterface::class); + $query = $this->createStub(ProxyQueryInterface::class); $datagrid->expects($this->once()) ->method('getQuery') ->willReturn($query); @@ -3916,7 +3916,7 @@ public function testBatchActionNoItemsEmptyQuery(): void ->method('getDatagrid') ->willReturn($datagrid); - $modelManager = $this->createMock(ModelManagerInterface::class); + $modelManager = $this->createStub(ModelManagerInterface::class); $this->admin ->method('getModelManager') @@ -3953,7 +3953,7 @@ public function testBatchActionWithRequesData(): void $datagrid = $this->createMock(DatagridInterface::class); - $query = $this->createMock(ProxyQueryInterface::class); + $query = $this->createStub(ProxyQueryInterface::class); $datagrid->expects($this->once()) ->method('getQuery') ->willReturn($query); diff --git a/tests/Controller/CoreControllerTest.php b/tests/Controller/CoreControllerTest.php index 76b92980b4..5e76580079 100644 --- a/tests/Controller/CoreControllerTest.php +++ b/tests/Controller/CoreControllerTest.php @@ -42,7 +42,7 @@ public function testdashboardActionStandardRequest(): void $pool = new Pool($container, 'title', 'logo.png'); $pool->setTemplateRegistry($templateRegistry->reveal()); - $twig = $this->createMock(Environment::class); + $twig = $this->createStub(Environment::class); $request = new Request(); $requestStack = new RequestStack(); @@ -81,7 +81,7 @@ public function testdashboardActionAjaxLayout(): void $pool = new Pool($container, 'title', 'logo.png'); $pool->setTemplateRegistry($templateRegistry->reveal()); - $twig = $this->createMock(Environment::class); + $twig = $this->createStub(Environment::class); $request = new Request(); $request->headers->set('X-Requested-With', 'XMLHttpRequest'); diff --git a/tests/Datagrid/DatagridMapperTest.php b/tests/Datagrid/DatagridMapperTest.php index 8c82ce7df9..d5f974b585 100644 --- a/tests/Datagrid/DatagridMapperTest.php +++ b/tests/Datagrid/DatagridMapperTest.php @@ -48,18 +48,18 @@ class DatagridMapperTest extends TestCase protected function setUp(): void { - $datagridBuilder = $this->createMock(DatagridBuilderInterface::class); + $datagridBuilder = $this->createStub(DatagridBuilderInterface::class); - $proxyQuery = $this->createMock(ProxyQueryInterface::class); - $pager = $this->createMock(PagerInterface::class); - $fieldDescriptionCollection = $this->createMock(FieldDescriptionCollection::class); + $proxyQuery = $this->createStub(ProxyQueryInterface::class); + $pager = $this->createStub(PagerInterface::class); + $fieldDescriptionCollection = $this->createStub(FieldDescriptionCollection::class); $formBuilder = $this->getMockBuilder(FormBuilder::class) ->disableOriginalConstructor() ->getMock(); $this->datagrid = new Datagrid($proxyQuery, $fieldDescriptionCollection, $pager, $formBuilder, []); - $admin = $this->createMock(AdminInterface::class); + $admin = $this->createStub(AdminInterface::class); $datagridBuilder ->method('addFilter') @@ -81,7 +81,7 @@ protected function setUp(): void $datagrid->addFilter($filter); }); - $modelManager = $this->createMock(ModelManagerInterface::class); + $modelManager = $this->createStub(ModelManagerInterface::class); $modelManager ->method('getNewFieldDescriptionInstance') diff --git a/tests/Datagrid/ListMapperTest.php b/tests/Datagrid/ListMapperTest.php index b39eb38560..49023020bf 100644 --- a/tests/Datagrid/ListMapperTest.php +++ b/tests/Datagrid/ListMapperTest.php @@ -48,7 +48,7 @@ class ListMapperTest extends TestCase protected function setUp(): void { - $listBuilder = $this->createMock(ListBuilderInterface::class); + $listBuilder = $this->createStub(ListBuilderInterface::class); $this->fieldDescriptionCollection = new FieldDescriptionCollection(); $this->admin = $this->createMock(AbstractAdmin::class); @@ -63,7 +63,7 @@ protected function setUp(): void $list->add($fieldDescription); }); - $modelManager = $this->createMock(ModelManagerInterface::class); + $modelManager = $this->createStub(ModelManagerInterface::class); $modelManager ->method('getNewFieldDescriptionInstance') diff --git a/tests/Datagrid/PagerTest.php b/tests/Datagrid/PagerTest.php index 9d1a214102..ee900aef63 100644 --- a/tests/Datagrid/PagerTest.php +++ b/tests/Datagrid/PagerTest.php @@ -141,7 +141,7 @@ public function testCount(): void public function testGetQuery(): void { - $query = $this->createMock(ProxyQueryInterface::class); + $query = $this->createStub(ProxyQueryInterface::class); $this->pager->setQuery($query); $this->assertSame($query, $this->pager->getQuery()); @@ -367,7 +367,7 @@ public function testGetObjectByCursor(): void $this->callMethod($this->pager, 'setNbResults', [3]); - $query = $this->createMock(ProxyQueryInterface::class); + $query = $this->createStub(ProxyQueryInterface::class); $query ->method('setFirstResult') @@ -495,7 +495,7 @@ public function testGetNext(): void $this->callMethod($this->pager, 'setNbResults', [3]); - $query = $this->createMock(ProxyQueryInterface::class); + $query = $this->createStub(ProxyQueryInterface::class); $query ->method('setFirstResult') @@ -553,7 +553,7 @@ public function testGetPrevious(): void $this->callMethod($this->pager, 'setNbResults', [3]); - $query = $this->createMock(ProxyQueryInterface::class); + $query = $this->createStub(ProxyQueryInterface::class); $query ->method('setFirstResult') diff --git a/tests/Export/ExporterTest.php b/tests/Export/ExporterTest.php index 5d27d9f694..9b1addf6b3 100644 --- a/tests/Export/ExporterTest.php +++ b/tests/Export/ExporterTest.php @@ -30,7 +30,7 @@ public function testFilter(): void { $this->expectException(\RuntimeException::class); - $source = $this->createMock(SourceIteratorInterface::class); + $source = $this->createStub(SourceIteratorInterface::class); $exporter = new Exporter(); $exporter->getResponse('foo', 'foo', $source); diff --git a/tests/Form/FormMapperTest.php b/tests/Form/FormMapperTest.php index 9c128ac77f..6ee6410a07 100644 --- a/tests/Form/FormMapperTest.php +++ b/tests/Form/FormMapperTest.php @@ -56,13 +56,13 @@ protected function setUp(): void { $this->contractor = $this->createMock(FormContractorInterface::class); - $formFactory = $this->createMock(FormFactoryInterface::class); - $eventDispatcher = $this->createMock(EventDispatcherInterface::class); + $formFactory = $this->createStub(FormFactoryInterface::class); + $eventDispatcher = $this->createStub(EventDispatcherInterface::class); $formBuilder = new FormBuilder('test', 'stdClass', $eventDispatcher, $formFactory); $this->admin = new CleanAdmin('code', 'class', 'controller'); - $securityHandler = $this->createMock(SecurityHandlerInterface::class); + $securityHandler = $this->createStub(SecurityHandlerInterface::class); $securityHandler ->method('isGranted') ->willReturnCallback(static function (AdminInterface $admin, string $attributes, $object = null): bool { diff --git a/tests/Maker/AdminMakerTest.php b/tests/Maker/AdminMakerTest.php index bbc684eab4..6aaea7f648 100644 --- a/tests/Maker/AdminMakerTest.php +++ b/tests/Maker/AdminMakerTest.php @@ -116,7 +116,7 @@ public function testExecute(): void $this->output = new StreamOutput(fopen('php://memory', 'w', false)); $this->io = new ConsoleStyle($this->input, $this->output); - $autoloaderUtil = $this->createMock(AutoloaderUtil::class); + $autoloaderUtil = $this->createStub(AutoloaderUtil::class); $autoloaderUtil ->method('getPathForFutureClass') ->willReturnCallback(function (string $className): string { diff --git a/tests/Mapper/BaseGroupedMapperTest.php b/tests/Mapper/BaseGroupedMapperTest.php index 0fa702909e..fba6e60e59 100644 --- a/tests/Mapper/BaseGroupedMapperTest.php +++ b/tests/Mapper/BaseGroupedMapperTest.php @@ -43,7 +43,7 @@ public function setUp(): void ->disableOriginalConstructor() ->getMock(); - $labelStrategy = $this->createMock(LabelTranslatorStrategyInterface::class); + $labelStrategy = $this->createStub(LabelTranslatorStrategyInterface::class); $labelStrategy ->method('getLabel') ->willReturnCallback(static function (string $label): string { diff --git a/tests/Menu/Matcher/Voter/AdminVoterTest.php b/tests/Menu/Matcher/Voter/AdminVoterTest.php index 6d13cf0245..b229fbdf48 100644 --- a/tests/Menu/Matcher/Voter/AdminVoterTest.php +++ b/tests/Menu/Matcher/Voter/AdminVoterTest.php @@ -95,7 +95,7 @@ protected function createItem($data): ItemInterface */ private function getAdmin(string $code, bool $list = false, bool $granted = false): AbstractAdmin { - $admin = $this->createMock(AbstractAdmin::class); + $admin = $this->createStub(AbstractAdmin::class); $admin ->method('hasRoute') ->with('list') @@ -127,7 +127,7 @@ private function getChildAdmin( bool $list = false, bool $granted = false ): AbstractAdmin { - $parentAdmin = $this->createMock(AbstractAdmin::class); + $parentAdmin = $this->createStub(AbstractAdmin::class); $parentAdmin ->method('hasRoute') ->with('list') @@ -143,7 +143,7 @@ private function getChildAdmin( ->willReturn($parentCode) ; - $childAdmin = $this->createMock(AbstractAdmin::class); + $childAdmin = $this->createStub(AbstractAdmin::class); $childAdmin ->method('getBaseCodeRoute') ->willReturn($parentCode.'|'.$childCode) diff --git a/tests/Route/DefaultRouteGeneratorTest.php b/tests/Route/DefaultRouteGeneratorTest.php index b166f91451..763414faa0 100644 --- a/tests/Route/DefaultRouteGeneratorTest.php +++ b/tests/Route/DefaultRouteGeneratorTest.php @@ -173,7 +173,7 @@ public function testGenerateUrlChild(string $type, string $expected, string $nam // no request attached in this test, so this will not be used $parentAdmin->expects($this->never())->method('getPersistentParameters')->willReturn(['from' => 'parent']); - $request = $this->createMock(Request::class); + $request = $this->createStub(Request::class); $request->attributes = $this->createMock(ParameterBag::class); $request->attributes->method('has')->willReturn(true); $request->attributes @@ -324,7 +324,7 @@ public function testGenerateUrlLoadCache(string $expected, string $name, array $ // no request attached in this test, so this will not be used $parentAdmin->expects($this->never())->method('getPersistentParameters')->willReturn(['from' => 'parent']); - $request = $this->createMock(Request::class); + $request = $this->createStub(Request::class); $request->attributes = $this->createMock(ParameterBag::class); $request->attributes->method('has')->willReturn(true); $request->attributes diff --git a/tests/Show/ShowMapperTest.php b/tests/Show/ShowMapperTest.php index 93a61189d1..5cce945258 100644 --- a/tests/Show/ShowMapperTest.php +++ b/tests/Show/ShowMapperTest.php @@ -556,7 +556,7 @@ private function cleanShowMapper(): void }); $this->fieldDescriptionCollection = new FieldDescriptionCollection(); $this->admin = new CleanAdmin('code', 'class', 'controller'); - $securityHandler = $this->createMock(SecurityHandlerInterface::class); + $securityHandler = $this->createStub(SecurityHandlerInterface::class); $securityHandler ->method('isGranted') ->willReturnCallback(static function (AdminInterface $admin, string $attributes, $object = null): bool { diff --git a/tests/Twig/Extension/SonataAdminExtensionTest.php b/tests/Twig/Extension/SonataAdminExtensionTest.php index 49170a0909..6874d52d60 100644 --- a/tests/Twig/Extension/SonataAdminExtensionTest.php +++ b/tests/Twig/Extension/SonataAdminExtensionTest.php @@ -120,7 +120,7 @@ public function setUp(): void { date_default_timezone_set('Europe/London'); - $container = $this->createMock(ContainerInterface::class); + $container = $this->createStub(ContainerInterface::class); $this->pool = new Pool($container, '', ''); $this->pool->setAdminServiceIds(['sonata_admin_foo_service']); @@ -173,7 +173,7 @@ public function setUp(): void ); $this->twigExtension->setXEditableTypeMapping($this->xEditableTypeMapping); - $request = $this->createMock(Request::class); + $request = $this->createStub(Request::class); $request->method('get')->with('_sonata_admin')->willReturn('sonata_admin_foo_service'); $loader = new StubFilesystemLoader([ @@ -2215,7 +2215,7 @@ public function testGetValueFromFieldDescription(): void public function testGetValueFromFieldDescriptionWithRemoveLoopException(): void { - $object = $this->createMock(\ArrayAccess::class); + $object = $this->createStub(\ArrayAccess::class); $fieldDescription = $this->getMockForAbstractClass(FieldDescriptionInterface::class); $this->expectException(\RuntimeException::class); @@ -2842,9 +2842,9 @@ private function removeExtraWhitespace(string $string): string private function mockExtensionContext(string $locale): array { - $request = $this->createMock(Request::class); + $request = $this->createStub(Request::class); $request->method('getLocale')->willReturn($locale); - $appVariable = $this->createMock(AppVariable::class); + $appVariable = $this->createStub(AppVariable::class); $appVariable->method('getRequest')->willReturn($request); return ['app' => $appVariable]; From 52c5817aebf6d6341ee701e2793cf6a7959d0b05 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9goire=20Paris?= Date: Sat, 11 Apr 2020 16:34:46 +0200 Subject: [PATCH 2/2] Apply latest cs fixes --- tests/Controller/CRUDControllerTest.php | 4 ---- .../Compiler/AddDependencyCallsCompilerPassTest.php | 4 ++-- .../Compiler/ExtensionCompilerPassTest.php | 4 ++-- 3 files changed, 4 insertions(+), 8 deletions(-) diff --git a/tests/Controller/CRUDControllerTest.php b/tests/Controller/CRUDControllerTest.php index 0ef396c1ea..8e3f6ddfef 100644 --- a/tests/Controller/CRUDControllerTest.php +++ b/tests/Controller/CRUDControllerTest.php @@ -13,7 +13,6 @@ namespace Sonata\AdminBundle\Tests\Controller; -use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; use Psr\Log\LoggerInterface; use Sonata\AdminBundle\Admin\AbstractAdmin; @@ -149,9 +148,6 @@ class CRUDControllerTest extends TestCase */ private $translator; - /** - * @var LoggerInterface&MockObject - */ private $logger; /** diff --git a/tests/DependencyInjection/Compiler/AddDependencyCallsCompilerPassTest.php b/tests/DependencyInjection/Compiler/AddDependencyCallsCompilerPassTest.php index 238419fc6a..07e91f5927 100644 --- a/tests/DependencyInjection/Compiler/AddDependencyCallsCompilerPassTest.php +++ b/tests/DependencyInjection/Compiler/AddDependencyCallsCompilerPassTest.php @@ -46,10 +46,10 @@ */ class AddDependencyCallsCompilerPassTest extends TestCase { - /** @var SonataAdminExtension $extension */ + /** @var SonataAdminExtension */ private $extension; - /** @var array $config */ + /** @var array */ private $config; public function setUp(): void diff --git a/tests/DependencyInjection/Compiler/ExtensionCompilerPassTest.php b/tests/DependencyInjection/Compiler/ExtensionCompilerPassTest.php index 0fe9ea32fc..8b6c32994f 100644 --- a/tests/DependencyInjection/Compiler/ExtensionCompilerPassTest.php +++ b/tests/DependencyInjection/Compiler/ExtensionCompilerPassTest.php @@ -41,10 +41,10 @@ class ExtensionCompilerPassTest extends TestCase { - /** @var SonataAdminExtension $extension */ + /** @var SonataAdminExtension */ private $extension; - /** @var array $config */ + /** @var array */ private $config; /**