Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
92 changes: 49 additions & 43 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,45 +1,51 @@
{
"name": "detain/myadmin-cloudlinux-licensing",
"type": "myadmin-plugin",
"description": "Cloudlinux Licensing Class",
"keywords": [
"cloudlinux",
"administration",
"license"
],
"license": "LGPL-2.1-only",
"authors": [
{
"name": "Joe Huss",
"homepage": "https:\/\/my.interserver.net\/"
}
],
"config": {
"bin-dir": "vendor\/bin",
"minimum-stability": "dev",
"allow-plugins": {
"detain/myadmin-plugin-installer": true
}
},
"require": {
"php": ">=5.3.0",
"pear/xml_rpc2": "*",
"ext-curl": "*",
"symfony/event-dispatcher": "*@stable",
"detain/myadmin-plugin-installer": "^2.1",
"detain/cloudlinux-licensing": "dev-master"
},
"require-dev": {
"phpunit/phpunit": "^9.6"
},
"autoload": {
"psr-4": {
"Detain\\MyAdminCloudlinux\\": "src/"
}
},
"autoload-dev": {
"psr-4": {
"Detain\\MyAdminCloudlinux\\Tests\\": "tests/"
}
}
"name": "detain/myadmin-cloudlinux-licensing",
"type": "myadmin-plugin",
"description": "Cloudlinux Licensing Class",
"keywords": [
"cloudlinux",
"administration",
"license"
],
"license": "LGPL-2.1-only",
"authors": [
{
"name": "Joe Huss",
"homepage": "https://my.interserver.net/"
}
],
"config": {
"bin-dir": "vendor/bin",
"minimum-stability": "dev",
"allow-plugins": {
"detain/myadmin-plugin-installer": true
}
},
"require": {
"php": ">=5.3.0",
"pear/xml_rpc2": "^1.1.6",
"ext-curl": "*",
"symfony/event-dispatcher": "*@stable",
"detain/myadmin-plugin-installer": "^2.1",
"detain/cloudlinux-licensing": "dev-master"
},
"require-dev": {
"phpunit/phpunit": "^9.6"
},
"autoload": {
"psr-4": {
"Detain\\MyAdminCloudlinux\\": "src/"
}
},
"autoload-dev": {
"psr-4": {
"Detain\\MyAdminCloudlinux\\Tests\\": "tests/"
}
},
"repositories": [
{
"type": "vcs",
"url": "https://github.com/myadmin-plugins/XML_RPC2.git"
}
]
}
29 changes: 0 additions & 29 deletions src/Plugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,6 @@ public function __construct()
public static function getHooks()
{
return [
'plugin.install' => [__CLASS__, 'getInstall'],
'plugin.uninstall' => [__CLASS__, 'getUninstall'],
self::$module.'.settings' => [__CLASS__, 'getSettings'],
self::$module.'.activate' => [__CLASS__, 'getActivate'],
self::$module.'.reactivate' => [__CLASS__, 'getActivate'],
Expand All @@ -45,33 +43,6 @@ public static function getHooks()
];
}

/**
* @param \Symfony\Component\EventDispatcher\GenericEvent $event
*/
public static function getInstall(GenericEvent $event)
{
$plugin = $event->getSubject();
$serviceCategory = $plugin->addServiceCategory(self::$module, 'cloudlinux', 'CloudLinux');
$plugin->addDefine('SERVICE_TYPES_CLOUDLINUX', $serviceCategory);
$serviceType = $plugin->addServiceType($serviceCategory, self::$module, 'CloudLinux');
$plugin->addService($serviceCategory, $serviceType, self::$module, 'CloudLinux License', 10.00, 0, 1, 1, '');
$plugin->addService($serviceCategory, $serviceType, self::$module, 'KernelCare License', 2.95, 0, 1, 16, '');
$plugin->addService($serviceCategory, $serviceType, self::$module, 'ImunityAV+', 6, 0, 1, 40, '');
$plugin->addService($serviceCategory, $serviceType, self::$module, 'Imunity360 single user', 12, 0, 1, 41, '');
$plugin->addService($serviceCategory, $serviceType, self::$module, 'Imunity360 up to 30 users', 25, 0, 1, 42, '');
$plugin->addService($serviceCategory, $serviceType, self::$module, 'Imunity360 up to 250 users', 35, 0, 1, 43, '');
$plugin->addService($serviceCategory, $serviceType, self::$module, 'Imunity360 unlimited users', 45, 0, 1, 49, '');
}

/**
* @param \Symfony\Component\EventDispatcher\GenericEvent $event
*/
public static function getUninstall(GenericEvent $event)
{
$plugin = $event->getSubject();
$plugin->disableServiceCategory(self::$module, 'cloudlinux');
}

/**
* @param \Symfony\Component\EventDispatcher\GenericEvent $event
* @throws \Detain\Cloudlinux\XmlRpcException
Expand Down
2 changes: 0 additions & 2 deletions tests/ContractTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,6 @@ public function testRegistersItsIdentityAndHooks(): void

$this->assertSame(
[
'plugin.install',
'plugin.uninstall',
'licenses.settings',
'licenses.activate',
'licenses.reactivate',
Expand Down
10 changes: 2 additions & 8 deletions tests/PluginTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -133,8 +133,6 @@ public function testGetHooksReturnsExpectedKeys(): void
$this->assertIsArray($hooks);

$expectedKeys = [
'plugin.install',
'plugin.uninstall',
'licenses.settings',
'licenses.activate',
'licenses.reactivate',
Expand All @@ -156,7 +154,7 @@ public function testGetHooksReturnsExpectedKeys(): void
public function testGetHooksCount(): void
{
$hooks = Plugin::getHooks();
$this->assertCount(10, $hooks);
$this->assertCount(8, $hooks);
}

/**
Expand Down Expand Up @@ -207,8 +205,6 @@ public function testModuleBasedHookKeysUseCorrectPrefix(): void
public function testEventHandlerMethodSignatures(): void
{
$eventMethods = [
'getInstall',
'getUninstall',
'getActivate',
'getDeactivate',
'getDeactivateIp',
Expand Down Expand Up @@ -276,7 +272,7 @@ public function testClassIsNotAbstractOrFinal(): void
public function testPublicMethodCount(): void
{
$publicMethods = $this->reflection->getMethods(\ReflectionMethod::IS_PUBLIC);
$this->assertCount(11, $publicMethods);
$this->assertCount(9, $publicMethods);
}

/**
Expand All @@ -286,8 +282,6 @@ public function testPublicMethodCount(): void
public function testEventHandlerReturnTypes(): void
{
$eventMethods = [
'getInstall',
'getUninstall',
'getActivate',
'getDeactivate',
'getDeactivateIp',
Expand Down
13 changes: 0 additions & 13 deletions tests/SourceFileAnalysisTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -236,19 +236,6 @@ public function testPluginHasClassDocBlock(): void
$this->assertStringContainsString('@package', $content);
}

/**
* Tests that the getInstall handler registers multiple services.
* CloudLinux offers several license types: CloudLinux, KernelCare, and Imunify variants.
*/
public function testGetInstallRegistersMultipleServices(): void
{
$content = file_get_contents($this->srcDir . '/Plugin.php');
$this->assertStringContainsString('CloudLinux License', $content);
$this->assertStringContainsString('KernelCare License', $content);
$this->assertStringContainsString('ImunityAV+', $content);
$this->assertStringContainsString('Imunity360', $content);
}

/**
* Tests that the getRequirements handler registers all expected page/function requirements.
*/
Expand Down
Loading