Skip to content

Commit cc70e49

Browse files
committed
Drop support for unitFromSuffix
1 parent 88f017e commit cc70e49

File tree

2 files changed

+0
-37
lines changed

2 files changed

+0
-37
lines changed

src/SystemCtl.php

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -64,29 +64,6 @@ public static function setTimeout(int $timeout): void
6464
self::$timeout = $timeout;
6565
}
6666

67-
/**
68-
* @param string $unitSuffix
69-
* @param string $unitName
70-
*
71-
* @return UnitInterface
72-
* @throws UnitTypeNotSupportedException
73-
* @deprecated This static method is deprecated, please refer to a specifc get method for a unit
74-
*/
75-
public static function unitFromSuffix(string $unitSuffix, string $unitName): UnitInterface
76-
{
77-
$unitClass = 'SystemCtl\\Unit\\' . ucfirst($unitSuffix);
78-
79-
if (!class_exists($unitClass)) {
80-
throw new UnitTypeNotSupportedException('Unit type ' . $unitSuffix . ' not supported');
81-
}
82-
83-
$commandDispatcher = (new SymfonyCommandDispatcher)
84-
->setTimeout(self::$timeout)
85-
->setBinary(self::$binary);
86-
87-
return new $unitClass($unitName, $commandDispatcher);
88-
}
89-
9067
/**
9168
* List all supported units
9269
*

tests/Integration/SystemCtlTest.php

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -89,20 +89,6 @@ public function testListUnitsWithSupportedUnits()
8989
$this->assertCount(5, $units);
9090
}
9191

92-
public function testCreateUnitFromSupportedSuffixShouldWord()
93-
{
94-
$unit = SystemCtl::unitFromSuffix('service', 'SuccessService');
95-
$this->assertInstanceOf(UnitInterface::class, $unit);
96-
$this->assertInstanceOf(Service::class, $unit);
97-
$this->assertEquals('SuccessService', $unit->getName());
98-
}
99-
100-
public function testCreateUnitFromUnsupportedSuffixShouldRaiseException()
101-
{
102-
$this->expectException(UnitTypeNotSupportedException::class);
103-
SystemCtl::unitFromSuffix('unsupported', 'FailUnit');
104-
}
105-
10692
public function testGetServices()
10793
{
10894
$output = <<<EOT

0 commit comments

Comments
 (0)