Commit 99ba838
committed
PHPUnit 12: Fix RendererListTest - use createMock for LayoutInterface
Fixed fatal error: 'Class MockObject_LayoutInterface contains 32 abstract
methods'
LayoutInterface has 32 abstract methods. Using getMockBuilder()->onlyMethods()
with only 2 methods ['getBlock', 'getChildName'] causes a fatal error in
PHPUnit 12.
Solution: Replace with createMock(LayoutInterface::class) which automatically
handles all 32 interface methods. The methods we need (getBlock, getChildName)
can be configured on the mock created by createMock().
This is the same pattern as AdapterInterface (94 methods) and other large
interfaces: For interfaces with 30+ methods, ALWAYS use createMock() or
createStub(), never onlyMethods() with a partial list.1 parent 9fabeb8 commit 99ba838
File tree
1 file changed
+2
-3
lines changed- lib/internal/Magento/Framework/View/Test/Unit/Element
1 file changed
+2
-3
lines changedLines changed: 2 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
50 | 50 | | |
51 | 51 | | |
52 | 52 | | |
53 | | - | |
54 | | - | |
55 | | - | |
| 53 | + | |
| 54 | + | |
56 | 55 | | |
57 | 56 | | |
58 | 57 | | |
| |||
0 commit comments