/**
  * @group delete_term
  */
 public function test_delete_term()
 {
     $taxonomy = 'category';
     $term_id = $this->factory->term->create(array('taxonomy' => $taxonomy));
     $term = get_term($term_id, 'category');
     $Meta = new Smart_Custom_Fields_Meta($term);
     if (!_get_meta_table($Meta->get_meta_type())) {
         $Meta->add('text', 'text');
         $this->Ajax->delete_term($term_id, '', $taxonomy, $term);
         $this->assertSame(array(), $Meta->get('text'));
     }
 }
Ejemplo n.º 2
0
 /**
  * @group get_term_meta
  */
 public function test_get_term_meta_all()
 {
     $Meta = new Smart_Custom_Fields_Meta(get_term($this->term_id, 'category'));
     $Meta->update('text', 'hoge');
     $Meta->add('checkbox', 1);
     $Meta->add('checkbox', 2);
     // ループ内のチェックボックス(複数値項目)は必ずこのメタデータを持つ
     $Meta->add(SCF_Config::PREFIX . 'repeat-multiple-data', array('checkbox3' => array(1, 2)));
     $Meta->add('checkbox3', 1);
     $Meta->add('checkbox3', 2);
     $Meta->add('checkbox3', 3);
     $this->assertEquals(array('text' => 'hoge', 'checkbox' => array(1, 2), 'group-name-3' => array(array('text3' => '', 'checkbox3' => array(1)), array('text3' => '', 'checkbox3' => array(2, 3))), 'text-has-default' => '', 'text-has-not-default' => '', 'checkbox-has-default' => array(), 'checkbox-has-not-default' => array()), SCF::get_term_meta($this->term_id, 'category'));
 }
 /**
  * @group get_single_data_field_value
  */
 public function test_get_single_data_field_value__保存済の場合は文字列を返す()
 {
     $object = get_post($this->post_id);
     $Field = SCF::get_field($object, 'text-has-default');
     $index = 0;
     $Meta = new Smart_Custom_Fields_Meta($object);
     $Meta->add('text-has-default', 'A');
     $this->assertEquals('A', $this->Controller->get_single_data_field_value($object, $Field, $index));
 }