/**
  * Set up the test fixture
  */
 public function setUp()
 {
     parent::setUp();
     $this->post_id = $this->factory->post->create();
     $this->field_args = array('name' => 'Name', 'id' => 'test_test', 'type' => 'text', 'attributes' => array('type' => 'number', 'disabled' => 'disabled', 'data-test' => 'data-value', 'data-test' => json_encode(array('name' => 'Name', 'id' => 'test_test', 'type' => 'text'))));
     $this->object_id = $this->post_id;
     $this->object_type = 'post';
     $this->group = false;
     $this->field = new CMB2_Field(array('object_id' => $this->object_id, 'object_type' => $this->object_type, 'group' => $this->group, 'field_args' => $this->field_args));
 }
 /**
  * Set up the test fixture
  */
 public function setUp()
 {
     parent::setUp();
     $this->cmb_id = 'test';
     $this->field_test = array('id' => 'field_test', 'fields' => array(array('name' => 'Name', 'desc' => 'This is a description', 'id' => 'field_test_field', 'type' => 'text')));
     $this->attributes_test = array('id' => 'attributes_test', 'fields' => array(array('name' => 'Name', 'desc' => 'This is a description', 'id' => 'attributes_test_field', 'type' => 'text', 'attributes' => array('type' => 'number', 'disabled' => 'disabled', 'id' => 'arbitrary-id', 'data-test' => json_encode(array('one' => 'One', 'two' => 'Two', 'true' => true, 'false' => false, 'array' => array('nested_data' => true)))))));
     $this->options_test = array('id' => 'options_test', 'fields' => array(array('name' => 'Name', 'description' => 'This is a description', 'id' => 'options_test_field', 'type' => 'select', 'options' => array('one' => 'One', 'two' => 'Two', 'true' => true, 'false' => false))));
     $this->options_cb_test = array('id' => 'options_cb_test', 'fields' => array(array('name' => 'Name', 'description' => 'This is a description', 'id' => 'options_cb_test_field', 'type' => 'select', 'options_cb' => array($this, 'options_cb'))));
     $this->options_cb_and_array_test = array('id' => 'options_cb_and_array_test', 'fields' => array(array('name' => 'Name', 'description' => 'This is a description', 'id' => 'options_cb_and_array_test_field', 'type' => 'select', 'options' => array('one' => 'One', 'two' => 'Two', 'true' => true, 'false' => false), 'options_cb' => array($this, 'options_cb'))));
     $this->post_id = $this->factory->post->create();
 }
 /**
  * Set up the test fixture
  */
 public function setUp()
 {
     parent::setUp();
     $this->cmb_id = 'test';
     $this->metabox_array = array('id' => $this->cmb_id, 'fields' => array(array('name' => 'Name', 'description' => 'Description', 'id' => 'test_test', 'type' => 'text', 'before_row' => array($this, 'cmb_before_row'), 'before' => 'testing before', 'after' => array($this, 'cmb_after'), 'after_row' => 'testing after row')));
     $this->metabox_array2 = array('id' => 'test2', 'fields' => array(array('name' => 'Name', 'id' => 'test_test', 'type' => 'text')));
     $this->option_metabox_array = array('id' => 'options_page', 'title' => 'Theme Options Metabox', 'show_on' => array('options-page' => array('theme_options')), 'fields' => array(array('name' => 'Site Background Color', 'desc' => 'field description (optional)', 'id' => 'bg_color', 'type' => 'colorpicker', 'default' => '#ffffff')));
     $this->defaults = array('id' => $this->cmb_id, 'title' => false, 'type' => false, 'object_types' => array(), 'context' => 'normal', 'priority' => 'high', 'show_names' => 1, 'cmb_styles' => 1, 'fields' => array(), 'hookup' => 1, 'new_user_section' => 'add-new-user', 'show_on' => array());
     $this->cmb = new CMB2($this->metabox_array);
     $this->options_cmb = new CMB2($this->option_metabox_array);
     $this->opt_set = array('bg_color' => '#ffffff', 'my_name' => 'Justin');
     add_option($this->options_cmb->cmb_id, $this->opt_set);
     $this->post_id = $this->factory->post->create();
 }
Example #4
0
 public function tearDown()
 {
     parent::tearDown();
 }