Skip to content

Commit 8be8353

Browse files
committed
updates adding tests in and updating readme/composer file
1 parent 180593f commit 8be8353

6 files changed

Lines changed: 894 additions & 20 deletions

File tree

.github/workflows/tests.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: Tests
2+
3+
on:
4+
push:
5+
branches: [master]
6+
pull_request:
7+
branches: [master]
8+
9+
jobs:
10+
tests:
11+
runs-on: ubuntu-latest
12+
strategy:
13+
matrix:
14+
php-version: ['8.1', '8.2', '8.3']
15+
16+
name: PHP ${{ matrix.php-version }}
17+
18+
steps:
19+
- name: Checkout code
20+
uses: actions/checkout@v4
21+
22+
- name: Setup PHP
23+
uses: shivammathur/setup-php@v2
24+
with:
25+
php-version: ${{ matrix.php-version }}
26+
extensions: soap
27+
coverage: xdebug
28+
29+
- name: Install dependencies
30+
run: composer install --prefer-dist --no-progress
31+
32+
- name: Run tests
33+
run: vendor/bin/phpunit --coverage-text

README.md

Lines changed: 39 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,53 @@
1-
# Cpanel Addon for VPS Module in MyAdmin
1+
# cPanel VPS Addon for MyAdmin
22

