public function testSetFormConfig()
    {
        $getArrowTempFilesByIndex = getMethod('MailForm', 'getArrowTempFilesByIndex');
        $getToArrayByIndex = getMethod('MailForm', 'getToArrayByIndex');
        $getFromArrayByIndex = getMethod('MailForm', 'getFromArrayByIndex');
        $getMailSubjectTemplateByIndex = getMethod('MailForm', 'getMailSubjectTemplateByIndex');
        $getMailBodyTemplateByIndex = getMethod('MailForm', 'getMailBodyTemplateByIndex');
        $ErrorCode = getProperty('MailForm', 'ErrorCode');
        $mailform = new MailForm();
        $this->assertFalse($mailform->setFormConfig("", "", 100000));
        $this->assertEquals(MailForm::ERROR_CODE_INVALID_FORM_CONFIG, $ErrorCode->getValue($mailform));
        // フォーマットに合わなくても、大丈夫
        $text = <<<EOT
{"from":"*****@*****.**"}
EOT;
        $this->assertTrue($mailform->setFormConfig($text, "", MailForm::MAILEFORM_FILE_TYPE_JSON));
        $text = <<<EOT
from: from@example.com
mailconf:
  to-admin:
    test: test 
EOT;
        $this->assertTrue($mailform->setFormConfig($text, "", MailForm::MAILEFORM_FILE_TYPE_YAML));
        // フォーマットのパターンテスト
        $text = <<<EOT
mailconf:
  to-admin:
    from: to-admin-from@example.com
    to: 
      -  to-admin-test1 <*****@*****.**>
      -  to-admin-test2@example.com
    subject: "to-admin-subject"
    arrow-temp-files: true
  to-user:
    from:  to-user-from@example.com
    to: to-user-test1@example.com
    body-template-path: "to-user-mail-body-template.txt"
    arrow-temp-files: false
EOT;
        $this->assertTrue($mailform->setFormConfig($text, dirname(__FILE__) . '/conf'));
        $froms = $getFromArrayByIndex->invokeArgs($mailform, array('to-admin'));
        $this->assertCount(1, $froms);
        $this->assertArrayHasKey('*****@*****.**', $froms);
        $this->assertEquals('', $froms['*****@*****.**']);
        $subject = $getMailSubjectTemplateByIndex->invokeArgs($mailform, array('to-admin'));
        $this->assertEquals('to-admin-subject', $subject);
        $tos = $getToArrayByIndex->invokeArgs($mailform, array('to-admin'));
        $this->assertCount(2, $tos);
        $this->assertArrayHasKey('*****@*****.**', $tos);
        $this->assertEquals('to-admin-test1', $tos['*****@*****.**']);
        $this->assertArrayHasKey('*****@*****.**', $tos);
        $this->assertEquals('', $tos['*****@*****.**']);
        $this->assertTrue($getArrowTempFilesByIndex->invokeArgs($mailform, array('to-admin')));
        $froms = $getFromArrayByIndex->invokeArgs($mailform, array('to-user'));
        $this->assertCount(1, $froms);
        $this->assertArrayHasKey('*****@*****.**', $froms);
        $this->assertEquals('', $froms['*****@*****.**']);
        $tos = $getToArrayByIndex->invokeArgs($mailform, array('to-user'));
        $this->assertCount(1, $tos);
        $this->assertArrayHasKey('*****@*****.**', $tos);
        $this->assertEquals('', $tos['*****@*****.**']);
        $body = $getMailBodyTemplateByIndex->invokeArgs($mailform, array('to-user'));
        $this->assertEquals('to-user-mail-body-template', $body);
        $this->assertFalse($getArrowTempFilesByIndex->invokeArgs($mailform, array('to-user')));
    }