[ 'id' => 'mock-dropdown', 'label' => 'Mock Dropdown', 'class' => 'some-class', 'icon' => null, 'tooltip' => 'A tooltip for the dropdown', 'expectedClasses' => 'some-class', 'expectedIconButtonClasses' => '', ], 'Dropdown with icon' => [ 'id' => 'mock-icon-dropdown', 'label' => 'Mock Icon Dropdown', 'class' => 'some-icon-class', 'icon' => 'icon-some', 'tooltip' => 'A tooltip for the icon dropdown', 'expectedClasses' => 'some-icon-class', 'expectedIconButtonClasses' => 'cdx-button--icon-only', ], ]; } /** * @covers ::getTemplateData * @dataProvider provideDropdownData */ public function testGetTemplateData( string $id, string $label, string $class, $icon, string $tooltip, string $expectedClasses, string $expectedIconButtonClasses ) { // Create a new VectorComponentDropdown object $dropdown = new VectorComponentDropdown( $id, $label, $class, $icon, $tooltip ); // Call the getTemplateData method $templateData = $dropdown->getTemplateData(); // Verifying that the template data is constructed as expected $this->assertEquals( $id, $templateData['id'] ); $this->assertEquals( $label, $templateData['label'] ); $this->assertEquals( $expectedClasses, $templateData['class'] ); $this->assertEquals( $icon, $templateData['icon'] ); $this->assertEquals( $tooltip, $templateData['html-tooltip'] ); // Verifying that the label-class is constructed as expected $this->assertStringContainsString( $expectedIconButtonClasses, $templateData['label-class'] ); } }