File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 22 "require" : {
33 "php" : " >=8.2"
44 },
5- "require-dev" : {
6- "glpi-project/tools" : " ^0.8"
7- },
85 "config" : {
96 "optimize-autoloader" : true ,
107 "platform" : {
118 "php" : " 8.2.99"
129 },
1310 "sort-packages" : true
11+ },
12+ "autoload-dev" : {
13+ "psr-4" : {
14+ "GlpiPlugin\\ {NS_NAME}\\ Tests\\ " : " tests/"
15+ }
1416 }
1517}
Original file line number Diff line number Diff line change 4848NAME=$( echo $1 | tr -dc ' [[:alpha:]]' )
4949LNAME=$( echo " $NAME " | tr ' [:upper:]' ' [:lower:]' )
5050UNAME=$( echo " $NAME " | tr ' [:lower:]' ' [:upper:]' )
51+ NS_NAME=$( echo " $1 " | sed -E ' s/\b([a-z])/\U\1/g' | tr -dc ' [[:alpha:]]' )
5152VERSION=$2
5253YEAR=$( date +%Y)
5354
8586 -e " s/{NAME}/$NAME /g" \
8687 -e " s/{LNAME}/$LNAME /g" \
8788 -e " s/{UNAME}/$UNAME /g" \
89+ -e " s/{NS_NAME}/$NS_NAME /g" \
8890 -e " s/{VERSION}/$VERSION /g" \
8991 -e " s/{YEAR}/$YEAR /g" \
9092 -i setup.php hook.php $LNAME .xml tools/HEADER README.md Makefile .github/workflows/continuous-integration.yml tests/bootstrap.php composer.json rector.php
9395sed -i ' /^[[:space:]]*composer\.lock[[:space:]]*$/d' .gitignore
9496
9597popd > /dev/null
98+
99+ echo -e " \033[0;32mPlugin $NAME created under $DEST \033[0m"
Original file line number Diff line number Diff line change 3131 * -------------------------------------------------------------------------
3232 */
3333
34+ $ current_plugin_folder = basename (realpath (__DIR__ . '/../ ' ));
35+
3436require __DIR__ . '/../../../tests/bootstrap.php ' ;
37+ require dirname (__DIR__ ) . '/vendor/autoload.php ' ;
3538
36- if (!Plugin::isPluginActive (" {LNAME} " )) {
37- throw new RuntimeException ("Plugin {LNAME} is not active in the test database " );
39+ if (!Plugin::isPluginActive ($ current_plugin_folder )) {
40+ throw new RuntimeException ("Plugin $ current_plugin_folder is not active in the test database " );
3841}
You can’t perform that action at this time.
0 commit comments