assertSame( 'peptide-research', $result->get_category() ); $this->assertSame( [ 'BPC-157', 'healing' ], $result->get_keywords() ); $this->assertSame( 8, $result->get_relevance_score() ); $this->assertSame( 'High relevance to target audience.', $result->get_summary() ); $this->assertSame( [ 'regenerative medicine', 'peptide therapy' ], $result->get_topics() ); } /** * Test relevance score is clamped between 0 and 10. */ public function test_relevance_score_boundaries(): void { $high = new \PRAutoBlogger_Analysis_Result( 'cat', [], 10, 'Max score.', [] ); $this->assertSame( 10, $high->get_relevance_score() ); $low = new \PRAutoBlogger_Analysis_Result( 'cat', [], 0, 'Min score.', [] ); $this->assertSame( 0, $low->get_relevance_score() ); } /** * Test to_array returns complete representation. */ public function test_to_array_completeness(): void { $result = new \PRAutoBlogger_Analysis_Result( 'news', [ 'test' ], 5, 'Summary text.', [ 'topic1' ] ); $array = $result->to_array(); $this->assertIsArray( $array ); $this->assertArrayHasKey( 'category', $array ); $this->assertArrayHasKey( 'keywords', $array ); $this->assertArrayHasKey( 'relevance_score', $array ); $this->assertArrayHasKey( 'summary', $array ); $this->assertArrayHasKey( 'topics', $array ); } }