Compare commits
31 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 3f33afd6b2 | |||
| 8700b46e13 | |||
| ce9d72b50d | |||
| 92358a673b | |||
| 99308cd7a4 | |||
| 561ba24090 | |||
| 3e1cb9a500 | |||
| 5ae8e3e001 | |||
| faea3637e0 | |||
| 79eaa5217d | |||
| 0e0891f1a8 | |||
| 33aaf666ae | |||
| a634938799 | |||
| 14ff4ab2f1 | |||
| b3de21e7d1 | |||
| 72a373b17c | |||
| bc290f3bed | |||
| a4704ad267 | |||
| d1762ad5df | |||
| df1467c518 | |||
| 7cdd97ca59 | |||
| 5b36d10b04 | |||
| 56699fdd4d | |||
| fcf1cc41c8 | |||
| b8640ccb1d | |||
| 4b51e2dd9a | |||
| e068e14004 | |||
| 941fd4c6cd | |||
| f2021d478e | |||
| 900ceb2bb5 | |||
| ca06298e64 |
@@ -5,7 +5,7 @@
|
||||
# FILE INFORMATION
|
||||
# DEFGROUP: Gitea.Workflow
|
||||
# INGROUP: mokocli.Automation
|
||||
# VERSION: 01.07.00
|
||||
# VERSION: 01.08.11
|
||||
# BRIEF: Auto-create feature branch when an issue is opened
|
||||
|
||||
name: "Universal: Issue Branch"
|
||||
|
||||
@@ -20,6 +20,7 @@ on:
|
||||
- 'patch/**'
|
||||
- 'hotfix/**'
|
||||
- 'bugfix/**'
|
||||
- 'chore/**'
|
||||
- alpha
|
||||
- beta
|
||||
- rc
|
||||
@@ -87,8 +88,20 @@ jobs:
|
||||
php ${MOKO_CLI}/platform_detect.php --path . --github-output 2>/dev/null || true
|
||||
php ${MOKO_CLI}/manifest_read.php --path . --github-output
|
||||
|
||||
- name: Check platform eligibility (Joomla only)
|
||||
id: eligibility
|
||||
run: |
|
||||
PLATFORM="${{ steps.platform.outputs.platform }}"
|
||||
if [[ "$PLATFORM" == joomla* ]] || [[ "$PLATFORM" == "joomla" ]]; then
|
||||
echo "proceed=true" >> "$GITHUB_OUTPUT"
|
||||
else
|
||||
echo "proceed=false" >> "$GITHUB_OUTPUT"
|
||||
echo "::notice::Platform '$PLATFORM' — non-Joomla, skipping pre-release auto-bump"
|
||||
fi
|
||||
|
||||
- name: Resolve metadata and bump version
|
||||
id: meta
|
||||
if: steps.eligibility.outputs.proceed == 'true'
|
||||
run: |
|
||||
# Auto-detect stability from branch name on push, or use input on dispatch
|
||||
if [ "${{ github.event_name }}" = "push" ]; then
|
||||
@@ -165,6 +178,7 @@ jobs:
|
||||
|
||||
- name: Create release
|
||||
id: release
|
||||
if: steps.eligibility.outputs.proceed == 'true'
|
||||
run: |
|
||||
TAG="${{ steps.meta.outputs.tag }}"
|
||||
VERSION="${{ steps.meta.outputs.version }}"
|
||||
@@ -175,6 +189,7 @@ jobs:
|
||||
--repo "${GITEA_REPO}" --branch "${{ github.ref_name }}" --prerelease
|
||||
|
||||
- name: Update release notes from CHANGELOG.md
|
||||
if: steps.eligibility.outputs.proceed == 'true'
|
||||
run: |
|
||||
TAG="${{ steps.meta.outputs.tag }}"
|
||||
VERSION="${{ steps.meta.outputs.version }}"
|
||||
@@ -211,6 +226,7 @@ jobs:
|
||||
|
||||
- name: Build package and upload
|
||||
id: package
|
||||
if: steps.eligibility.outputs.proceed == 'true'
|
||||
run: |
|
||||
VERSION="${{ steps.meta.outputs.version }}"
|
||||
TAG="${{ steps.meta.outputs.tag }}"
|
||||
@@ -224,6 +240,7 @@ jobs:
|
||||
# No need to build, commit, or sync updates.xml from workflows
|
||||
|
||||
- name: "Delete lesser pre-release channels (cascade)"
|
||||
if: steps.eligibility.outputs.proceed == 'true'
|
||||
continue-on-error: true
|
||||
run: |
|
||||
API_BASE="${GITEA_URL}/api/v1/repos/${GITEA_ORG}/${GITEA_REPO}"
|
||||
|
||||
@@ -45,13 +45,6 @@ jobs:
|
||||
echo "platform=$PLATFORM" >> "$GITHUB_OUTPUT"
|
||||
echo "Platform: ${PLATFORM:-all}"
|
||||
|
||||
- name: Setup PHP
|
||||
run: |
|
||||
if ! command -v php &> /dev/null; then
|
||||
sudo apt-get update -qq
|
||||
sudo apt-get install -y -qq php-cli php-mbstring php-xml php-zip php-curl composer >/dev/null 2>&1
|
||||
fi
|
||||
|
||||
- name: Clone mokocli
|
||||
env:
|
||||
MOKOGITEA_TOKEN: ${{ secrets.MOKOGITEA_TOKEN }}
|
||||
|
||||
@@ -1,6 +1,11 @@
|
||||
# Changelog
|
||||
## [Unreleased]
|
||||
|
||||
### Fixed
|
||||
- Webservices plugin Joomla 6 compatibility — `onBeforeApiRoute` receives `BeforeApiRouteEvent` object, extract router via `$event->getRouter()`
|
||||
|
||||
## [01.07.00] --- 2026-06-23
|
||||
|
||||
## [01.07.00] --- 2026-06-23
|
||||
|
||||
### Added
|
||||
@@ -10,6 +15,7 @@
|
||||
|
||||
### Fixed
|
||||
- **License warning**: Removed duplicate from system plugin (install script already shows it)
|
||||
- **Content plugin**: Fixed func_get_arg crash when non-article content is saved (e.g. update sites, installer)
|
||||
|
||||
## [01.05.00] --- 2026-06-23
|
||||
|
||||
@@ -51,3 +57,19 @@
|
||||
|
||||
|
||||
## [01.04.01] --- 2026-06-21
|
||||
|
||||
|
||||
## [01.04.00] --- 2026-06-21
|
||||
|
||||
### Fixed
|
||||
- **Package manifest**: Added missing `plg_system_mokosuitecross_events` and `plg_system_mokosuitecross_gallery` to `pkg_mokosuitecross.xml` — these system plugins were not installed with the package
|
||||
- **Cleanup**: Removed old `src/` directory (pre-rename cruft with `mokojoomcross` files)
|
||||
|
||||
## [01.03.00] --- 2026-06-21
|
||||
|
||||
|
||||
<!-- VERSION: 01.08.11 -->
|
||||
|
||||
All notable changes to MokoSuiteCross will be documented in this file.
|
||||
|
||||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# MokoSuiteCross
|
||||
|
||||
<!-- VERSION: 01.07.00 -->
|
||||
<!-- VERSION: 01.08.11 -->
|
||||
|
||||
Cross-posting Joomla content to social media, email marketing, and chat platforms for Joomla 5/6.
|
||||
|
||||
|
||||
+15
-1
@@ -15,9 +15,23 @@
|
||||
"php": ">=8.1"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": "^10.5",
|
||||
"squizlabs/php_codesniffer": "^3.7",
|
||||
"phpstan/phpstan": "^1.10",
|
||||
"joomla/coding-standards": "^4.0"
|
||||
"joomla/coding-standards": "dev-3.x-dev"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Joomla\\Component\\MokoSuiteCross\\Administrator\\": "source/packages/com_mokosuitecross/src/",
|
||||
"Joomla\\Component\\MokoSuiteCross\\Site\\": "source/packages/com_mokosuitecross/site/src/",
|
||||
"Joomla\\Plugin\\Content\\MokoSuiteCross\\": "source/packages/plg_content_mokosuitecross/src/",
|
||||
"Joomla\\Plugin\\System\\MokoSuiteCross\\": "source/packages/plg_system_mokosuitecross/src/"
|
||||
}
|
||||
},
|
||||
"autoload-dev": {
|
||||
"psr-4": {
|
||||
"MokoSuiteCross\\Tests\\": "tests/"
|
||||
}
|
||||
},
|
||||
"config": {
|
||||
"sort-packages": true
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd"
|
||||
bootstrap="tests/bootstrap.php"
|
||||
colors="true"
|
||||
cacheDirectory=".phpunit.cache"
|
||||
executionOrder="depends,defects"
|
||||
failOnRisky="true"
|
||||
failOnWarning="true">
|
||||
<testsuites>
|
||||
<testsuite name="Unit">
|
||||
<directory>tests/Unit</directory>
|
||||
</testsuite>
|
||||
</testsuites>
|
||||
<source>
|
||||
<include>
|
||||
<directory>source/packages/com_mokosuitecross/src</directory>
|
||||
<directory>source/packages/plg_content_mokosuitecross/src</directory>
|
||||
<directory>source/packages/plg_system_mokosuitecross/src</directory>
|
||||
</include>
|
||||
</source>
|
||||
</phpunit>
|
||||
@@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<extension type="component" method="upgrade">
|
||||
<name>com_mokosuitecross</name>
|
||||
<version>01.07.00</version>
|
||||
<version>01.08.11</version>
|
||||
<creationDate>2026-05-28</creationDate>
|
||||
<author>Moko Consulting</author>
|
||||
<authorEmail>hello@mokoconsulting.tech</authorEmail>
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
/* 01.08.05 — no schema changes */
|
||||
@@ -0,0 +1 @@
|
||||
/* 01.08.07 — no schema changes */
|
||||
@@ -0,0 +1 @@
|
||||
/* 01.08.08 — no schema changes */
|
||||
@@ -0,0 +1 @@
|
||||
/* 01.08.09 — no schema changes */
|
||||
@@ -0,0 +1 @@
|
||||
/* 01.08.10 — no schema changes */
|
||||
@@ -0,0 +1 @@
|
||||
/* 01.08.11 — no schema changes */
|
||||
@@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<extension type="plugin" group="content" method="upgrade">
|
||||
<name>Content - MokoSuiteCross</name>
|
||||
<version>01.07.00</version>
|
||||
<version>01.08.11</version>
|
||||
<creationDate>2026-05-28</creationDate>
|
||||
<author>Moko Consulting</author>
|
||||
<authorEmail>hello@mokoconsulting.tech</authorEmail>
|
||||
|
||||
+13
-42
@@ -270,25 +270,11 @@ XML;
|
||||
|
||||
/**
|
||||
* Add cross-post status badges before article content in admin.
|
||||
*
|
||||
* Joomla 5/6 compatible — accepts both BeforeDisplayEvent and legacy parameters.
|
||||
*/
|
||||
public function onContentBeforeDisplay($event): string
|
||||
public function onContentBeforeDisplay(\Joomla\CMS\Event\Content\BeforeDisplayEvent $event): string
|
||||
{
|
||||
// Joomla 5/6 compatibility
|
||||
if ($event instanceof \Joomla\CMS\Event\Content\BeforeDisplayEvent) {
|
||||
$context = $event->getContext();
|
||||
$article = $event->getItem();
|
||||
} elseif (is_string($event)) {
|
||||
$context = $event;
|
||||
$article = func_get_arg(1);
|
||||
} else {
|
||||
return '';
|
||||
}
|
||||
|
||||
if ($context !== 'com_content.article') {
|
||||
return '';
|
||||
}
|
||||
$context = $event->getContext();
|
||||
$article = $event->getItem();
|
||||
|
||||
$app = $this->getApplication();
|
||||
|
||||
@@ -330,26 +316,18 @@ XML;
|
||||
|
||||
/**
|
||||
* Dispatch cross-post when an article is saved and published.
|
||||
*
|
||||
* Joomla 5/6 compatible — accepts both AfterSaveEvent and legacy parameters.
|
||||
*/
|
||||
public function onContentAfterSave($event): void
|
||||
public function onContentAfterSave(\Joomla\CMS\Event\Content\AfterSaveEvent $event): void
|
||||
{
|
||||
// Joomla 5/6 compatibility
|
||||
if ($event instanceof \Joomla\CMS\Event\Content\AfterSaveEvent) {
|
||||
$context = $event->getContext();
|
||||
$article = $event->getItem();
|
||||
$isNew = $event->getIsNew();
|
||||
} else {
|
||||
$context = $event;
|
||||
$article = func_get_arg(1);
|
||||
$isNew = func_get_arg(2);
|
||||
}
|
||||
$context = $event->getContext();
|
||||
|
||||
if ($context !== 'com_content.article') {
|
||||
return;
|
||||
}
|
||||
|
||||
$article = $event->getItem();
|
||||
$isNew = $event->getIsNew();
|
||||
|
||||
if ((int) ($article->state ?? 0) !== 1) {
|
||||
return;
|
||||
}
|
||||
@@ -375,25 +353,18 @@ XML;
|
||||
|
||||
/**
|
||||
* Dispatch cross-post when article state changes to published.
|
||||
*
|
||||
* Joomla 5/6 compatible — accepts both ContentChangeStateEvent and legacy parameters.
|
||||
*/
|
||||
public function onContentChangeState($event): void
|
||||
public function onContentChangeState(\Joomla\CMS\Event\Content\ContentChangeStateEvent $event): void
|
||||
{
|
||||
if ($event instanceof \Joomla\CMS\Event\Content\ContentChangeStateEvent) {
|
||||
$context = $event->getContext();
|
||||
$pks = $event->getPks();
|
||||
$value = $event->getValue();
|
||||
} else {
|
||||
$context = $event;
|
||||
$pks = func_get_arg(1);
|
||||
$value = func_get_arg(2);
|
||||
}
|
||||
$context = $event->getContext();
|
||||
|
||||
if ($context !== 'com_content.article') {
|
||||
return;
|
||||
}
|
||||
|
||||
$pks = $event->getPks();
|
||||
$value = $event->getValue();
|
||||
|
||||
$params = ComponentHelper::getParams('com_mokosuitecross');
|
||||
|
||||
// Unpublish/trash: delete from platforms if configured
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<extension type="plugin" group="mokosuitecross" method="upgrade">
|
||||
<name>MokoSuiteCross - ActivityPub (Fediverse)</name>
|
||||
<version>01.07.00</version>
|
||||
<version>01.08.11</version>
|
||||
<creationDate>2026-05-28</creationDate>
|
||||
<author>Moko Consulting</author>
|
||||
<authorEmail>hello@mokoconsulting.tech</authorEmail>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<extension type="plugin" group="mokosuitecross" method="upgrade">
|
||||
<name>MokoSuiteCross - Google Blogger</name>
|
||||
<version>01.07.00</version>
|
||||
<version>01.08.11</version>
|
||||
<creationDate>2026-05-28</creationDate>
|
||||
<author>Moko Consulting</author>
|
||||
<authorEmail>hello@mokoconsulting.tech</authorEmail>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<extension type="plugin" group="mokosuitecross" method="upgrade">
|
||||
<name>MokoSuiteCross - Bluesky</name>
|
||||
<version>01.07.00</version>
|
||||
<version>01.08.11</version>
|
||||
<creationDate>2026-05-28</creationDate>
|
||||
<author>Moko Consulting</author>
|
||||
<authorEmail>hello@mokoconsulting.tech</authorEmail>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<extension type="plugin" group="mokosuitecross" method="upgrade">
|
||||
<name>MokoSuiteCross - Brevo (Sendinblue)</name>
|
||||
<version>01.07.00</version>
|
||||
<version>01.08.11</version>
|
||||
<creationDate>2026-05-28</creationDate>
|
||||
<author>Moko Consulting</author>
|
||||
<authorEmail>hello@mokoconsulting.tech</authorEmail>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<extension type="plugin" group="mokosuitecross" method="upgrade">
|
||||
<name>MokoSuiteCross - Constant Contact</name>
|
||||
<version>01.07.00</version>
|
||||
<version>01.08.11</version>
|
||||
<creationDate>2026-05-28</creationDate>
|
||||
<author>Moko Consulting</author>
|
||||
<authorEmail>hello@mokoconsulting.tech</authorEmail>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<extension type="plugin" group="mokosuitecross" method="upgrade">
|
||||
<name>MokoSuiteCross - ConvertKit</name>
|
||||
<version>01.07.00</version>
|
||||
<version>01.08.11</version>
|
||||
<creationDate>2026-05-28</creationDate>
|
||||
<author>Moko Consulting</author>
|
||||
<authorEmail>hello@mokoconsulting.tech</authorEmail>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<extension type="plugin" group="mokosuitecross" method="upgrade">
|
||||
<name>MokoSuiteCross - Dev.to</name>
|
||||
<version>01.07.00</version>
|
||||
<version>01.08.11</version>
|
||||
<creationDate>2026-05-28</creationDate>
|
||||
<author>Moko Consulting</author>
|
||||
<authorEmail>hello@mokoconsulting.tech</authorEmail>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<extension type="plugin" group="mokosuitecross" method="upgrade">
|
||||
<name>MokoSuiteCross - Discord</name>
|
||||
<version>01.07.00</version>
|
||||
<version>01.08.11</version>
|
||||
<creationDate>2026-05-28</creationDate>
|
||||
<author>Moko Consulting</author>
|
||||
<authorEmail>hello@mokoconsulting.tech</authorEmail>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<extension type="plugin" group="mokosuitecross" method="upgrade">
|
||||
<name>MokoSuiteCross - Facebook / Meta</name>
|
||||
<version>01.07.00</version>
|
||||
<version>01.08.11</version>
|
||||
<creationDate>2026-05-28</creationDate>
|
||||
<author>Moko Consulting</author>
|
||||
<authorEmail>hello@mokoconsulting.tech</authorEmail>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<extension type="plugin" group="mokosuitecross" method="upgrade">
|
||||
<name>MokoSuiteCross - Ghost</name>
|
||||
<version>01.07.00</version>
|
||||
<version>01.08.11</version>
|
||||
<creationDate>2026-05-28</creationDate>
|
||||
<author>Moko Consulting</author>
|
||||
<authorEmail>hello@mokoconsulting.tech</authorEmail>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<extension type="plugin" group="mokosuitecross" method="upgrade">
|
||||
<name>MokoSuiteCross - Google Business Profile</name>
|
||||
<version>01.07.00</version>
|
||||
<version>01.08.11</version>
|
||||
<creationDate>2026-05-28</creationDate>
|
||||
<author>Moko Consulting</author>
|
||||
<authorEmail>hello@mokoconsulting.tech</authorEmail>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<extension type="plugin" group="mokosuitecross" method="upgrade">
|
||||
<name>MokoSuiteCross - Google Chat</name>
|
||||
<version>01.07.00</version>
|
||||
<version>01.08.11</version>
|
||||
<creationDate>2026-05-28</creationDate>
|
||||
<author>Moko Consulting</author>
|
||||
<authorEmail>hello@mokoconsulting.tech</authorEmail>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<extension type="plugin" group="mokosuitecross" method="upgrade">
|
||||
<name>MokoSuiteCross - Hashnode</name>
|
||||
<version>01.07.00</version>
|
||||
<version>01.08.11</version>
|
||||
<creationDate>2026-05-28</creationDate>
|
||||
<author>Moko Consulting</author>
|
||||
<authorEmail>hello@mokoconsulting.tech</authorEmail>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<extension type="plugin" group="mokosuitecross" method="upgrade">
|
||||
<name>MokoSuiteCross - Instagram</name>
|
||||
<version>01.07.00</version>
|
||||
<version>01.08.11</version>
|
||||
<creationDate>2026-06-23</creationDate>
|
||||
<author>Moko Consulting</author>
|
||||
<authorEmail>hello@mokoconsulting.tech</authorEmail>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<extension type="plugin" group="mokosuitecross" method="upgrade">
|
||||
<name>MokoSuiteCross - LinkedIn</name>
|
||||
<version>01.07.00</version>
|
||||
<version>01.08.11</version>
|
||||
<creationDate>2026-05-28</creationDate>
|
||||
<author>Moko Consulting</author>
|
||||
<authorEmail>hello@mokoconsulting.tech</authorEmail>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<extension type="plugin" group="mokosuitecross" method="upgrade">
|
||||
<name>MokoSuiteCross - Mailchimp</name>
|
||||
<version>01.07.00</version>
|
||||
<version>01.08.11</version>
|
||||
<creationDate>2026-05-28</creationDate>
|
||||
<author>Moko Consulting</author>
|
||||
<authorEmail>hello@mokoconsulting.tech</authorEmail>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<extension type="plugin" group="mokosuitecross" method="upgrade">
|
||||
<name>MokoSuiteCross - Mastodon</name>
|
||||
<version>01.07.00</version>
|
||||
<version>01.08.11</version>
|
||||
<creationDate>2026-05-28</creationDate>
|
||||
<author>Moko Consulting</author>
|
||||
<authorEmail>hello@mokoconsulting.tech</authorEmail>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<extension type="plugin" group="mokosuitecross" method="upgrade">
|
||||
<name>MokoSuiteCross - Matrix / Element</name>
|
||||
<version>01.07.00</version>
|
||||
<version>01.08.11</version>
|
||||
<creationDate>2026-05-28</creationDate>
|
||||
<author>Moko Consulting</author>
|
||||
<authorEmail>hello@mokoconsulting.tech</authorEmail>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<extension type="plugin" group="mokosuitecross" method="upgrade">
|
||||
<name>MokoSuiteCross - Medium</name>
|
||||
<version>01.07.00</version>
|
||||
<version>01.08.11</version>
|
||||
<creationDate>2026-05-28</creationDate>
|
||||
<author>Moko Consulting</author>
|
||||
<authorEmail>hello@mokoconsulting.tech</authorEmail>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<extension type="plugin" group="mokosuitecross" method="upgrade">
|
||||
<name>MokoSuiteCross - MokoSuiteCalendar Events</name>
|
||||
<version>01.07.00</version>
|
||||
<version>01.08.11</version>
|
||||
<creationDate>2026-05-28</creationDate>
|
||||
<author>Moko Consulting</author>
|
||||
<authorEmail>hello@mokoconsulting.tech</authorEmail>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<extension type="plugin" group="mokosuitecross" method="upgrade">
|
||||
<name>MokoSuiteCross - MokoSuiteGallery</name>
|
||||
<version>01.07.00</version>
|
||||
<version>01.08.11</version>
|
||||
<creationDate>2026-05-28</creationDate>
|
||||
<author>Moko Consulting</author>
|
||||
<authorEmail>hello@mokoconsulting.tech</authorEmail>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<extension type="plugin" group="mokosuitecross" method="upgrade">
|
||||
<name>MokoSuiteCross - Nostr</name>
|
||||
<version>01.07.00</version>
|
||||
<version>01.08.11</version>
|
||||
<creationDate>2026-05-28</creationDate>
|
||||
<author>Moko Consulting</author>
|
||||
<authorEmail>hello@mokoconsulting.tech</authorEmail>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<extension type="plugin" group="mokosuitecross" method="upgrade">
|
||||
<name>MokoSuiteCross - Ntfy Push Notifications</name>
|
||||
<version>01.07.00</version>
|
||||
<version>01.08.11</version>
|
||||
<creationDate>2026-05-28</creationDate>
|
||||
<author>Moko Consulting</author>
|
||||
<authorEmail>hello@mokoconsulting.tech</authorEmail>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<extension type="plugin" group="mokosuitecross" method="upgrade">
|
||||
<name>MokoSuiteCross - Pinterest</name>
|
||||
<version>01.07.00</version>
|
||||
<version>01.08.11</version>
|
||||
<creationDate>2026-05-28</creationDate>
|
||||
<author>Moko Consulting</author>
|
||||
<authorEmail>hello@mokoconsulting.tech</authorEmail>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<extension type="plugin" group="mokosuitecross" method="upgrade">
|
||||
<name>MokoSuiteCross - Reddit</name>
|
||||
<version>01.07.00</version>
|
||||
<version>01.08.11</version>
|
||||
<creationDate>2026-05-28</creationDate>
|
||||
<author>Moko Consulting</author>
|
||||
<authorEmail>hello@mokoconsulting.tech</authorEmail>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<extension type="plugin" group="mokosuitecross" method="upgrade">
|
||||
<name>MokoSuiteCross - RSS Feed</name>
|
||||
<version>01.07.00</version>
|
||||
<version>01.08.11</version>
|
||||
<creationDate>2026-05-28</creationDate>
|
||||
<author>Moko Consulting</author>
|
||||
<authorEmail>hello@mokoconsulting.tech</authorEmail>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<extension type="plugin" group="mokosuitecross" method="upgrade">
|
||||
<name>MokoSuiteCross - SendGrid</name>
|
||||
<version>01.07.00</version>
|
||||
<version>01.08.11</version>
|
||||
<creationDate>2026-05-28</creationDate>
|
||||
<author>Moko Consulting</author>
|
||||
<authorEmail>hello@mokoconsulting.tech</authorEmail>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<extension type="plugin" group="mokosuitecross" method="upgrade">
|
||||
<name>MokoSuiteCross - Slack</name>
|
||||
<version>01.07.00</version>
|
||||
<version>01.08.11</version>
|
||||
<creationDate>2026-05-28</creationDate>
|
||||
<author>Moko Consulting</author>
|
||||
<authorEmail>hello@mokoconsulting.tech</authorEmail>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<extension type="plugin" group="mokosuitecross" method="upgrade">
|
||||
<name>MokoSuiteCross - Microsoft Teams</name>
|
||||
<version>01.07.00</version>
|
||||
<version>01.08.11</version>
|
||||
<creationDate>2026-05-28</creationDate>
|
||||
<author>Moko Consulting</author>
|
||||
<authorEmail>hello@mokoconsulting.tech</authorEmail>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<extension type="plugin" group="mokosuitecross" method="upgrade">
|
||||
<name>MokoSuiteCross - Telegram</name>
|
||||
<version>01.07.00</version>
|
||||
<version>01.08.11</version>
|
||||
<creationDate>2026-05-28</creationDate>
|
||||
<author>Moko Consulting</author>
|
||||
<authorEmail>hello@mokoconsulting.tech</authorEmail>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<extension type="plugin" group="mokosuitecross" method="upgrade">
|
||||
<name>MokoSuiteCross - Threads (Meta)</name>
|
||||
<version>01.07.00</version>
|
||||
<version>01.08.11</version>
|
||||
<creationDate>2026-05-28</creationDate>
|
||||
<author>Moko Consulting</author>
|
||||
<authorEmail>hello@mokoconsulting.tech</authorEmail>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<extension type="plugin" group="mokosuitecross" method="upgrade">
|
||||
<name>MokoSuiteCross - TikTok</name>
|
||||
<version>01.07.00</version>
|
||||
<version>01.08.11</version>
|
||||
<creationDate>2026-05-28</creationDate>
|
||||
<author>Moko Consulting</author>
|
||||
<authorEmail>hello@mokoconsulting.tech</authorEmail>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<extension type="plugin" group="mokosuitecross" method="upgrade">
|
||||
<name>MokoSuiteCross - Tumblr</name>
|
||||
<version>01.07.00</version>
|
||||
<version>01.08.11</version>
|
||||
<creationDate>2026-05-28</creationDate>
|
||||
<author>Moko Consulting</author>
|
||||
<authorEmail>hello@mokoconsulting.tech</authorEmail>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<extension type="plugin" group="mokosuitecross" method="upgrade">
|
||||
<name>MokoSuiteCross - X / Twitter</name>
|
||||
<version>01.07.00</version>
|
||||
<version>01.08.11</version>
|
||||
<creationDate>2026-05-28</creationDate>
|
||||
<author>Moko Consulting</author>
|
||||
<authorEmail>hello@mokoconsulting.tech</authorEmail>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<extension type="plugin" group="mokosuitecross" method="upgrade">
|
||||
<name>MokoSuiteCross - Generic Webhook</name>
|
||||
<version>01.07.00</version>
|
||||
<version>01.08.11</version>
|
||||
<creationDate>2026-05-28</creationDate>
|
||||
<author>Moko Consulting</author>
|
||||
<authorEmail>hello@mokoconsulting.tech</authorEmail>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<extension type="plugin" group="mokosuitecross" method="upgrade">
|
||||
<name>MokoSuiteCross - WhatsApp Business</name>
|
||||
<version>01.07.00</version>
|
||||
<version>01.08.11</version>
|
||||
<creationDate>2026-05-28</creationDate>
|
||||
<author>Moko Consulting</author>
|
||||
<authorEmail>hello@mokoconsulting.tech</authorEmail>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<extension type="plugin" group="mokosuitecross" method="upgrade">
|
||||
<name>MokoSuiteCross - WordPress</name>
|
||||
<version>01.07.00</version>
|
||||
<version>01.08.11</version>
|
||||
<creationDate>2026-05-28</creationDate>
|
||||
<author>Moko Consulting</author>
|
||||
<authorEmail>hello@mokoconsulting.tech</authorEmail>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<extension type="plugin" group="mokosuitecross" method="upgrade">
|
||||
<name>MokoSuiteCross - Youtube</name>
|
||||
<version>01.07.00</version>
|
||||
<version>01.08.11</version>
|
||||
<creationDate>2026-06-23</creationDate>
|
||||
<author>Moko Consulting</author>
|
||||
<authorEmail>hello@mokoconsulting.tech</authorEmail>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<extension type="plugin" group="system" method="upgrade">
|
||||
<name>System - MokoSuiteCross</name>
|
||||
<version>01.07.00</version>
|
||||
<version>01.08.11</version>
|
||||
<creationDate>2026-05-28</creationDate>
|
||||
<author>Moko Consulting</author>
|
||||
<authorEmail>hello@mokoconsulting.tech</authorEmail>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<extension type="plugin" group="system" method="upgrade">
|
||||
<name>System - MokoSuiteCross Events</name>
|
||||
<version>01.07.00</version>
|
||||
<version>01.08.11</version>
|
||||
<creationDate>2026-05-28</creationDate>
|
||||
<author>Moko Consulting</author>
|
||||
<authorEmail>hello@mokoconsulting.tech</authorEmail>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<extension type="plugin" group="system" method="upgrade">
|
||||
<name>System - MokoSuiteCross Gallery</name>
|
||||
<version>01.07.00</version>
|
||||
<version>01.08.11</version>
|
||||
<creationDate>2026-05-28</creationDate>
|
||||
<author>Moko Consulting</author>
|
||||
<authorEmail>hello@mokoconsulting.tech</authorEmail>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<extension type="plugin" group="task" method="upgrade">
|
||||
<name>Task - MokoSuiteCross Queue Processor</name>
|
||||
<version>01.07.00</version>
|
||||
<version>01.08.11</version>
|
||||
<creationDate>2026-05-28</creationDate>
|
||||
<author>Moko Consulting</author>
|
||||
<authorEmail>hello@mokoconsulting.tech</authorEmail>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<extension type="plugin" group="webservices" method="upgrade">
|
||||
<name>Web Services - MokoSuiteCross</name>
|
||||
<version>01.07.00</version>
|
||||
<version>01.08.11</version>
|
||||
<creationDate>2026-05-28</creationDate>
|
||||
<author>Moko Consulting</author>
|
||||
<authorEmail>hello@mokoconsulting.tech</authorEmail>
|
||||
|
||||
+2
-2
@@ -35,8 +35,9 @@ class MokoSuiteCrossWebServices extends CMSPlugin implements SubscriberInterface
|
||||
];
|
||||
}
|
||||
|
||||
public function onBeforeApiRoute(&$router): void
|
||||
public function onBeforeApiRoute($event): void
|
||||
{
|
||||
$router = $event instanceof \Joomla\CMS\Event\AbstractEvent ? $event->getRouter() : $event;
|
||||
$defaults = ['component' => 'com_mokosuitecross'];
|
||||
|
||||
$router->createCRUDRoutes('v1/mokosuitecross/posts', 'posts', $defaults);
|
||||
@@ -44,7 +45,6 @@ class MokoSuiteCrossWebServices extends CMSPlugin implements SubscriberInterface
|
||||
$router->createCRUDRoutes('v1/mokosuitecross/templates', 'templates', $defaults);
|
||||
$router->createCRUDRoutes('v1/mokosuitecross/logs', 'logs', $defaults);
|
||||
|
||||
// Action endpoint: dispatch cross-posts for an article (POST only)
|
||||
$router->addRoute(
|
||||
new \Joomla\Router\Route(['POST'], 'v1/mokosuitecross/dispatch', 'dispatch.dispatch', [], $defaults)
|
||||
);
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<extension type="package" method="upgrade">
|
||||
<name>MokoSuiteCross</name>
|
||||
<packagename>mokosuitecross</packagename>
|
||||
<version>01.07.00</version>
|
||||
<version>01.08.11</version>
|
||||
<creationDate>2026-05-28</creationDate>
|
||||
<author>Moko Consulting</author>
|
||||
<authorEmail>hello@mokoconsulting.tech</authorEmail>
|
||||
|
||||
@@ -0,0 +1,128 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package MokoSuiteCross
|
||||
* @subpackage Tests
|
||||
* @author Moko Consulting <hello@mokoconsulting.tech>
|
||||
* @copyright Copyright (C) 2026 Moko Consulting. All rights reserved.
|
||||
* @license GNU General Public License version 3 or later; see LICENSE
|
||||
* SPDX-License-Identifier: GPL-3.0-or-later
|
||||
*/
|
||||
|
||||
namespace MokoSuiteCross\Tests\Unit\Helper;
|
||||
|
||||
use Joomla\Component\MokoSuiteCross\Administrator\Helper\PreviewHelper;
|
||||
use PHPUnit\Framework\Attributes\RequiresMethod;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
#[RequiresMethod(PreviewHelper::class, 'render')]
|
||||
class PreviewHelperTest extends TestCase
|
||||
{
|
||||
public function testRenderTwitterContainsCharCount(): void
|
||||
{
|
||||
$html = PreviewHelper::render('twitter', 'Test Title', 'Hello world', 'https://example.com', '', 'Author');
|
||||
|
||||
$this->assertStringContainsString('11/280', $html);
|
||||
}
|
||||
|
||||
public function testRenderTwitterEscapesHtml(): void
|
||||
{
|
||||
$html = PreviewHelper::render('twitter', '<script>alert(1)</script>', 'text', 'https://example.com');
|
||||
|
||||
$this->assertStringNotContainsString('<script>', $html);
|
||||
$this->assertStringContainsString('<script>', $html);
|
||||
}
|
||||
|
||||
public function testRenderFacebookContainsAuthor(): void
|
||||
{
|
||||
$html = PreviewHelper::render('facebook', 'My Article', 'Intro text here', 'https://example.com', '', 'John Doe');
|
||||
|
||||
$this->assertStringContainsString('John Doe', $html);
|
||||
$this->assertStringContainsString('My Article', $html);
|
||||
}
|
||||
|
||||
public function testRenderMastodonContainsCharCount(): void
|
||||
{
|
||||
$html = PreviewHelper::render('mastodon', 'Title', 'Post text', 'https://example.com', '', 'Author');
|
||||
|
||||
$this->assertStringContainsString('9/500', $html);
|
||||
}
|
||||
|
||||
public function testRenderBlueskyContainsCharCount(): void
|
||||
{
|
||||
$html = PreviewHelper::render('bluesky', 'Title', 'A bluesky post', 'https://example.com', '', 'Author');
|
||||
|
||||
$this->assertStringContainsString('14/300', $html);
|
||||
}
|
||||
|
||||
public function testRenderLinkedInContainsAuthor(): void
|
||||
{
|
||||
$html = PreviewHelper::render('linkedin', 'Article', 'Text', 'https://example.com', '', 'Jane Smith');
|
||||
|
||||
$this->assertStringContainsString('Jane Smith', $html);
|
||||
}
|
||||
|
||||
public function testRenderTelegramDoesNotShowAuthor(): void
|
||||
{
|
||||
$html = PreviewHelper::render('telegram', 'Article', 'Message text', 'https://example.com');
|
||||
|
||||
$this->assertStringContainsString('Message text', $html);
|
||||
$this->assertStringContainsString('Article', $html);
|
||||
}
|
||||
|
||||
public function testRenderWithImageIncludesImgTag(): void
|
||||
{
|
||||
$html = PreviewHelper::render('twitter', 'Title', 'Text', 'https://example.com', 'https://example.com/image.jpg', 'Author');
|
||||
|
||||
$this->assertStringContainsString('<img src="https://example.com/image.jpg"', $html);
|
||||
}
|
||||
|
||||
public function testRenderWithoutImageOmitsImgTag(): void
|
||||
{
|
||||
$html = PreviewHelper::render('twitter', 'Title', 'Text', 'https://example.com', '', 'Author');
|
||||
|
||||
$this->assertStringNotContainsString('<img', $html);
|
||||
}
|
||||
|
||||
public function testRenderGenericPlatform(): void
|
||||
{
|
||||
$html = PreviewHelper::render('pinterest', 'Title', 'Text', 'https://example.com');
|
||||
|
||||
$this->assertStringContainsString('PINTEREST', $html);
|
||||
$this->assertStringContainsString('Title', $html);
|
||||
}
|
||||
|
||||
public function testGetSupportedPlatformsReturnsSix(): void
|
||||
{
|
||||
$platforms = PreviewHelper::getSupportedPlatforms();
|
||||
|
||||
$this->assertCount(6, $platforms);
|
||||
$this->assertContains('twitter', $platforms);
|
||||
$this->assertContains('facebook', $platforms);
|
||||
$this->assertContains('mastodon', $platforms);
|
||||
$this->assertContains('linkedin', $platforms);
|
||||
$this->assertContains('bluesky', $platforms);
|
||||
$this->assertContains('telegram', $platforms);
|
||||
}
|
||||
|
||||
public function testRenderUsesTextWhenProvided(): void
|
||||
{
|
||||
$html = PreviewHelper::render('facebook', 'My Title', 'Custom intro text', 'https://example.com');
|
||||
|
||||
$this->assertStringContainsString('Custom intro text', $html);
|
||||
}
|
||||
|
||||
public function testRenderFallsBackToTitleWhenTextEmpty(): void
|
||||
{
|
||||
$html = PreviewHelper::render('facebook', 'Fallback Title', '', 'https://example.com');
|
||||
|
||||
$this->assertMatchesRegularExpression('/Fallback Title.*Fallback Title/s', $html);
|
||||
}
|
||||
|
||||
public function testImageUrlIsEscaped(): void
|
||||
{
|
||||
$html = PreviewHelper::render('twitter', 'Title', 'Text', 'https://example.com', 'https://example.com/img?a=1&b=2', 'Author');
|
||||
|
||||
$this->assertStringContainsString('https://example.com/img?a=1&b=2', $html);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package MokoSuiteCross
|
||||
* @subpackage Tests
|
||||
* @author Moko Consulting <hello@mokoconsulting.tech>
|
||||
* @copyright Copyright (C) 2026 Moko Consulting. All rights reserved.
|
||||
* @license GNU General Public License version 3 or later; see LICENSE
|
||||
* SPDX-License-Identifier: GPL-3.0-or-later
|
||||
*/
|
||||
|
||||
namespace MokoSuiteCross\Tests\Unit\Helper;
|
||||
|
||||
use Joomla\Component\MokoSuiteCross\Administrator\Helper\ServiceIconHelper;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
class ServiceIconHelperTest extends TestCase
|
||||
{
|
||||
/**
|
||||
* @dataProvider knownServiceTypesProvider
|
||||
*/
|
||||
public function testGetIconReturnsKnownIcon(string $serviceType, string $expectedIcon): void
|
||||
{
|
||||
$this->assertSame($expectedIcon, ServiceIconHelper::getIcon($serviceType));
|
||||
}
|
||||
|
||||
public static function knownServiceTypesProvider(): array
|
||||
{
|
||||
return [
|
||||
'facebook' => ['facebook', 'icon-facebook'],
|
||||
'twitter' => ['twitter', 'icon-twitter'],
|
||||
'linkedin' => ['linkedin', 'icon-linkedin'],
|
||||
'mastodon' => ['mastodon', 'icon-globe'],
|
||||
'bluesky' => ['bluesky', 'icon-cloud'],
|
||||
'telegram' => ['telegram', 'icon-paper-plane'],
|
||||
'discord' => ['discord', 'icon-headset'],
|
||||
'slack' => ['slack', 'icon-hashtag'],
|
||||
'mailchimp' => ['mailchimp', 'icon-envelope'],
|
||||
'medium' => ['medium', 'icon-book'],
|
||||
];
|
||||
}
|
||||
|
||||
public function testGetIconReturnsFallbackForUnknownType(): void
|
||||
{
|
||||
$this->assertSame('icon-share-alt', ServiceIconHelper::getIcon('unknown_platform'));
|
||||
}
|
||||
|
||||
public function testRenderIconOutputsSpanElement(): void
|
||||
{
|
||||
$html = ServiceIconHelper::renderIcon('facebook');
|
||||
|
||||
$this->assertSame('<span class="icon-facebook" aria-hidden="true"></span>', $html);
|
||||
}
|
||||
|
||||
public function testRenderIconWithExtraClass(): void
|
||||
{
|
||||
$html = ServiceIconHelper::renderIcon('twitter', 'me-1 text-info');
|
||||
|
||||
$this->assertSame('<span class="icon-twitter me-1 text-info" aria-hidden="true"></span>', $html);
|
||||
}
|
||||
|
||||
public function testRenderIconEscapesExtraClass(): void
|
||||
{
|
||||
$html = ServiceIconHelper::renderIcon('facebook', '"><script>');
|
||||
|
||||
$this->assertStringNotContainsString('<script>', $html);
|
||||
$this->assertStringContainsString('"><script>', $html);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,128 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package MokoSuiteCross
|
||||
* @subpackage Tests
|
||||
* @author Moko Consulting <hello@mokoconsulting.tech>
|
||||
* @copyright Copyright (C) 2026 Moko Consulting. All rights reserved.
|
||||
* @license GNU General Public License version 3 or later; see LICENSE
|
||||
* SPDX-License-Identifier: GPL-3.0-or-later
|
||||
*/
|
||||
|
||||
namespace MokoSuiteCross\Tests\Unit\Service;
|
||||
|
||||
use Joomla\Component\MokoSuiteCross\Administrator\Service\MokoSuiteCrossServiceInterface;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
class ServiceInterfaceContractTest extends TestCase
|
||||
{
|
||||
public function testInterfaceExists(): void
|
||||
{
|
||||
$this->assertTrue(interface_exists(MokoSuiteCrossServiceInterface::class));
|
||||
}
|
||||
|
||||
public function testInterfaceDefinesRequiredMethods(): void
|
||||
{
|
||||
$reflection = new \ReflectionClass(MokoSuiteCrossServiceInterface::class);
|
||||
|
||||
$expectedMethods = [
|
||||
'getServiceType',
|
||||
'getServiceName',
|
||||
'publish',
|
||||
'validateCredentials',
|
||||
'getMaxLength',
|
||||
'supportsMedia',
|
||||
'getSupportedMediaTypes',
|
||||
];
|
||||
|
||||
foreach ($expectedMethods as $method) {
|
||||
$this->assertTrue(
|
||||
$reflection->hasMethod($method),
|
||||
"Interface missing method: {$method}"
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
public function testGetServiceTypeReturnsString(): void
|
||||
{
|
||||
$method = new \ReflectionMethod(MokoSuiteCrossServiceInterface::class, 'getServiceType');
|
||||
$returnType = $method->getReturnType();
|
||||
|
||||
$this->assertNotNull($returnType);
|
||||
$this->assertSame('string', $returnType->getName());
|
||||
}
|
||||
|
||||
public function testPublishAcceptsCorrectParameters(): void
|
||||
{
|
||||
$method = new \ReflectionMethod(MokoSuiteCrossServiceInterface::class, 'publish');
|
||||
$params = $method->getParameters();
|
||||
|
||||
$this->assertCount(4, $params);
|
||||
$this->assertSame('message', $params[0]->getName());
|
||||
$this->assertSame('media', $params[1]->getName());
|
||||
$this->assertSame('credentials', $params[2]->getName());
|
||||
$this->assertSame('params', $params[3]->getName());
|
||||
}
|
||||
|
||||
public function testPublishReturnsArray(): void
|
||||
{
|
||||
$method = new \ReflectionMethod(MokoSuiteCrossServiceInterface::class, 'publish');
|
||||
$returnType = $method->getReturnType();
|
||||
|
||||
$this->assertNotNull($returnType);
|
||||
$this->assertSame('array', $returnType->getName());
|
||||
}
|
||||
|
||||
public function testGetMaxLengthReturnsInt(): void
|
||||
{
|
||||
$method = new \ReflectionMethod(MokoSuiteCrossServiceInterface::class, 'getMaxLength');
|
||||
$returnType = $method->getReturnType();
|
||||
|
||||
$this->assertNotNull($returnType);
|
||||
$this->assertSame('int', $returnType->getName());
|
||||
}
|
||||
|
||||
public function testSupportsMediaReturnsBool(): void
|
||||
{
|
||||
$method = new \ReflectionMethod(MokoSuiteCrossServiceInterface::class, 'supportsMedia');
|
||||
$returnType = $method->getReturnType();
|
||||
|
||||
$this->assertNotNull($returnType);
|
||||
$this->assertSame('bool', $returnType->getName());
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider servicePluginClassProvider
|
||||
*/
|
||||
public function testServicePluginImplementsInterface(string $className): void
|
||||
{
|
||||
if (!class_exists($className)) {
|
||||
$this->markTestSkipped("Class {$className} not autoloadable (needs Joomla runtime)");
|
||||
}
|
||||
|
||||
$this->assertTrue(
|
||||
is_subclass_of($className, MokoSuiteCrossServiceInterface::class),
|
||||
"{$className} does not implement MokoSuiteCrossServiceInterface"
|
||||
);
|
||||
}
|
||||
|
||||
public static function servicePluginClassProvider(): array
|
||||
{
|
||||
$plugins = [
|
||||
'facebook', 'twitter', 'linkedin', 'mastodon', 'bluesky',
|
||||
'telegram', 'discord', 'slack', 'mailchimp', 'medium',
|
||||
'instagram', 'youtube', 'threads', 'pinterest', 'reddit',
|
||||
];
|
||||
|
||||
$cases = [];
|
||||
|
||||
foreach ($plugins as $plugin) {
|
||||
$class = ucfirst($plugin);
|
||||
$cases[$plugin] = [
|
||||
"Joomla\\Plugin\\MokoSuiteCross\\{$class}\\Extension\\{$class}Service",
|
||||
];
|
||||
}
|
||||
|
||||
return $cases;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package MokoSuiteCross
|
||||
* @subpackage Tests
|
||||
* @author Moko Consulting <hello@mokoconsulting.tech>
|
||||
* @copyright Copyright (C) 2026 Moko Consulting. All rights reserved.
|
||||
* @license GNU General Public License version 3 or later; see LICENSE
|
||||
* SPDX-License-Identifier: GPL-3.0-or-later
|
||||
*/
|
||||
|
||||
require_once __DIR__ . '/../vendor/autoload.php';
|
||||
|
||||
if (!defined('_JEXEC')) {
|
||||
define('_JEXEC', 1);
|
||||
}
|
||||
Reference in New Issue
Block a user