2 declare(strict_types = 1);
23 use TYPO3\TestingFramework\Core\Unit\UnitTestCase;
37 $gridContainerInterfaceMock = $this->createMock(GridContainerInterface::class);
38 $gridContainerInterfaceMock
39 ->expects($this->any())
40 ->method(
'getIdentifier')
44 $gridContainerMock = $this->getMockBuilder(GridContainer::class)
45 ->setMethods([
'getIdentifier',
'getElementsRecursively'])
46 ->disableOriginalConstructor()
50 ->expects($this->any())
51 ->method(
'getIdentifier')
55 ->expects($this->any())
56 ->method(
'getElementsRecursively')
57 ->willReturn([$gridContainerInterfaceMock]);
59 $this->assertSame([$gridContainerInterfaceMock], $gridContainerMock->getElementsRecursively());
62 $this->expectException(TypeDefinitionNotValidException::class);
63 $this->expectExceptionCode(1489412790);
65 $gridContainerMock->registerInFormIfPossible();
74 $element = $this->createMock(FormElementInterface::class);
77 $gridContainer = $this->getMockBuilder(GridContainer::class)
78 ->setMethods([
'getElementsRecursively'])
79 ->disableOriginalConstructor()
83 ->expects($this->any())
84 ->method(
'getIdentifier')
85 ->willReturn(
'foobar');
88 ->expects($this->any())
90 ->willReturn(
'FormElementOrSomethingLikeThat');
93 ->expects($this->any())
94 ->method(
'getElementsRecursively')
95 ->willReturn($element);
97 $this->expectException(TypeDefinitionNotValidException::class);
98 $this->expectExceptionCode(1489486301);
100 $gridContainer->addElement($element);
109 $element = $this->createMock(GridRowInterface::class);
112 $gridContainer = $this->getAccessibleMockForAbstractClass(
113 GridContainer::class,
122 $gridContainer->expects($this->once())->method(
'addRenderable');
123 $gridContainer->addElement($element);