assertSame( array(), $conflicts ); $this->assertFalse( WPDO_HivePress_Conflict_Guard::has_conflict() ); } public function test_conflict_detected_when_hpct_const_defined(): void { // Simulate hp-custom-tables presence via constant probe. if ( ! defined( 'HPCT_VERSION' ) ) { define( 'HPCT_VERSION', '1.0.0' ); } WPDO_HivePress_Conflict_Guard::reset_for_tests(); $conflicts = WPDO_HivePress_Conflict_Guard::detect_conflicts(); $this->assertContains( 'hp-custom-tables', $conflicts ); $this->assertTrue( WPDO_HivePress_Conflict_Guard::has_conflict() ); } public function test_check_and_warn_safe_when_no_conflicts(): void { WPDO_HivePress_Conflict_Guard::reset_for_tests(); // Should not throw or render anything when clean. $this->expectOutputString( '' ); WPDO_HivePress_Conflict_Guard::check_and_warn(); } public function test_render_notice_does_nothing_when_not_admin(): void { // is_admin() stub returns false by default. ob_start(); WPDO_HivePress_Conflict_Guard::render_notice(); $out = ob_get_clean(); $this->assertSame( '', $out ); } public function test_guidance_does_not_point_to_a_missing_command(): void { // There is no HPCT importer: `wp wpdo hivepress migrate-from-hpct` never // existed and TMDO_HPCT_Import had no caller once core dropped HPCT. $root = dirname( __DIR__, 2 ); foreach ( array( 'includes/hivepress/class-tmdo-hivepress-conflict-guard.php', 'admin/class-tmdo-admin-hivepress.php' ) as $file ) { $this->assertStringNotContainsString( 'migrate-from-hpct', (string) file_get_contents( $root . '/' . $file ), $file ); } $this->assertFileDoesNotExist( $root . '/includes/class-tmdo-hpct-import.php' ); } public function test_memo_cache_avoids_repeat_probing(): void { WPDO_HivePress_Conflict_Guard::reset_for_tests(); $first = WPDO_HivePress_Conflict_Guard::detect_conflicts(); $second = WPDO_HivePress_Conflict_Guard::detect_conflicts(); $this->assertSame( $first, $second ); } }