Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,16 @@
"require": {
"php": ">=8.2"
},
"require-dev": {
"glpi-project/tools": "^0.8"
},
"config": {
"optimize-autoloader": true,
"platform": {
"php": "8.2.99"
},
"sort-packages": true
},
"autoload-dev": {
"psr-4": {
"GlpiPlugin\\{NS_NAME}\\Tests\\": "tests/"
}
}
}
4 changes: 4 additions & 0 deletions plugin.sh
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ fi
NAME=$(echo $1|tr -dc '[[:alpha:]]')
LNAME=$(echo "$NAME" | tr '[:upper:]' '[:lower:]')
UNAME=$(echo "$NAME" | tr '[:lower:]' '[:upper:]')
NS_NAME=$(echo "$1" | sed -E 's/\b([a-z])/\U\1/g' | tr -dc '[[:alpha:]]')
VERSION=$2
YEAR=$(date +%Y)

Expand Down Expand Up @@ -85,6 +86,7 @@ sed \
-e "s/{NAME}/$NAME/g" \
-e "s/{LNAME}/$LNAME/g" \
-e "s/{UNAME}/$UNAME/g" \
-e "s/{NS_NAME}/$NS_NAME/g" \
-e "s/{VERSION}/$VERSION/g" \
-e "s/{YEAR}/$YEAR/g" \
-i setup.php hook.php $LNAME.xml tools/HEADER README.md Makefile .github/workflows/continuous-integration.yml tests/bootstrap.php composer.json rector.php
Expand All @@ -93,3 +95,5 @@ sed \
sed -i '/^[[:space:]]*composer\.lock[[:space:]]*$/d' .gitignore

popd > /dev/null

echo -e "\033[0;32mPlugin $NAME created under $DEST\033[0m"
8 changes: 6 additions & 2 deletions tests/bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,12 @@
* -------------------------------------------------------------------------
*/

$current_plugin_folder = basename(realpath(__DIR__ . '/../'));

require __DIR__ . '/../../../tests/bootstrap.php';
require dirname(__DIR__) . '/vendor/autoload.php';

if (!Plugin::isPluginActive("{LNAME}")) {
throw new RuntimeException("Plugin {LNAME} is not active in the test database");
if (!Plugin::isPluginActive($current_plugin_folder)) {
echo("Plugin $current_plugin_folder is not active in the test database" . PHP_EOL);
die();
}
Loading