diff --git a/composer.json b/composer.json index 39a980a..a7dfe9c 100644 --- a/composer.json +++ b/composer.json @@ -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" + } + ] } diff --git a/src/Plugin.php b/src/Plugin.php index e6b1e1f..23a4952 100644 --- a/src/Plugin.php +++ b/src/Plugin.php @@ -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'], @@ -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 diff --git a/tests/ContractTest.php b/tests/ContractTest.php index 010469b..94a40c4 100644 --- a/tests/ContractTest.php +++ b/tests/ContractTest.php @@ -108,8 +108,6 @@ public function testRegistersItsIdentityAndHooks(): void $this->assertSame( [ - 'plugin.install', - 'plugin.uninstall', 'licenses.settings', 'licenses.activate', 'licenses.reactivate', diff --git a/tests/PluginTest.php b/tests/PluginTest.php index 2328885..c837de7 100644 --- a/tests/PluginTest.php +++ b/tests/PluginTest.php @@ -133,8 +133,6 @@ public function testGetHooksReturnsExpectedKeys(): void $this->assertIsArray($hooks); $expectedKeys = [ - 'plugin.install', - 'plugin.uninstall', 'licenses.settings', 'licenses.activate', 'licenses.reactivate', @@ -156,7 +154,7 @@ public function testGetHooksReturnsExpectedKeys(): void public function testGetHooksCount(): void { $hooks = Plugin::getHooks(); - $this->assertCount(10, $hooks); + $this->assertCount(8, $hooks); } /** @@ -207,8 +205,6 @@ public function testModuleBasedHookKeysUseCorrectPrefix(): void public function testEventHandlerMethodSignatures(): void { $eventMethods = [ - 'getInstall', - 'getUninstall', 'getActivate', 'getDeactivate', 'getDeactivateIp', @@ -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); } /** @@ -286,8 +282,6 @@ public function testPublicMethodCount(): void public function testEventHandlerReturnTypes(): void { $eventMethods = [ - 'getInstall', - 'getUninstall', 'getActivate', 'getDeactivate', 'getDeactivateIp', diff --git a/tests/SourceFileAnalysisTest.php b/tests/SourceFileAnalysisTest.php index 91e81ed..8527e56 100644 --- a/tests/SourceFileAnalysisTest.php +++ b/tests/SourceFileAnalysisTest.php @@ -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. */