getMockLink(), $class, $id ); $templateData = $menuItem->getTemplateData(); $this->assertArrayHasKey( 'array-links', $templateData ); $this->assertArrayHasKey( 'item-class', $templateData ); $this->assertArrayHasKey( 'item-id', $templateData ); $this->assertSame( $expectedClass, $templateData['item-class'] ); $this->assertSame( $expectedId, $templateData['item-id'] ); $this->assertSame( '/test', $templateData['array-links']['href'] ); $this->assertSame( 'Test Link', $templateData['array-links']['text'] ); } public static function provideMenuListItemData(): array { return [ 'minimal parameters' => [ '', '', '', '', ], 'with class and id' => [ 'test-class', 'test-id', 'test-class', 'test-id', ], ]; } private function getMockLink(): CitizenComponentLink&MockObject { $mockLink = $this->createMock( CitizenComponentLink::class ); $mockLink->expects( $this->once() ) ->method( 'getTemplateData' ) ->willReturn( [ 'href' => '/test', 'text' => 'Test Link' ] ); return $mockLink; } }