Files
2meet-data-optimizer-hivepr…/tests/unit/NoHotZoneRegistrationTest.php
T
wpdev 0254e40d83
Tests / PHP Lint (pull_request) Successful in 50s
Tests / Unit Tests (pull_request) Successful in 58s
Tests / Integration Tests (pull_request) Successful in 57s
refactor(2meet-data-optimizer-hivepress-addon): stop registering Hot zone fields
- ADR-003 step 4 (AddOn side): core, requests, bookings, memberships and
  marketplace adapters no longer register zone=hot fields or contribute
  hot_* FSM modules; their keys live in TMDO_HivePress_Entity_Groups.
  Cold/warm registrations are unchanged.
- Hot-table doctor probes go with them (trait defaults apply). The
  hot-clause query rewrite and cron optimizer are now inert and are left
  for the ADR step-5 removal together with core's hot path.
- New NoHotZoneRegistrationTest pins the invariant across all 13 adapters;
  per-adapter hot assertions removed.
- Verify: HP unit 142 / integration 49 green, phpcs clean (WordPress)
- PR: PR-037
2026-09-26 01:13:35 +08:00

52 lines
1.6 KiB
PHP

<?php
declare(strict_types=1);
use PHPUnit\Framework\TestCase;
/**
* ADR-003: post fields converge on entity groups; the Hot zone is frozen.
*
* No HivePress adapter registers zone=hot fields or contributes hot_* FSM
* modules. The fields they used to cover live in TMDO_HivePress_Entity_Groups.
*/
class NoHotZoneRegistrationTest extends TestCase {
private const ADAPTERS = array(
'TMDO_HivePress_Core_Adapter',
'TMDO_HivePress_Requests_Adapter',
'TMDO_HivePress_Bookings_Adapter',
'TMDO_HivePress_Memberships_Adapter',
'TMDO_HivePress_Marketplace_Adapter',
'TMDO_HivePress_Favorites_Adapter',
'TMDO_HivePress_Reviews_Adapter',
'TMDO_HivePress_Social_Links_Adapter',
'TMDO_HivePress_Blocks_Adapter',
'TMDO_HivePress_Seo_Adapter',
'TMDO_HivePress_Messages_Adapter',
'TMDO_HivePress_Statistics_Adapter',
'TMDO_HivePress_Tags_Adapter',
);
protected function setUp(): void {
$prop = ( new ReflectionClass( TMDO_Schema_Registry::class ) )->getProperty( 'instance' );
$prop->setAccessible( true );
$prop->setValue( null, null );
}
public function test_no_adapter_registers_hot_fields(): void {
$registry = TMDO_Schema_Registry::instance();
foreach ( self::ADAPTERS as $class ) {
( new $class() )->on_register_fields( $registry );
}
$this->assertSame( array(), $registry->get_zone_fields( 'hot' ) );
$this->assertSame( 'cold', $registry->get_field_zone( 'hp_listing', 'hp_images' ), 'cold fields stay' );
}
public function test_no_adapter_contributes_hot_modules(): void {
foreach ( self::ADAPTERS as $class ) {
$this->assertSame( array(), ( new $class() )->migrations(), $class );
}
}
}