Files
peptide-reconstitution-calc…/peptide-reconstitution-calculator.php
peptiderepo 49934b2c25 feat(ci): adopt estate CI + add PHPUnit suite from scratch (v1.2.0)
- Add PHPUnit 9.6 test suite (WP stubs, tests: stubs) — 40 tests across 4 files:
  MathTest: 25 tests covering all PRC_Math public methods and calculate()
  orchestrator with real peptide scenarios (BPC-157/TB-500/Semaglutide/MK-677/
  Ipamorelin) plus edge cases (zero water, negative inputs, floor rounding,
  rounding precision, mcg↔mg conversion).
  DefaultPresetsTest: 11 tests — all 8 expected slugs, required keys per preset
  (dataProvider), dose_unit validity, min<max range, source field, spot-checks.
  RestControllerTest: 7 tests — calculate() 200 + correct values (mcg+mg),
  get_presets() 200, get_preset() 200 for known slug / WP_Error for unknown.
  PresetProviderTest: 4 tests — fallback to defaults sans PR Core, slug key
  present, cache invalidation, idempotent invalidation.
- Add phpunit.xml.dist + tests/bootstrap.php (WP function/class stubs).
- Add composer test script: vendor/bin/phpunit --configuration phpunit.xml.dist.
- Add phpunit/phpunit ^9.6 + yoast/phpunit-polyfills ^2.0 to require-dev.
- Replace standalone ci.yml with thin caller to estate reusable workflow:
  uses: peptiderepo/peptide-e2e/.github/workflows/ci.yml@main
  with: tests: stubs, has_js: true
  permissions: contents: write (required for phpcbf commit-back)
  workflow_call (required for deploy.yml gate).
- deploy.yml unchanged — already gates on ./ci.yml + uses shared deploy-app.yml.
- Version bump 1.1.0 → 1.2.0.

Agent-Session: claude/adopt-ci-20260616
2026-06-16 15:16:48 +00:00

46 lines
2.1 KiB
PHP

<?php
/**
* Plugin Name: Peptide Reconstitution Calculator
* Plugin URI: https://peptiderepo.com/tools/reconstitution-calculator
* Description: Interactive reconstitution calculator with peptide-specific presets from Peptide Repo Core. Computes concentration, injection volume, syringe units, and doses per vial.
* Version: 1.2.0
* Author: peptiderepo
* Author URI: https://peptiderepo.com
* License: GPL-2.0-or-later
* Text Domain: peptide-reconstitution-calculator
* Requires PHP: 8.1
*
* @see ARCHITECTURE.md — Full data flow and file tree.
* @see CONVENTIONS.md — Naming patterns and extension guides.
*
* Depends on: Peptide Repo Core (optional — provides peptide-specific presets).
* Without PR Core, the calculator still works with manual entry and built-in defaults.
*/
declare(strict_types=1);
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
/* ── Constants ────────────────────────────────────────────────────────── */
define( 'PRC_VERSION', '1.2.0' );
define( 'PRC_PLUGIN_FILE', __FILE__ );
define( 'PRC_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
define( 'PRC_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
/* ── Autoloader ───────────────────────────────────────────────────────── */
require_once PRC_PLUGIN_DIR . 'includes/class-prc-autoloader.php';
PRC_Autoloader::register();
/* ── Activation / Deactivation ────────────────────────────────────────── */
register_activation_hook( __FILE__, [ 'PRC_Activator', 'activate' ] );
register_deactivation_hook( __FILE__, [ 'PRC_Deactivator', 'deactivate' ] );
/* ── Boot ─────────────────────────────────────────────────────────────── */
add_action( 'plugins_loaded', [ 'PRC_Calculator', 'boot' ] );