/** * Tests whether ready_and_print calls \HTML->Draw(); * * @group stable * @group isolated * @group defaults * */ function testReadyAndPrintExpectsProcessDefaultsAndHTMLDraw() { // Arrange $fields = array('args' => array('field_one' => array('title' => 'First', 'slug' => 'field_one', 'type' => 'text', 'params' => array(), 'howto' => 'hidden', 'meta_key' => 'field_one'))); $expected = array('field_one' => array('title' => 'First', 'slug' => 'field_one', 'type' => 'text', 'params' => array(), 'howto' => 'hidden', 'meta_key' => 'field_one', 'max_length' => 255, 'placeholder' => null, 'label' => null, 'value' => null)); $HTML = $this->getMock('\\CFPB\\Utils\\MetaBox\\HTML', array('draw')); $ready = $this->getMockBuilder('\\CFPB\\Utils\\MetaBox\\View')->setMethods(array('process_defaults'))->getMock(); $ready->replace_HTML($HTML); $returned = $ready->expects($this->once())->method('process_defaults'); \WP_Mock::wpPassThruFunction('get_post_meta'); \WP_Mock::wpFunction('get_the_ID'); $post = new StdClass(); $HTML->expects($this->once())->method('draw'); // Act $ready->ready_and_print_html($post, $fields); // Assert }