Skip to content

Commit 01c279b

Browse files
committed
updates adding tests in and updating readme/composer file
1 parent 7a9629e commit 01c279b

25 files changed

Lines changed: 2161 additions & 64 deletions

.github/workflows/tests.yml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
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: ${{ matrix.os }}
12+
strategy:
13+
fail-fast: false
14+
matrix:
15+
os: [ubuntu-latest]
16+
php: ['8.2', '8.3', '8.4']
17+
include:
18+
- os: windows-latest
19+
php: '8.2'
20+
21+
name: PHP ${{ matrix.php }} - ${{ matrix.os }}
22+
23+
steps:
24+
- name: Checkout code
25+
uses: actions/checkout@v4
26+
27+
- name: Setup PHP
28+
uses: shivammathur/setup-php@v2
29+
with:
30+
php-version: ${{ matrix.php }}
31+
extensions: mbstring
32+
coverage: none
33+
34+
- name: Install dependencies
35+
run: composer install --prefer-dist --no-interaction --no-progress
36+
37+
- name: Run tests
38+
run: vendor/bin/phpunit --no-coverage

README.md

Lines changed: 36 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,49 @@
1-
# Composer backed plugin handler and installer for MyAdmin
1+
# MyAdmin Plugin Installer
22

3-
Composer backed plugin handler and installer for MyAdmin
3+
[![Tests](https://github.com/detain/myadmin-plugin-installer/actions/workflows/tests.yml/badge.svg)](https://github.com/detain/myadmin-plugin-installer/actions/workflows/tests.yml)
4+
[![Latest Stable Version](https://poser.pugx.org/detain/myadmin-plugin-installer/version)](https://packagist.org/packages/detain/myadmin-plugin-installer)
5+
[![Total Downloads](https://poser.pugx.org/detain/myadmin-plugin-installer/downloads)](https://packagist.org/packages/detain/myadmin-plugin-installer)
6+
[![License](https://poser.pugx.org/detain/myadmin-plugin-installer/license)](https://packagist.org/packages/detain/myadmin-plugin-installer)
47

5-
## Build Status and Code Analysis
8+
A Composer plugin that provides custom installer logic for the MyAdmin hosting control panel ecosystem. It routes packages to the correct installation directories based on their type and exposes a set of Composer commands for project management tasks.
69

7-
Site | Status
8-
--------------|---------------------------
9-
![Travis-CI](http://i.is.cc/storage/GYd75qN.png "Travis-CI") | [![Build Status](https://travis-ci.org/interserver/myadmin-plugin-installer.svg?branch=master)](https://travis-ci.org/interserver/myadmin-plugin-installer)
10-
![CodeClimate](http://i.is.cc/storage/GYlageh.png "CodeClimate") | [![Code Climate](https://codeclimate.com/github/detain/myadmin-plugin-installer/badges/gpa.svg)](https://codeclimate.com/github/detain/myadmin-plugin-installer) [![Test Coverage](https://codeclimate.com/github/detain/myadmin-plugin-installer/badges/coverage.svg)](https://codeclimate.com/github/detain/myadmin-plugin-installer/coverage) [![Issue Count](https://codeclimate.com/github/detain/myadmin-plugin-installer/badges/issue_count.svg)](https://codeclimate.com/github/detain/myadmin-plugin-installer)
11-
![Scrutinizer](http://i.is.cc/storage/GYeUnux.png "Scrutinizer") | [![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/interserver/myadmin-plugin-installer/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/interserver/myadmin-plugin-installer/?branch=master) [![Code Coverage](https://scrutinizer-ci.com/g/interserver/myadmin-plugin-installer/badges/coverage.png?b=master)](https://scrutinizer-ci.com/g/interserver/myadmin-plugin-installer/?branch=master) [![Build Status](https://scrutinizer-ci.com/g/interserver/myadmin-plugin-installer/badges/build.png?b=master)](https://scrutinizer-ci.com/g/interserver/myadmin-plugin-installer/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-plugin-installer) [![Codacy Badge](https://api.codacy.com/project/badge/Coverage/25fa74eb74c947bf969602fcfe87e349)](https://www.codacy.com/app/detain/myadmin-plugin-installer?utm_source=github.com&utm_medium=referral&utm_content=detain/myadmin-plugin-installer&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-plugin-installer?branch=master)
14-
![Packagist](http://i.is.cc/storage/GYacBEX.png "Packagist") | [![Latest Stable Version](https://poser.pugx.org/detain/myadmin-plugin-installer/version)](https://packagist.org/packages/detain/myadmin-plugin-installer) [![Total Downloads](https://poser.pugx.org/detain/myadmin-plugin-installer/downloads)](https://packagist.org/packages/detain/myadmin-plugin-installer) [![Latest Unstable Version](https://poser.pugx.org/detain/myadmin-plugin-installer/v/unstable)](//packagist.org/packages/detain/myadmin-plugin-installer) [![Monthly Downloads](https://poser.pugx.org/detain/myadmin-plugin-installer/d/monthly)](https://packagist.org/packages/detain/myadmin-plugin-installer) [![Daily Downloads](https://poser.pugx.org/detain/myadmin-plugin-installer/d/daily)](https://packagist.org/packages/detain/myadmin-plugin-installer) [![License](https://poser.pugx.org/detain/myadmin-plugin-installer/license)](https://packagist.org/packages/detain/myadmin-plugin-installer)
10+
## Supported Package Types
1511

12+
| Type | Description |
13+
|--------------------|----------------------------------------|
14+
| `myadmin-template` | Frontend templates (installed to `data/templates/`) |
15+
| `myadmin-module` | Service modules |
16+
| `myadmin-plugin` | Feature plugins |
17+
| `myadmin-menu` | Menu extensions |
1618

17-
## Installation
19+
## Composer Commands
20+
21+
| Command | Description |
22+
|----------------------------|--------------------------------------------------|
23+
| `myadmin` | Base MyAdmin command |
24+
| `myadmin:parse` | Parse PHP DocBlocks for API documentation |
25+
| `myadmin:create-user` | Create a new MyAdmin user |
26+
| `myadmin:update-plugins` | Discover and cache available plugins |
27+
| `myadmin:set-permissions` | Set writable permissions on configured directories |
1828

19-
Install with composer like
29+
## Installation
2030

2131
```sh
2232
composer require detain/myadmin-plugin-installer
2333
```
2434

25-
## License
35+
## Requirements
36+
37+
- PHP 8.2 or later
38+
- Composer 2.x
2639

27-
The Composer backed plugin handler and installer for MyAdmin class is licensed under the LGPL-v2.1 license.
40+
## Running Tests
41+
42+
```sh
43+
composer install
44+
vendor/bin/phpunit
45+
```
46+
47+
## License
2848

49+
This package is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.

composer.json

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,21 @@
11
{
22
"name": "detain/myadmin-plugin-installer",
3-
"description": "Composer backed plugin handler and installer for MyAdmin",
3+
"description": "Composer-based plugin handler and custom installer for the MyAdmin control panel. Provides package type routing for templates, modules, plugins, and menus with integrated Composer command support.",
44
"type": "composer-plugin",
55
"license": "MIT",
66
"config": {
7-
"bin-dir": "vendor\/bin"
7+
"bin-dir": "vendor/bin"
88
},
99
"require": {
10+
"php": ">=8.2",
1011
"composer-plugin-api": "^2.0"
1112
},
1213
"require-dev": {
1314
"composer/composer": "^2.0",
14-
"phpunit/phpunit": "*",
15-
"phpunit/phpunit-mock-objects": "*",
16-
"vlucas/phpdotenv": "*",
17-
"satooshi/php-coveralls": "*",
18-
"codacy/coverage": "dev-master",
19-
"symfony/framework-bundle": "*"
15+
"phpunit/phpunit": "^9.6"
2016
},
21-
"suggest-dev": {
22-
"codeclimate/php-test-reporter": "dev-master"
23-
},
2417
"minimum-stability": "dev",
18+
"prefer-stable": true,
2519
"autoload": {
2620
"psr-4": {
2721
"MyAdmin\\Plugins\\": "src/"
@@ -31,6 +25,11 @@
3125
"src/modules.php"
3226
]
3327
},
28+
"autoload-dev": {
29+
"psr-4": {
30+
"Tests\\MyAdmin\\Plugins\\": "tests/"
31+
}
32+
},
3433
"extra": {
3534
"plugin-modifies-install-path": false,
3635
"plugin-modifies-downloads": false,

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+
cacheResultFile=".phpunit.cache/test-results"
7+
executionOrder="depends,defects"
8+
forceCoversAnnotation="false"
9+
beStrictAboutCoversAnnotation="false"
10+
beStrictAboutOutputDuringTests="true"
11+
beStrictAboutTodoAnnotatedTests="true"
12+
failOnRisky="true"
13+
failOnWarning="true"
14+
verbose="true">
15+
<testsuites>
16+
<testsuite name="unit">
17+
<directory>tests</directory>
18+
</testsuite>
19+
</testsuites>
20+
21+
<coverage processUncoveredFiles="true">
22+
<include>
23+
<directory suffix=".php">src</directory>
24+
</include>
25+
</coverage>
26+
</phpunit>

src/Command/Command.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ protected function configure()
3939
* @param \Symfony\Component\Console\Input\InputInterface $input
4040
* @param \Symfony\Component\Console\Output\OutputInterface $output
4141
*/
42-
protected function initialize(InputInterface $input, OutputInterface $output)
42+
protected function initialize(InputInterface $input, OutputInterface $output): void
4343
{
4444
}
4545

@@ -52,7 +52,7 @@ protected function initialize(InputInterface $input, OutputInterface $output)
5252
* @param \Symfony\Component\Console\Input\InputInterface $input
5353
* @param \Symfony\Component\Console\Output\OutputInterface $output
5454
*/
55-
protected function interact(InputInterface $input, OutputInterface $output)
55+
protected function interact(InputInterface $input, OutputInterface $output): void
5656
{
5757
}
5858

@@ -63,7 +63,7 @@ protected function interact(InputInterface $input, OutputInterface $output)
6363
* @param InputInterface $input
6464
* @param OutputInterface $output
6565
*/
66-
protected function execute(InputInterface $input, OutputInterface $output)
66+
protected function execute(InputInterface $input, OutputInterface $output): int
6767
{
6868
$output->writeln([ // outputs multiple lines to the console (adding "\n" at the end of each line)
6969
'User Creator',
@@ -118,5 +118,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
118118
/** Question Helper
119119
* @link http://symfony.com/doc/current/components/console/helpers/questionhelper.html
120120
*/
121+
122+
return 0;
121123
}
122124
}

src/Command/CreateUser.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ protected function configure()
4848
* @param \Symfony\Component\Console\Input\InputInterface $input
4949
* @param \Symfony\Component\Console\Output\OutputInterface $output
5050
*/
51-
protected function initialize(InputInterface $input, OutputInterface $output)
51+
protected function initialize(InputInterface $input, OutputInterface $output): void
5252
{
5353
}
5454

@@ -61,7 +61,7 @@ protected function initialize(InputInterface $input, OutputInterface $output)
6161
* @param \Symfony\Component\Console\Input\InputInterface $input
6262
* @param \Symfony\Component\Console\Output\OutputInterface $output
6363
*/
64-
protected function interact(InputInterface $input, OutputInterface $output)
64+
protected function interact(InputInterface $input, OutputInterface $output): void
6565
{
6666
}
6767

@@ -72,7 +72,7 @@ protected function interact(InputInterface $input, OutputInterface $output)
7272
* @param InputInterface $input
7373
* @param OutputInterface $output
7474
*/
75-
protected function execute(InputInterface $input, OutputInterface $output)
75+
protected function execute(InputInterface $input, OutputInterface $output): int
7676
{
7777
$output->writeln([ // outputs multiple lines to the console (adding "\n" at the end of each line)
7878
'User Creator',
@@ -125,5 +125,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
125125
/** Question Helper
126126
* @link http://symfony.com/doc/current/components/console/helpers/questionhelper.html
127127
*/
128+
129+
return 0;
128130
}
129131
}

src/Command/Parse.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ protected function configure()
4242
* @param \Symfony\Component\Console\Input\InputInterface $input
4343
* @param \Symfony\Component\Console\Output\OutputInterface $output
4444
*/
45-
protected function initialize(InputInterface $input, OutputInterface $output)
45+
protected function initialize(InputInterface $input, OutputInterface $output): void
4646
{
4747
}
4848

@@ -55,7 +55,7 @@ protected function initialize(InputInterface $input, OutputInterface $output)
5555
* @param \Symfony\Component\Console\Input\InputInterface $input
5656
* @param \Symfony\Component\Console\Output\OutputInterface $output
5757
*/
58-
protected function interact(InputInterface $input, OutputInterface $output)
58+
protected function interact(InputInterface $input, OutputInterface $output): void
5959
{
6060
}
6161

@@ -67,7 +67,7 @@ protected function interact(InputInterface $input, OutputInterface $output)
6767
* @param InputInterface $input
6868
* @param OutputInterface $output
6969
*/
70-
protected function execute(InputInterface $input, OutputInterface $output)
70+
protected function execute(InputInterface $input, OutputInterface $output): int
7171
{
7272
$output->writeln([ // outputs multiple lines to the console (adding "\n" at the end of each line)
7373
'MyAdmin DocBlock Parser',
@@ -169,5 +169,7 @@ function do_call($parent, $call, $calls)
169169
// to get the Method DocBlock
170170
$reflector->getMethod('fn')->getDocComment();
171171
*/
172+
173+
return 0;
172174
}
173175
}

src/Command/SetPermissions.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ protected function configure()
3535
* @param \Symfony\Component\Console\Input\InputInterface $input
3636
* @param \Symfony\Component\Console\Output\OutputInterface $output
3737
*/
38-
protected function initialize(InputInterface $input, OutputInterface $output)
38+
protected function initialize(InputInterface $input, OutputInterface $output): void
3939
{
4040
}
4141

@@ -48,7 +48,7 @@ protected function initialize(InputInterface $input, OutputInterface $output)
4848
* @param \Symfony\Component\Console\Input\InputInterface $input
4949
* @param \Symfony\Component\Console\Output\OutputInterface $output
5050
*/
51-
protected function interact(InputInterface $input, OutputInterface $output)
51+
protected function interact(InputInterface $input, OutputInterface $output): void
5252
{
5353
}
5454

@@ -60,8 +60,10 @@ protected function interact(InputInterface $input, OutputInterface $output)
6060
* @param InputInterface $input
6161
* @param OutputInterface $output
6262
*/
63-
protected function execute(InputInterface $input, OutputInterface $output)
63+
protected function execute(InputInterface $input, OutputInterface $output): int
6464
{
6565
\MyAdmin\Plugins\Plugin::setPermissions();
66+
67+
return 0;
6668
}
6769
}

src/Command/UpdatePlugins.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ protected function configure()
3535
* @param \Symfony\Component\Console\Input\InputInterface $input
3636
* @param \Symfony\Component\Console\Output\OutputInterface $output
3737
*/
38-
protected function initialize(InputInterface $input, OutputInterface $output)
38+
protected function initialize(InputInterface $input, OutputInterface $output): void
3939
{
4040
}
4141

@@ -48,7 +48,7 @@ protected function initialize(InputInterface $input, OutputInterface $output)
4848
* @param \Symfony\Component\Console\Input\InputInterface $input
4949
* @param \Symfony\Component\Console\Output\OutputInterface $output
5050
*/
51-
protected function interact(InputInterface $input, OutputInterface $output)
51+
protected function interact(InputInterface $input, OutputInterface $output): void
5252
{
5353
}
5454

@@ -60,7 +60,7 @@ protected function interact(InputInterface $input, OutputInterface $output)
6060
* @param InputInterface $input
6161
* @param OutputInterface $output
6262
*/
63-
protected function execute(InputInterface $input, OutputInterface $output)
63+
protected function execute(InputInterface $input, OutputInterface $output): int
6464
{
6565
$output->writeln([ // outputs multiple lines to the console (adding "\n" at the end of each line)
6666
'User Creator',
@@ -112,5 +112,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
112112
/** Question Helper
113113
* @link http://symfony.com/doc/current/components/console/helpers/questionhelper.html
114114
*/
115+
116+
return 0;
115117
}
116118
}

src/InstallerPlugin.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,4 +34,12 @@ public function activate(Composer $composer, IOInterface $io)
3434
$installer = new Installer($io, $composer);
3535
$composer->getInstallationManager()->addInstaller($installer);
3636
}
37+
38+
public function deactivate(Composer $composer, IOInterface $io)
39+
{
40+
}
41+
42+
public function uninstall(Composer $composer, IOInterface $io)
43+
{
44+
}
3745
}

0 commit comments

Comments
 (0)