assertTrue( trait_exists( 'WPDO_Anti_EAV_Aware' ), 'WPDO_Anti_EAV_Aware trait alias must exist' ); } public function test_class_using_wpdo_anti_eav_aware_is_valid(): void { // Verify a class can `use WPDO_Anti_EAV_Aware` without fatal error. $obj = new class { use WPDO_Anti_EAV_Aware; }; // trait_exists check via class_uses — PHP doesn't support instanceof for traits. $this->assertArrayHasKey( 'WPDO_Anti_EAV_Aware', class_uses( $obj ) ); } // ── Interface alias ─────────────────────────────────────────────────────── public function test_wpdo_entity_adapter_interface_exists(): void { $this->assertTrue( interface_exists( 'WPDO_Entity_Adapter_Interface' ), 'WPDO_Entity_Adapter_Interface must exist as a back-compat alias' ); } public function test_tmdo_adapter_post_implements_wpdo_interface(): void { // An object implementing TMDO_Entity_Adapter_Interface must also // satisfy `instanceof WPDO_Entity_Adapter_Interface`. $adapter = new TMDO_Adapter_Post(); $this->assertInstanceOf( 'WPDO_Entity_Adapter_Interface', $adapter ); } // ── DB version consistency ──────────────────────────────────────────────── public function test_tmdo_db_version_constant_matches_installer_schema(): void { // TMDO_DB_VERSION (plugin header constant) must equal TMDO_Installer::SCHEMA_VERSION // (private). If they diverge, maybe_upgrade() either never fires or fires every boot. $ref = new ReflectionClass( TMDO_Installer::class ); $schema_version = $ref->getConstant( 'SCHEMA_VERSION' ); $this->assertSame( TMDO_DB_VERSION, $schema_version, 'TMDO_DB_VERSION constant must match TMDO_Installer::SCHEMA_VERSION' ); } }