fields(); $this->assertCount(2, $fields); $this->assertSame('content', $fields[0]['key']); $this->assertSame('text', $fields[0]['control']); $this->assertSame('align', $fields[1]['key']); $this->assertSame('alignment', $fields[1]['control']); $alignValues = array_column($fields[1]['options'], 'value'); $this->assertSame(['left', 'center', 'right'], $alignValues); } public function test_apply_content_rewrites_inner_p_preserving_p_attributes() { $block = $this->paragraphBlock('

old

'); $result = (new Paragraph())->apply($block, 'content', 'new'); $this->assertSame('

new

', $result['innerHTML']); $this->assertSame([$result['innerHTML']], $result['innerContent']); } public function test_apply_content_synthesizes_p_when_none_exists() { $block = $this->paragraphBlock(''); $result = (new Paragraph())->apply($block, 'content', 'hello'); $this->assertSame('

hello

', $result['innerHTML']); $this->assertSame(['

hello

'], $result['innerContent']); } public function test_apply_content_runs_through_wp_kses_post() { $block = $this->paragraphBlock('

old

'); $result = (new Paragraph())->apply($block, 'content', 'safe '); // wp_kses_post strips