/**
  * setUp
  */
 public function setUp()
 {
     parent::setUp();
     $post_id = $this->factory->post->create(array('post_type' => MWF_Config::NAME));
     $this->form_key = MWF_Config::NAME . '-' . $post_id;
     $this->Mail = new MW_WP_Form_Mail();
     $this->Data = MW_WP_Form_Data::getInstance($this->form_key);
     $Validation_Rule_Mail = new MW_WP_Form_Validation_Rule_Mail();
     $Validation_Rule_Mail->set_Data($this->Data);
     $this->Setting = new MW_WP_Form_Setting($post_id);
 }
示例#2
0
 /**
  * 自動返信メール用に初期値を設定
  *
  * @param MW_WP_Form_Setting $Setting
  */
 public function set_reply_mail_raw_params(MW_WP_Form_Setting $Setting)
 {
     $this->to = '';
     $this->cc = '';
     $this->bcc = '';
     $this->attachments = array();
     $Data = MW_WP_Form_Data::getInstance();
     $automatic_reply_email = $Setting->get('automatic_reply_email');
     $form_id = $Setting->get('post_id');
     if ($form_id) {
         $Validation = new MW_WP_Form_Validation_Rule_Mail();
         $Validation->set_Data($Data);
         $is_invalid_mail_address = $Validation->rule($automatic_reply_email);
         // 送信先を指定
         if ($automatic_reply_email && !$is_invalid_mail_address) {
             $this->to = $Data->get_post_value_by_key($automatic_reply_email);
         }
         // 送信元を指定
         $reply_mail_from = get_bloginfo('admin_email');
         if ($Setting->get('mail_from')) {
             $reply_mail_from = $Setting->get('mail_from');
         }
         $this->from = $reply_mail_from;
         // 送信者を指定
         $reply_mail_sender = get_bloginfo('name');
         if ($Setting->get('mail_sender')) {
             $reply_mail_sender = $Setting->get('mail_sender');
         }
         $this->sender = $reply_mail_sender;
         // タイトルを指定
         $this->subject = $Setting->get('mail_subject');
         // 本文を指定
         $this->body = $Setting->get('mail_content');
     }
 }
 /**
  * @backupStaticAttributes enabled
  */
 public function test_メールアドレスの形式でなければnotnull()
 {
     $this->Data->set('text', 'aaa');
     $this->assertNotNull($this->Rule->rule('text'));
 }