/**
  * Test CRUD methods for partials.
  *
  * @see WP_Customize_Selective_Refresh::get_partial()
  * @see WP_Customize_Selective_Refresh::add_partial()
  * @see WP_Customize_Selective_Refresh::remove_partial()
  */
 function test_crud_partial()
 {
     $partial = $this->selective_refresh->add_partial('foo');
     $this->assertInstanceOf('WP_Customize_Partial', $partial);
     $this->assertEquals($partial, $this->selective_refresh->get_partial($partial->id));
     $this->assertArrayHasKey($partial->id, $this->selective_refresh->partials());
     $this->selective_refresh->remove_partial($partial->id);
     $this->assertEmpty($this->selective_refresh->get_partial($partial->id));
     $this->assertArrayNotHasKey($partial->id, $this->selective_refresh->partials());
     // @todo Test applying of customize_dynamic_partial_args filter.
     // @todo Test applying of customize_dynamic_partial_class filter.
 }
 /**
  * Test WP_Customize_Selective_Refresh::add_dynamic_partials().
  *
  * @see WP_Customize_Selective_Refresh::add_dynamic_partials()
  */
 function test_add_dynamic_partials()
 {
     $partial_ids = array('recognized', 'recognized-class', 'unrecognized', 'already-added');
     $partials = $this->selective_refresh->add_dynamic_partials($partial_ids);
     $this->assertEmpty($partials);
     $this->selective_refresh->add_partial('already-added');
     add_filter('customize_dynamic_partial_args', array($this, 'filter_customize_dynamic_partial_args'), 10, 2);
     add_filter('customize_dynamic_partial_class', array($this, 'filter_customize_dynamic_partial_class'), 10, 3);
     $partials = $this->selective_refresh->add_dynamic_partials($partial_ids);
     $this->assertEqualSets(array('recognized', 'recognized-class'), wp_list_pluck($partials, 'id'));
     $this->assertInstanceOf('Tested_Custom_Partial', $this->selective_refresh->get_partial('recognized-class'));
     $this->assertNotInstanceOf('Tested_Custom_Partial', $this->selective_refresh->get_partial('recognized'));
     $this->assertEquals('.recognized', $this->selective_refresh->get_partial('recognized')->selector);
 }