Skip to content

Commit 1ff6f27

Browse files
author
Soare Robert-Daniel
committed
dev: clean up
1 parent 45d2eb4 commit 1ff6f27

6 files changed

Lines changed: 16 additions & 22 deletions

File tree

AGENTS.md

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ npm run dist
2222

2323
```bash
2424
# PHPUnit — requires Docker (wp-env)
25-
npm run test:unit:php:setup # Start WordPress Docker environment
25+
npm run env:setup # Start WordPress Docker environment
2626
bash ./bin/e2e-after-setup.sh # Prepare database/test data
2727
npm run test:unit:php # Run PHPUnit tests
2828

@@ -61,14 +61,14 @@ You can read more about it on `./ARCHITECTURE.md`, but here’s a high-level ove
6161

6262
### Core Classes
6363

64-
| Class | File | Role |
65-
|---|---|---|
66-
| `NM_PersonalizedProduct` | `classes/plugin.class.php` | Main plugin — registers all WooCommerce hooks, loads input types |
67-
| `NM_PersonalizedProduct_Admin` | `classes/admin.class.php` | Admin-only coordinator for menus, settings, attach flows, and admin AJAX |
68-
| `PPOM_Meta` | `classes/ppom.class.php` | Product-side field-group resolver that reads attached groups and loads settings/fields from the custom DB table |
69-
| `PPOM_Form` | `classes/form.class.php` | Frontend form rendering |
70-
| `PPOM_Fields_Meta` | `classes/fields.class.php` | Admin field-builder UI, modals, and builder asset loading |
71-
| `PPOM_Inputs` | `classes/input.class.php` | Input type manager |
64+
| Class | File | Role |
65+
| ------------------------------ | -------------------------- | --------------------------------------------------------------------------------------------------------------- |
66+
| `NM_PersonalizedProduct` | `classes/plugin.class.php` | Main plugin — registers all WooCommerce hooks, loads input types |
67+
| `NM_PersonalizedProduct_Admin` | `classes/admin.class.php` | Admin-only coordinator for menus, settings, attach flows, and admin AJAX |
68+
| `PPOM_Meta` | `classes/ppom.class.php` | Product-side field-group resolver that reads attached groups and loads settings/fields from the custom DB table |
69+
| `PPOM_Form` | `classes/form.class.php` | Frontend form rendering |
70+
| `PPOM_Fields_Meta` | `classes/fields.class.php` | Admin field-builder UI, modals, and builder asset loading |
71+
| `PPOM_Inputs` | `classes/input.class.php` | Input type manager |
7272

7373
### Input Type System
7474

@@ -77,6 +77,7 @@ Each input type has a class in `classes/inputs/` (e.g. `input.text.php`, `input.
7777
### Include Files (`inc/`)
7878

7979
Procedural utility code organized by concern:
80+
8081
- `functions.php` — general helpers
8182
- `hooks.php` — filter/action callbacks
8283
- `validation.php` — server-side field validation

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ To set-up the environment you can follow the example from `test-php.yml` or the
8383
To run with Docker:
8484

8585
```bash
86-
npm run test:unit:php:setup # start the wordpress instance
86+
npm run env:setup # start the wordpress instance
8787
npm run test:unit:php # run the wp tests inside the tests-wordpress container
8888
```
8989

bin/e2e-after-setup.sh

Lines changed: 0 additions & 6 deletions
This file was deleted.

classes/admin.class.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -719,8 +719,8 @@ public function ppom_attach_ppoms() {
719719
/**
720720
* Stores category and tag attachment rules on a PPOM field-group row.
721721
*
722-
* @param int $ppom_id PPOM field-group ID.
723-
* @param array $categories Category slugs attached to the field group.
722+
* @param int $ppom_id PPOM field-group ID.
723+
* @param array $categories Category slugs attached to the field group.
724724
* @param array|false $tags Serialized tag slugs, an empty array to clear tags, or false to leave tags unchanged.
725725
*
726726
* @return void
@@ -734,7 +734,7 @@ public static function save_categories_and_tags( $ppom_id, $categories, $tags )
734734
);
735735

736736
// false = caller chose not to change tags (e.g. E2E partial update); omit column from UPDATE.
737-
if ( false !== $tags && is_array( $tags ) ) {
737+
if ( is_array( $tags ) ) {
738738
$data_to_update['productmeta_tags'] = empty( $tags ) ? '' : serialize( $tags );
739739
}
740740

package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,9 @@
3737
"build:grunt": "grunt build",
3838
"grunt": "grunt",
3939
"wp-env": "wp-env",
40-
"env:after:setup": "bash ./bin/e2e-after-setup.sh",
4140
"test:e2e": "wp-scripts test-playwright --config tests/e2e/playwright.config.js",
4241
"test:e2e:debug": "wp-scripts test-playwright --config tests/e2e/playwright.config.js --ui",
43-
"test:unit:php:setup": "wp-env start",
42+
"env:setup": "wp-env start",
4443
"test:unit:php:setup:debug": "wp-env start --xdebug",
4544
"test:unit:php": "wp-env run --env-cwd='wp-content/plugins/woocommerce-product-addon' tests-wordpress vendor/bin/phpunit -c phpunit.xml --verbose",
4645
"lint": "wp-scripts lint-js ./js/",

phpcs.baseline.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@
125125
<violation file="classes/admin.class.php" sniff="WordPress.DB.DirectDatabaseQuery.NoCaching" signature="04f6dc51ac2a8f6ce38ea8879a1df7cfb2f4db78"/>
126126
<violation file="classes/admin.class.php" sniff="WordPress.DB.DirectDatabaseQuery.NoCaching" signature="7265beead929a772a1a31bc295ca76457115e661"/>
127127
<violation file="classes/admin.class.php" sniff="WordPress.DB.PreparedSQL.InterpolatedNotPrepared" signature="868feaab2785372f9df272040e1cf939f32fab03"/>
128-
<violation file="classes/admin.class.php" sniff="WordPress.PHP.DiscouragedPHPFunctions.serialize_serialize" signature="88018cf90cd92ed1f116de38b4a7e1dc1e528a9f"/>
128+
<violation file="classes/admin.class.php" sniff="WordPress.PHP.DiscouragedPHPFunctions.serialize_serialize" signature="ac0d71a81281dc15efeeb74049d688f26c968b94"/>
129129
<violation file="classes/admin.class.php" sniff="WordPress.Security.EscapeOutput.OutputNotEscaped" signature="0887cf1c16ff27aa23a654fc7e1828f70bf6557a"/>
130130
<violation file="classes/admin.class.php" sniff="WordPress.Security.EscapeOutput.OutputNotEscaped" signature="145c3a2f9b92e01afc5d6911c7bdc0f122816d98"/>
131131
<violation file="classes/admin.class.php" sniff="WordPress.Security.EscapeOutput.OutputNotEscaped" signature="78682f38a10b1192e8a8ea1773ddb2d7ca43c4e6"/>

0 commit comments

Comments
 (0)