diff --git a/tests/Admin/AdminHelperTest.php b/tests/Admin/AdminHelperTest.php index f9a657fac5..cc5cc6a45c 100644 --- a/tests/Admin/AdminHelperTest.php +++ b/tests/Admin/AdminHelperTest.php @@ -77,8 +77,8 @@ public function testDeprecatedConstructingWithoutPropertyAccessor(): 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); @@ -235,7 +235,7 @@ public function testAppendFormFieldElement(): void { $helper = new AdminHelper($this->propertyAccessor); - $admin = $this->createMock(AdminInterface::class); + $admin = $this->createStub(AdminInterface::class); $admin ->method('getClass') ->willReturn(Foo::class); @@ -252,7 +252,7 @@ public function testAppendFormFieldElement(): void 'isOwningSide' => false, ]; - $fieldDescription = $this->createMock(FieldDescriptionInterface::class); + $fieldDescription = $this->createStub(FieldDescriptionInterface::class); $fieldDescription->method('getAssociationAdmin')->willReturn($associationAdmin); $fieldDescription->method('getAssociationMapping')->willReturn($associationMapping); $fieldDescription->method('getParentAssociationMappings')->willReturn([]); @@ -267,7 +267,7 @@ public function testAppendFormFieldElement(): void 'bar' => $fieldDescription, ]); - $request = $this->createMock(Request::class); + $request = $this->createStub(Request::class); $request ->method('get') ->willReturn([ @@ -285,7 +285,7 @@ public function testAppendFormFieldElement(): void $admin ->method('getRequest') - ->will($this->onConsecutiveCalls($request, $request, $request, null, $request, $request, $request, $request, null, $request)); + ->willReturnOnConsecutiveCalls($request, $request, $request, null, $request, $request, $request, $request, null, $request); $foo = $this->createMock(Foo::class); $admin @@ -303,9 +303,9 @@ public function testAppendFormFieldElement(): void $foo->expects($this->atLeastOnce())->method('addBar')->with($bar); - $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); @@ -343,21 +343,21 @@ public function testAppendFormFieldElementNested(): void { $admin = $this->createMock(AdminInterface::class); $object = $this->getMockBuilder(\stdClass::class) - ->setMethods(['getSubObject']) + ->addMethods(['getSubObject']) ->getMock(); $subObject = $this->getMockBuilder(\stdClass::class) - ->setMethods(['getAnd']) + ->addMethods(['getAnd']) ->getMock(); $sub2Object = $this->getMockBuilder(\stdClass::class) - ->setMethods(['getMore']) + ->addMethods(['getMore']) ->getMock(); $sub3Object = $this->getMockBuilder(\stdClass::class) - ->setMethods(['getFinalData']) + ->addMethods(['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($object), $eventDispatcher, $formFactory); $childFormBuilder = new FormBuilder('subObject', \get_class($subObject), $eventDispatcher, $formFactory); diff --git a/tests/Util/FormBuilderIteratorTest.php b/tests/Util/FormBuilderIteratorTest.php index 6ff9a8c617..679295a0b4 100644 --- a/tests/Util/FormBuilderIteratorTest.php +++ b/tests/Util/FormBuilderIteratorTest.php @@ -45,8 +45,8 @@ class FormBuilderIteratorTest extends TestCase protected function setUp(): void { - $this->dispatcher = $this->getMockForAbstractClass(EventDispatcherInterface::class); - $this->factory = $this->getMockForAbstractClass(FormFactoryInterface::class); + $this->dispatcher = $this->createStub(EventDispatcherInterface::class); + $this->factory = $this->createStub(FormFactoryInterface::class); $this->builder = new FormBuilder('name', null, $this->dispatcher, $this->factory); $this->factory->method('createNamedBuilder')->willReturn($this->builder); }