Skip to content

Commit f4aefbd

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

9 files changed

Lines changed: 1402 additions & 28 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.2', '8.3', '8.4']
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, curl, mbstring
27+
coverage: none
28+
29+
- name: Install dependencies
30+
run: composer install --no-interaction --prefer-dist
31+
32+
- name: Run tests
33+
run: vendor/bin/phpunit --no-coverage

README.md

Lines changed: 43 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,57 @@
1-
# Webuzo handling plugin for MyAdmin
1+
# MyAdmin Webuzo VPS Plugin
22

3-
Webuzo handling plugin for MyAdmin
3+
[![Build Status](https://github.com/detain/myadmin-webuzo-vps/actions/workflows/tests.yml/badge.svg)](https://github.com/detain/myadmin-webuzo-vps/actions)
4+
[![Latest Stable Version](https://poser.pugx.org/detain/myadmin-webuzo-vps/version)](https://packagist.org/packages/detain/myadmin-webuzo-vps)
5+
[![Total Downloads](https://poser.pugx.org/detain/myadmin-webuzo-vps/downloads)](https://packagist.org/packages/detain/myadmin-webuzo-vps)
6+
[![License](https://poser.pugx.org/detain/myadmin-webuzo-vps/license)](https://packagist.org/packages/detain/myadmin-webuzo-vps)
47

5-
## Build Status and Code Analysis
8+
Webuzo VPS management plugin for the [MyAdmin](https://github.com/detain/myadmin) control panel framework. This package provides full integration with the Webuzo and Softaculous APIs, enabling automated provisioning, script installation, domain management, backup operations, and system application control on VPS servers.
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-webuzo-vps.svg?branch=master)](https://travis-ci.org/detain/myadmin-webuzo-vps)
10-
![CodeClimate](http://i.is.cc/storage/GYlageh.png "CodeClimate") | [![Code Climate](https://codeclimate.com/github/detain/myadmin-webuzo-vps/badges/gpa.svg)](https://codeclimate.com/github/detain/myadmin-webuzo-vps) [![Test Coverage](https://codeclimate.com/github/detain/myadmin-webuzo-vps/badges/coverage.svg)](https://codeclimate.com/github/detain/myadmin-webuzo-vps/coverage) [![Issue Count](https://codeclimate.com/github/detain/myadmin-webuzo-vps/badges/issue_count.svg)](https://codeclimate.com/github/detain/myadmin-webuzo-vps)
11-
![Scrutinizer](http://i.is.cc/storage/GYeUnux.png "Scrutinizer") | [![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/myadmin-plugins/webuzo-vps/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/myadmin-plugins/webuzo-vps/?branch=master) [![Code Coverage](https://scrutinizer-ci.com/g/myadmin-plugins/webuzo-vps/badges/coverage.png?b=master)](https://scrutinizer-ci.com/g/myadmin-plugins/webuzo-vps/?branch=master) [![Build Status](https://scrutinizer-ci.com/g/myadmin-plugins/webuzo-vps/badges/build.png?b=master)](https://scrutinizer-ci.com/g/myadmin-plugins/webuzo-vps/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-webuzo-vps) [![Codacy Badge](https://api.codacy.com/project/badge/Coverage/25fa74eb74c947bf969602fcfe87e349)](https://www.codacy.com/app/detain/myadmin-webuzo-vps?utm_source=github.com&utm_medium=referral&utm_content=detain/myadmin-webuzo-vps&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-webuzo-vps?branch=master)
14-
![Packagist](http://i.is.cc/storage/GYacBEX.png "Packagist") | [![Latest Stable Version](https://poser.pugx.org/detain/myadmin-webuzo-vps/version)](https://packagist.org/packages/detain/myadmin-webuzo-vps) [![Total Downloads](https://poser.pugx.org/detain/myadmin-webuzo-vps/downloads)](https://packagist.org/packages/detain/myadmin-webuzo-vps) [![Latest Unstable Version](https://poser.pugx.org/detain/myadmin-webuzo-vps/v/unstable)](//packagist.org/packages/detain/myadmin-webuzo-vps) [![Monthly Downloads](https://poser.pugx.org/detain/myadmin-webuzo-vps/d/monthly)](https://packagist.org/packages/detain/myadmin-webuzo-vps) [![Daily Downloads](https://poser.pugx.org/detain/myadmin-webuzo-vps/d/daily)](https://packagist.org/packages/detain/myadmin-webuzo-vps) [![License](https://poser.pugx.org/detain/myadmin-webuzo-vps/license)](https://packagist.org/packages/detain/myadmin-webuzo-vps)
10+
## Features
1511

12+
- Automated Webuzo VPS configuration and initial setup (LAMP stack provisioning)
13+
- Script installation, removal, import, and upgrade via the Softaculous/Webuzo SDK
14+
- Domain management (add, remove, list)
15+
- Backup creation, restoration, download, and removal
16+
- System application installation and removal
17+
- FTP user management, database management, DNS record management
18+
- Cron job management, service control, and security settings
19+
- Event-driven architecture using Symfony EventDispatcher
20+
21+
## Requirements
22+
23+
- PHP 8.2 or higher
24+
- ext-soap
25+
- ext-curl
26+
- Symfony EventDispatcher 5.x, 6.x, or 7.x
1627

1728
## Installation
1829

19-
Install with composer like
30+
Install via Composer:
2031

2132
```sh
2233
composer require detain/myadmin-webuzo-vps
2334
```
2435

25-
## License
36+
## Usage
37+
38+
The plugin registers itself through the MyAdmin plugin system using Symfony event hooks. It exposes page requirements for each Webuzo feature through the `function.requirements` event.
39+
40+
```php
41+
use Detain\MyAdminWebuzo\Plugin;
42+
43+
// Get registered hooks
44+
$hooks = Plugin::getHooks();
45+
// Returns: ['function.requirements' => [Plugin::class, 'getRequirements']]
46+
```
47+
48+
## Running Tests
49+
50+
```sh
51+
composer install
52+
vendor/bin/phpunit
53+
```
2654

27-
The Webuzo handling plugin for MyAdmin class is licensed under the LGPL-v2.1 license.
55+
## License
2856

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

composer.json

Lines changed: 20 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,46 @@
11
{
22
"name": "detain/myadmin-webuzo-vps",
33
"type": "myadmin-plugin",
4-
"description": "Webuzo handling plugin for MyAdmin",
4+
"description": "Webuzo VPS management plugin for MyAdmin — provides integration with the Webuzo/Softaculous control panel API for automated script installation, domain management, backup operations, and system application provisioning on VPS servers.",
55
"keywords": [
6-
"abuse",
6+
"webuzo",
7+
"vps",
8+
"softaculous",
9+
"myadmin",
10+
"plugin",
11+
"hosting",
712
"administration",
8-
"spam"
13+
"server-management"
914
],
1015
"license": "LGPL-2.1-only",
1116
"authors": [
1217
{
1318
"name": "Joe Huss",
14-
"homepage": "https:\/\/my.interserver.net\/"
19+
"homepage": "https://my.interserver.net/"
1520
}
1621
],
1722
"config": {
18-
"bin-dir": "vendor\/bin",
23+
"bin-dir": "vendor/bin",
1924
"minimum-stability": "dev"
2025
},
2126
"require": {
22-
"php": ">=5.0.0",
27+
"php": ">=8.2",
2328
"ext-soap": "*",
24-
"symfony/event-dispatcher": "^5.0@stable",
29+
"ext-curl": "*",
30+
"symfony/event-dispatcher": "^5.0||^6.0||^7.0",
2531
"detain/myadmin-plugin-installer": "dev-master"
26-
},
32+
},
2733
"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"
34+
"phpunit/phpunit": "^9.6"
3435
},
3536
"autoload": {
3637
"psr-4": {
3738
"Detain\\MyAdminWebuzo\\": "src/"
3839
}
40+
},
41+
"autoload-dev": {
42+
"psr-4": {
43+
"Detain\\MyAdminWebuzo\\Tests\\": "tests/"
44+
}
3945
}
4046
}

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+
cacheResultFile=".phpunit.cache/test-results">
10+
<testsuites>
11+
<testsuite name="Unit">
12+
<directory suffix="Test.php">tests</directory>
13+
</testsuite>
14+
</testsuites>
15+
<coverage>
16+
<include>
17+
<directory suffix=".php">src</directory>
18+
</include>
19+
</coverage>
20+
</phpunit>

tests/FileExistenceTest.php

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace Detain\MyAdminWebuzo\Tests;
6+
7+
use PHPUnit\Framework\TestCase;
8+
9+
/**
10+
* Tests verifying all expected source files exist in the package.
11+
*
12+
* Ensures the package distribution is complete.
13+
*/
14+
class FileExistenceTest extends TestCase
15+
{
16+
/**
17+
* @var string
18+
*/
19+
private string $srcDir;
20+
21+
protected function setUp(): void
22+
{
23+
$this->srcDir = dirname(__DIR__) . '/src';
24+
}
25+
26+
/**
27+
* Data provider for source file existence checks.
28+
*
29+
* @return array<string, array{0: string}>
30+
*/
31+
public function sourceFileProvider(): array
32+
{
33+
return [
34+
'Plugin.php' => ['Plugin.php'],
35+
'sdk.php' => ['sdk.php'],
36+
'webuzo_sdk.php' => ['webuzo_sdk.php'],
37+
'webuzo.functions.inc.php' => ['webuzo.functions.inc.php'],
38+
'webuzo_configure.php' => ['webuzo_configure.php'],
39+
'webuzo_scripts.php' => ['webuzo_scripts.php'],
40+
'webuzo_edit_installation.php' => ['webuzo_edit_installation.php'],
41+
'webuzo_add_domain.php' => ['webuzo_add_domain.php'],
42+
'webuzo_remove_domain.php' => ['webuzo_remove_domain.php'],
43+
'webuzo_list_domains.php' => ['webuzo_list_domains.php'],
44+
'webuzo_list_backups.php' => ['webuzo_list_backups.php'],
45+
'webuzo_list_installed_scripts.php' => ['webuzo_list_installed_scripts.php'],
46+
'webuzo_list_installed_sysapps.php' => ['webuzo_list_installed_sysapps.php'],
47+
'webuzo_list_sysapps.php' => ['webuzo_list_sysapps.php'],
48+
'webuzo_install_sysapp.php' => ['webuzo_install_sysapp.php'],
49+
'webuzo_import_script.php' => ['webuzo_import_script.php'],
50+
'webuzo_remove_script.php' => ['webuzo_remove_script.php'],
51+
'webuzo_view_script.php' => ['webuzo_view_script.php'],
52+
'webuzo_view_sysapps.php' => ['webuzo_view_sysapps.php'],
53+
'webuzo_randomPassword.php' => ['webuzo_randomPassword.php'],
54+
'webuzo_update_logo.php' => ['webuzo_update_logo.php'],
55+
];
56+
}
57+
58+
/**
59+
* Test that each expected source file exists.
60+
*
61+
* @dataProvider sourceFileProvider
62+
*/
63+
public function testSourceFileExists(string $filename): void
64+
{
65+
$this->assertFileExists(
66+
$this->srcDir . '/' . $filename,
67+
"Source file {$filename} should exist in src/"
68+
);
69+
}
70+
71+
/**
72+
* Test that composer.json exists.
73+
*/
74+
public function testComposerJsonExists(): void
75+
{
76+
$this->assertFileExists(dirname(__DIR__) . '/composer.json');
77+
}
78+
79+
/**
80+
* Test that README.md exists.
81+
*/
82+
public function testReadmeExists(): void
83+
{
84+
$this->assertFileExists(dirname(__DIR__) . '/README.md');
85+
}
86+
}

0 commit comments

Comments
 (0)