Skip to content

Commit bb5cf48

Browse files
committed
feat(AbstractType): show icon along name in tab
1 parent c466133 commit bb5cf48

File tree

4 files changed

+13
-3
lines changed

4 files changed

+13
-3
lines changed

src/AbstractType.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,12 @@ abstract class AbstractType extends CommonDBChild
4242
{
4343
public static $rightname = 'dropdown';
4444

45+
46+
public static function getIcon(): string
47+
{
48+
return 'fa-solid fa-solar-panel';
49+
}
50+
4551
/**
4652
* @todo fix type name
4753
*/
@@ -55,6 +61,7 @@ public function getTabNameForItem(CommonGLPI $item, $withtemplate = 0)
5561
$tabName = '';
5662
if (!$withtemplate) {
5763
if ($item->getType() == static::$itemtype) {
64+
return self::createTabEntry(__('Carbon', 'carbon'), 0);
5865
$tabName = __('Carbon', 'carbon');
5966
}
6067
}

tests/units/ComputerTypeTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,8 @@ public function testGetTabNameForItem()
5252
$glpi_computer_type = $this->createItem(GlpiComputerType::class);
5353
$instance = new ComputerType();
5454
$result = $instance->getTabNameForItem($glpi_computer_type);
55-
$this->assertEquals('Carbon', $result);
55+
$crawler = new Crawler($result);
56+
$this->assertEquals('Carbon', $crawler->text());
5657

5758
$result = $instance->getTabNameForItem($glpi_computer_type, 1);
5859
$this->assertEquals('', $result);

tests/units/MonitorTypeTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,8 @@ public function testGetTabNameForItem()
5454
$glpi_monitor_type = $this->createItem(GlpiMonitorType::class);
5555
$instance = new MonitorType();
5656
$result = $instance->getTabNameForItem($glpi_monitor_type);
57-
$this->assertEquals('Carbon', $result);
57+
$crawler = new Crawler($result);
58+
$this->assertEquals('Carbon', $crawler->text());
5859

5960
$result = $instance->getTabNameForItem($glpi_monitor_type, 1);
6061
$this->assertEquals('', $result);

tests/units/NetworkEquipmentTypeTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,8 @@ public function testGetTabNameForItem()
5555
$glpi_networkequipment_type = $this->createItem(GlpiNetworkEquipmentType::class);
5656
$instance = new NetworkEquipmentType();
5757
$result = $instance->getTabNameForItem($glpi_networkequipment_type);
58-
$this->assertEquals('Carbon', $result);
58+
$crawler = new Crawler($result);
59+
$this->assertEquals('Carbon', $crawler->text());
5960

6061
$result = $instance->getTabNameForItem($glpi_networkequipment_type, 1);
6162
$this->assertEquals('', $result);

0 commit comments

Comments
 (0)