/**
  * @backupStaticAttributes enabled
  */
 public function test_データベースに保存()
 {
     $this->Setting->set('usedb', 1);
     $Mail_Service = new MW_WP_Form_Mail_Service($this->Mail, $this->form_key, $this->Setting);
     $Mail_Service->send_admin_mail();
     $Mail_Service->send_reply_mail();
     $this->assertEquals(1, count(get_posts(array('post_type' => MWF_Functions::get_contact_data_post_type_from_form_id($this->Setting->get('post_id')), 'posts_per_page' => -1))));
 }
예제 #2
0
 /**
  * setUp
  */
 public function setUp()
 {
     parent::setUp();
     $post_id = $this->factory->post->create(array('post_type' => MWF_Config::NAME));
     $Setting = new MW_WP_Form_Setting($post_id);
     $Setting->set('usedb', 1);
     $post_ids = $this->factory->post->create_many(50, array('post_type' => MWF_Functions::get_contact_data_post_type_from_form_id($Setting->get('post_id'))));
     $this->post_type = get_post_type($post_ids[0]);
     $this->CSV = new MW_WP_Form_CSV($this->post_type);
 }
 /**
  * @group mwform
  */
 public function test_mwform_querystringが有効な場合は引数で指定された投稿情報に置換()
 {
     global $wp_query, $post;
     $wp_query->is_singular = true;
     $this->Setting->set('querystring', 1);
     $this->Setting->save();
     $post_id = $this->factory->post->create();
     $post_id_2 = $this->factory->post->create();
     update_post_meta($post_id_2, 'meta', 'meta');
     $ExecShortcode = $this->get_ExecShortcode_after_add_shortcode('input');
     $_GET['post_id'] = $post_id_2;
     $content = "{ID}\n";
     $content .= "{post_title}\n";
     $content .= "{post_content}\n";
     $content .= "{post_excerpt}\n";
     $content .= "{meta}";
     $post = get_post($post_id_2);
     $this->assertEquals("{$post->ID}\n{$post->post_title}\n{$post->post_content}\n{$post->post_excerpt}\n{$post->meta}", $ExecShortcode->get_the_content($content));
 }
예제 #4
0
 /**
  * @group save
  */
 public function test_save()
 {
     $this->Setting->set('mail_subject', 'new_mail_subject');
     $this->Setting->save();
     $this->assertEquals('new_mail_subject', $this->Setting->get('mail_subject'));
 }
예제 #5
0
 /**
  * @group set_reply_mail_raw_params
  * @backupStaticAttributes enabled
  */
 public function test_set_reply_mail_raw_params_設定あり()
 {
     $post_id = $this->factory->post->create(array('post_type' => MWF_Config::NAME));
     $Setting = new MW_WP_Form_Setting($post_id);
     $Setting->set('automatic_reply_email', 'メールアドレス');
     $Setting->set('mail_from', '*****@*****.**');
     $Setting->set('mail_sender', 'sender');
     $Setting->set('mail_subject', 'subject');
     $Setting->set('mail_content', 'body');
     $Data = MW_WP_Form_Data::getInstance(MWF_Functions::get_form_key_from_form_id($post_id));
     $Data->set('メールアドレス', '*****@*****.**');
     $this->Mail->set_reply_mail_raw_params($Setting);
     $this->assertEquals('*****@*****.**', $this->Mail->to);
     $this->assertEquals('*****@*****.**', $this->Mail->from);
     $this->assertEquals('sender', $this->Mail->sender);
     $this->assertEquals('subject', $this->Mail->subject);
     $this->assertEquals('body', $this->Mail->body);
 }