assertCount( 8, WPDO_HivePress_Suitability_Scorer::DIMENSIONS ); $this->assertContains( 'd1_meta_calls', WPDO_HivePress_Suitability_Scorer::DIMENSIONS ); $this->assertContains( 'd8_perf', WPDO_HivePress_Suitability_Scorer::DIMENSIONS ); } public function test_compute_aggregate_with_empty_input_returns_zero(): void { $this->assertSame( 0.0, WPDO_HivePress_Suitability_Scorer::compute_aggregate( array() ) ); } public function test_compute_aggregate_averages_adapter_scores(): void { $scores = array( 'a' => array( 'aggregate' => 10.0 ), 'b' => array( 'aggregate' => 9.0 ), 'c' => array( 'aggregate' => 8.0 ), ); // (10 + 9 + 8) / 3 = 9.0 $this->assertSame( 9.0, WPDO_HivePress_Suitability_Scorer::compute_aggregate( $scores ) ); } public function test_compute_per_dimension_averages_each_dimension(): void { $scores = array( 'a' => array( 'd1_meta_calls' => 1.0, 'd2_meta_sql' => 1.0, 'd3_table_coverage' => 1.0, 'd4_registry_meta' => 1.0, 'd5_hook_bus' => 1.0, 'd6_options' => 1.0, 'd7_coupling' => 1.0, 'd8_perf' => 0.9, ), 'b' => array( 'd1_meta_calls' => 1.0, 'd2_meta_sql' => 1.0, 'd3_table_coverage' => 1.0, 'd4_registry_meta' => 1.0, 'd5_hook_bus' => 1.0, 'd6_options' => 1.0, 'd7_coupling' => 1.0, 'd8_perf' => 1.0, ), ); $dim = WPDO_HivePress_Suitability_Scorer::compute_per_dimension( $scores ); // d1-d7 are 1.0 across both adapters → average 1.0. $this->assertSame( 1.0, $dim['d1_meta_calls'] ); $this->assertSame( 1.0, $dim['d7_coupling'] ); // d8: (0.9 + 1.0) / 2 = 0.95. $this->assertSame( 0.95, $dim['d8_perf'] ); } public function test_compute_per_dimension_with_empty_input_returns_all_zero(): void { $dim = WPDO_HivePress_Suitability_Scorer::compute_per_dimension( array() ); foreach ( WPDO_HivePress_Suitability_Scorer::DIMENSIONS as $d ) { $this->assertSame( 0.0, $dim[ $d ] ); } } public function test_report_with_no_active_adapters(): void { // Bootstrap not booted in unit env → adapters() = empty. WPDO_HivePress_Bootstrap::reset_for_tests(); $report = WPDO_HivePress_Suitability_Scorer::report(); $this->assertSame( 0, $report['adapter_count'] ); $this->assertSame( 0.0, $report['aggregate'] ); $this->assertSame( array(), $report['adapters'] ); } public function test_adapters_below_threshold_returns_empty_for_unknown_dimension(): void { $this->assertSame( array(), WPDO_HivePress_Suitability_Scorer::adapters_below_threshold( 'd99_garbage' ) ); } }