Skip to content

Commit fb1377b

Browse files
committed
updates adding tests in and updating readme/composer file
1 parent 1f816ca commit fb1377b

7 files changed

Lines changed: 1261 additions & 14 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, main]
6+
pull_request:
7+
branches: [master, main]
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: curl, mbstring
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 --verbose

README.md

Lines changed: 48 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,52 @@
1+
# MyAdmin DirectAdmin Webhosting Plugin
12

2-
API Info and Docs at https://www.directadmin.com/api.php
3+
[![Tests](https://github.com/detain/myadmin-directadmin-webhosting/actions/workflows/tests.yml/badge.svg)](https://github.com/detain/myadmin-directadmin-webhosting/actions/workflows/tests.yml)
4+
[![License: LGPL-2.1](https://img.shields.io/badge/License-LGPL%20v2.1-blue.svg)](https://opensource.org/licenses/LGPL-2.1)
35

4-
httpsocket from http://files.directadmin.com/services/all/httpsocket/httpsocket.php
6+
MyAdmin plugin for DirectAdmin web hosting management. Provides automated provisioning, suspension, reactivation, termination, and single-sign-on (SSO) login for DirectAdmin-based hosting accounts through the DirectAdmin API.
57

6-
sample at http://www.directadmin.com/sample_api.txt
8+
## Features
79

8-
more examples at http://files.directadmin.com/services/all/httpsocket/examples/
10+
- Automated account creation (user and reseller) via DirectAdmin API
11+
- Service suspension, unsuspension, and termination
12+
- One-time URL login key generation for SSO
13+
- IP address change support
14+
- Event-driven architecture using Symfony EventDispatcher
15+
- Built-in HTTPSocket class for DirectAdmin API communication
16+
17+
## Requirements
18+
19+
- PHP >= 5.0
20+
- ext-curl
21+
- Symfony EventDispatcher ^5.0
22+
23+
## Installation
24+
25+
```bash
26+
composer require detain/myadmin-directadmin-webhosting
27+
```
28+
29+
## Usage
30+
31+
The plugin registers event hooks automatically when loaded by the MyAdmin plugin system. It listens for webhosting lifecycle events (activate, deactivate, reactivate, terminate) and handles DirectAdmin API interactions.
32+
33+
## API Reference
34+
35+
- **Plugin** - Main plugin class providing event handlers for the MyAdmin system
36+
- **HTTPSocket** - HTTP client class for communicating with the DirectAdmin API over curl
37+
38+
## Running Tests
39+
40+
```bash
41+
composer install
42+
vendor/bin/phpunit
43+
```
44+
45+
## License
46+
47+
This package is licensed under the [LGPL-2.1](LICENSE).
48+
49+
## Links
50+
51+
- [DirectAdmin API Documentation](https://www.directadmin.com/api.php)
52+
- [InterServer](https://my.interserver.net/)

composer.json

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,24 @@
11
{
22
"name": "detain/myadmin-directadmin-webhosting",
33
"type": "myadmin-plugin",
4-
"description": "Directadmin Webhosting Class",
4+
"description": "MyAdmin DirectAdmin Webhosting plugin providing automated provisioning, suspension, termination, and single-sign-on for DirectAdmin-based web hosting services via the DirectAdmin API.",
55
"keywords": [
66
"directadmin",
77
"administration",
8-
"webhosting"
8+
"webhosting",
9+
"myadmin",
10+
"provisioning",
11+
"hosting"
912
],
1013
"license": "LGPL-2.1-only",
1114
"authors": [
1215
{
1316
"name": "Joe Huss",
14-
"homepage": "https:\/\/my.interserver.net\/"
17+
"homepage": "https://my.interserver.net/"
1518
}
1619
],
1720
"config": {
18-
"bin-dir": "vendor\/bin",
21+
"bin-dir": "vendor/bin",
1922
"minimum-stability": "dev"
2023
},
2124
"require": {
@@ -25,16 +28,16 @@
2528
"detain/myadmin-plugin-installer": "dev-master"
2629
},
2730
"require-dev": {
28-
"phpunit/phpunit": "*",
29-
"phpunit/phpunit-mock-objects": "*",
30-
"vlucas/phpdotenv": "*",
31-
"codeclimate/php-test-reporter": "dev-master",
32-
"satooshi/php-coveralls": "*",
33-
"codacy/coverage": "dev-master"
31+
"phpunit/phpunit": "^9.6"
3432
},
3533
"autoload": {
3634
"psr-4": {
3735
"Detain\\MyAdminDirectAdminWeb\\": "src/"
3836
}
37+
},
38+
"autoload-dev": {
39+
"psr-4": {
40+
"Detain\\MyAdminDirectAdminWeb\\Tests\\": "tests/"
41+
}
3942
}
4043
}

phpunit.xml.dist

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd"
4+
bootstrap="vendor/autoload.php"
5+
colors="true"
6+
verbose="true"
7+
failOnRisky="true"
8+
failOnWarning="true"
9+
beStrictAboutTestsThatDoNotTestAnything="true">
10+
<testsuites>
11+
<testsuite name="Unit">
12+
<directory>tests</directory>
13+
</testsuite>
14+
</testsuites>
15+
<coverage>
16+
<include>
17+
<directory suffix=".php">src</directory>
18+
</include>
19+
</coverage>
20+
</phpunit>

0 commit comments

Comments
 (0)