3-
Cpanel Addon for VPS Module in MyAdmin
3+
[![Tests](https://github.com/detain/myadmin-cpanel-vps-addon/actions/workflows/tests.yml/badge.svg)](https://github.com/detain/myadmin-cpanel-vps-addon/actions/workflows/tests.yml)
4+
[![Latest Stable Version](https://poser.pugx.org/detain/myadmin-cpanel-vps-addon/version)](https://packagist.org/packages/detain/myadmin-cpanel-vps-addon)
5+
[![Total Downloads](https://poser.pugx.org/detain/myadmin-cpanel-vps-addon/downloads)](https://packagist.org/packages/detain/myadmin-cpanel-vps-addon)
6+
[![License](https://poser.pugx.org/detain/myadmin-cpanel-vps-addon/license)](https://packagist.org/packages/detain/myadmin-cpanel-vps-addon)
47

5-
## Build Status and Code Analysis
8+
A MyAdmin plugin that provides cPanel license management as a VPS addon. This package integrates with the MyAdmin hosting management platform to allow automated provisioning, activation, and deactivation of cPanel licenses on VPS instances.
69

7-
Site | Status
8-
--------------|---------------------------
9-
![Travis-CI](http://i.is.cc/storage/GYd75qN.png "Travis-CI") | [![Build Status](https://travis-ci.org/detain/myadmin-cpanel-vps-addon.svg?branch=master)](https://travis-ci.org/detain/myadmin-cpanel-vps-addon)
10-
![CodeClimate](http://i.is.cc/storage/GYlageh.png "CodeClimate") | [![Code Climate](https://codeclimate.com/github/detain/myadmin-cpanel-vps-addon/badges/gpa.svg)](https://codeclimate.com/github/detain/myadmin-cpanel-vps-addon) [![Test Coverage](https://codeclimate.com/github/detain/myadmin-cpanel-vps-addon/badges/coverage.svg)](https://codeclimate.com/github/detain/myadmin-cpanel-vps-addon/coverage) [![Issue Count](https://codeclimate.com/github/detain/myadmin-cpanel-vps-addon/badges/issue_count.svg)](https://codeclimate.com/github/detain/myadmin-cpanel-vps-addon)
11-
![Scrutinizer](http://i.is.cc/storage/GYeUnux.png "Scrutinizer") | [![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/myadmin-plugins/cpanel-vps-addon/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/myadmin-plugins/cpanel-vps-addon/?branch=master) [![Code Coverage](https://scrutinizer-ci.com/g/myadmin-plugins/cpanel-vps-addon/badges/coverage.png?b=master)](https://scrutinizer-ci.com/g/myadmin-plugins/cpanel-vps-addon/?branch=master) [![Build Status](https://scrutinizer-ci.com/g/myadmin-plugins/cpanel-vps-addon/badges/build.png?b=master)](https://scrutinizer-ci.com/g/myadmin-plugins/cpanel-vps-addon/build-status/master)
12-
![Codacy](http://i.is.cc/storage/GYi66Cx.png "Codacy") | [![Codacy Badge](https://api.codacy.com/project/badge/Grade/226251fc068f4fd5b4b4ef9a40011d06)](https://www.codacy.com/app/detain/myadmin-cpanel-vps-addon) [![Codacy Badge](https://api.codacy.com/project/badge/Coverage/25fa74eb74c947bf969602fcfe87e349)](https://www.codacy.com/app/detain/myadmin-cpanel-vps-addon?utm_source=github.com&utm_medium=referral&utm_content=detain/myadmin-cpanel-vps-addon&utm_campaign=Badge_Coverage)
13-
![Coveralls](http://i.is.cc/storage/GYjNSim.png "Coveralls") | [![Coverage Status](https://coveralls.io/repos/github/detain/db_abstraction/badge.svg?branch=master)](https://coveralls.io/github/detain/myadmin-cpanel-vps-addon?branch=master)
14-
![Packagist](http://i.is.cc/storage/GYacBEX.png "Packagist") | [![Latest Stable Version](https://poser.pugx.org/detain/myadmin-cpanel-vps-addon/version)](https://packagist.org/packages/detain/myadmin-cpanel-vps-addon) [![Total Downloads](https://poser.pugx.org/detain/myadmin-cpanel-vps-addon/downloads)](https://packagist.org/packages/detain/myadmin-cpanel-vps-addon) [![Latest Unstable Version](https://poser.pugx.org/detain/myadmin-cpanel-vps-addon/v/unstable)](//packagist.org/packages/detain/myadmin-cpanel-vps-addon) [![Monthly Downloads](https://poser.pugx.org/detain/myadmin-cpanel-vps-addon/d/monthly)](https://packagist.org/packages/detain/myadmin-cpanel-vps-addon) [![Daily Downloads](https://poser.pugx.org/detain/myadmin-cpanel-vps-addon/d/daily)](https://packagist.org/packages/detain/myadmin-cpanel-vps-addon) [![License](https://poser.pugx.org/detain/myadmin-cpanel-vps-addon/license)](https://packagist.org/packages/detain/myadmin-cpanel-vps-addon)
10+
## Features
1511

12+
- Automated cPanel license activation when a VPS addon is purchased
13+
- Automated cPanel license deactivation on cancellation with admin email notification
14+
- IP-based license status checking before activation/deactivation
15+
- Integration with MyAdmin's event dispatcher for hook-based plugin loading
16+
- Configurable addon cost via the MyAdmin settings interface
1617

1718
## Installation
1819

19-
Install with composer like
20+
Install via Composer:
2021

2122
```sh
2223
composer require detain/myadmin-cpanel-vps-addon
2324
```
2425

25-
## License
26+
The package registers itself automatically through the MyAdmin plugin system. The following event hooks are registered:
27+
28+
| Event | Handler | Purpose |
29+
|-------------------------|--------------------|--------------------------------------------|
30+
| `function.requirements` | `getRequirements` | Registers the page requirement function |
31+
| `vps.load_addons` | `getAddon` | Registers the cPanel addon with the VPS module |
32+
| `vps.settings` | `getSettings` | Adds the cPanel cost setting to the admin UI |
33+
34+
## Configuration
35+
36+
The addon cost is configurable through the MyAdmin admin panel under VPS module settings. The setting `VPS_CPANEL_COST` controls the price charged for the cPanel license addon.
2637

27-
The Cpanel Addon for VPS Module in MyAdmin class is licensed under the LGPL-v2.1 license.
38+
## Running Tests
39+
40+
```sh
41+
composer install
42+
vendor/bin/phpunit
43+
```
44+
45+
To generate a coverage report:
46+
47+
```sh
48+
vendor/bin/phpunit --coverage-html build/coverage
49+
```
50+
51+
## License
2852

53+
This package is licensed under the [LGPL-2.1](https://www.gnu.org/licenses/old-licenses/lgpl-2.1.html) license.

composer.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,16 +26,16 @@
2626
"detain/cpanel-licensing": "dev-master"
2727
},
2828
"require-dev": {
29-
"phpunit/phpunit": "*",
30-
"phpunit/phpunit-mock-objects": "*",
31-
"vlucas/phpdotenv": "*",
32-
"codeclimate/php-test-reporter": "*",
33-
"satooshi/php-coveralls": "*",
34-
"codacy/coverage": "*"
29+
"phpunit/phpunit": "^9.6"
3530
},
3631
"autoload": {
3732
"psr-4": {
3833
"Detain\\MyAdminVpsCpanel\\": "src/"
3934
}
35+
},
36+
"autoload-dev": {
37+
"psr-4": {
38+
"Detain\\MyAdminVpsCpanel\\Tests\\": "tests/"
39+
}
4040
}
4141
}

phpunit.xml.dist

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.6/phpunit.xsd"
4+
bootstrap="vendor/autoload.php"
5+
colors="true"
6+
verbose="true"
7+
failOnRisky="true"
8+
failOnWarning="true"
9+
cacheResultFile=".phpunit.cache/test-results">
10+
<testsuites>
11+
<testsuite name="Unit">
12+
<directory suffix="Test.php">tests</directory>
13+
</testsuite>
14+
</testsuites>
15+
<coverage cacheDirectory=".phpunit.cache/code-coverage"
16+
processUncoveredFiles="true">
17+
<include>
18+
<directory suffix=".php">src</directory>
19+
</include>
20+
<report>
21+
<html outputDirectory="build/coverage"/>
22+
<text outputFile="php://stdout" showOnlySummary="true"/>
23+
<clover outputFile="build/logs/clover.xml"/>
24+
</report>
25+
</coverage>
26+
</phpunit>

0 commit comments

Comments
 (0)