public static function setUpBeforeClass()
 {
     parent::setUpBeforeClass();
     SecurityTestHelper::createSuperAdmin();
     $super = User::getByUsername('super');
     Yii::app()->user->userModel = $super;
     EmailTemplateTestHelper::createEmailTemplateByName(EmailTemplate::TYPE_CONTACT, 'Subject 01', 'Contact', 'EmailTemplate 01', 'html', 'text');
     EmailTemplateTestHelper::createEmailTemplateByName(EmailTemplate::TYPE_CONTACT, 'Subject 02', 'Contact', 'EmailTemplate 02', 'html', 'text');
     EmailTemplateTestHelper::createEmailTemplateByName(EmailTemplate::TYPE_CONTACT, 'Subject 03', 'Contact', 'EmailTemplate 03', 'html', 'text');
     MarketingListTestHelper::createMarketingListByName('MarketingListName', 'MarketingList Description', 'first', '*****@*****.**');
 }
コード例 #2
0
 public static function setUpBeforeClass()
 {
     parent::setUpBeforeClass();
     SecurityTestHelper::createSuperAdmin();
     $super = User::getByUsername('super');
     Yii::app()->user->userModel = $super;
     // Setup test data owned by the super user.
     EmailTemplateTestHelper::createEmailTemplateByName(EmailTemplate::TYPE_WORKFLOW, 'Test Subject', 'Contact', 'Test Name', 'Test HtmlContent', 'Test TextContent');
     EmailTemplateTestHelper::createEmailTemplateByName(EmailTemplate::TYPE_CONTACT, 'Test Subject1', 'Contact', 'Test Name1', 'Test HtmlContent1', 'Test TextContent1');
     ReadPermissionsOptimizationUtil::rebuild();
 }
 public static function setUpBeforeClass()
 {
     parent::setUpBeforeClass();
     SecurityTestHelper::createSuperAdmin();
     $super = User::getByUsername('super');
     Yii::app()->user->userModel = $super;
     EmailTemplateTestHelper::createEmailTemplateByName(EmailTemplate::TYPE_CONTACT, 'Subject 01', 'Contact', 'EmailTemplate 01', 'Html Content 01', 'Text Content 01');
     EmailTemplateTestHelper::createEmailTemplateByName(EmailTemplate::TYPE_CONTACT, 'Subject 02', 'Contact', 'EmailTemplate 02', 'Html Content 02', 'Text Content 03');
     EmailTemplateTestHelper::createEmailTemplateByName(EmailTemplate::TYPE_CONTACT, 'Subject 03', 'Contact', 'EmailTemplate 03', 'Html Content 03', 'Text Content 03');
     EmailTemplateTestHelper::createEmailTemplateByName(EmailTemplate::TYPE_CONTACT, 'Subject 04', 'Contact', 'EmailTemplate 04', 'Html Content 04', 'Text Content 04');
     EmailTemplateTestHelper::createEmailTemplateByName(EmailTemplate::TYPE_WORKFLOW, 'Subject 05', 'Contact', 'EmailTemplate 05', 'Html Content 05', 'Text Content 05');
     $marketingList = MarketingListTestHelper::createMarketingListByName('MarketingListName', 'MarketingList Description');
     static::$marketingListId = $marketingList->id;
     AutoresponderTestHelper::createAutoresponder('Subject 01', 'This is text Content 01', 'This is html Content 01', 10, Autoresponder::OPERATION_SUBSCRIBE, true, $marketingList);
     AutoresponderTestHelper::createAutoresponder('Subject 02', 'This is text Content 02', 'This is html Content 02', 5, Autoresponder::OPERATION_UNSUBSCRIBE, false, $marketingList);
     ReadPermissionsOptimizationUtil::rebuild();
 }
コード例 #4
0
 public function testSuperUserAllDefaultControllerActions()
 {
     // Test all default controller actions that do not require any POST/GET variables to be passed.
     // This does not include portlet controller actions.
     $this->runControllerWithNoExceptionsAndGetContent('emailTemplates/default');
     $this->runControllerWithNoExceptionsAndGetContent('emailTemplates/default/index');
     $this->runControllerWithNoExceptionsAndGetContent('emailTemplates/default/listForWorkflow');
     $this->runControllerWithNoExceptionsAndGetContent('emailTemplates/default/listForMarketing');
     // Setup test data owned by the super user.
     EmailTemplateTestHelper::createEmailTemplateByName(EmailTemplate::TYPE_WORKFLOW, 'Test Subject', 'Contact', 'Test Name', 'Test HtmlContent', 'Test TextContent');
     EmailTemplateTestHelper::createEmailTemplateByName(EmailTemplate::TYPE_CONTACT, 'Test Subject1', 'Contact', 'Test Name1', 'Test HtmlContent1', 'Test TextContent1');
     $this->runControllerWithNoExceptionsAndGetContent('emailTemplates/default');
     $this->runControllerWithNoExceptionsAndGetContent('emailTemplates/default/index');
     $this->runControllerWithNoExceptionsAndGetContent('emailTemplates/default/listForWorkflow');
     $this->runControllerWithNoExceptionsAndGetContent('emailTemplates/default/listForMarketing');
     $this->setGetArray(array('type' => EmailTemplate::TYPE_CONTACT));
     $this->runControllerWithNoExceptionsAndGetContent('emailTemplates/default/create');
 }
コード例 #5
0
 public function testRegularUserAllDefaultControllerActions()
 {
     $emailTemplate = EmailTemplateTestHelper::createEmailTemplateByName(EmailTemplate::TYPE_CONTACT, 'Test Subject Regular 01', 'Contact', 'Test Name Regular 01', 'Test HtmlContent Regular 01', 'Test TextContent Regular 01');
     $this->runControllerShouldResultInAccessFailureAndGetContent('emailTemplates/default');
     $this->runControllerShouldResultInAccessFailureAndGetContent('emailTemplates/default/index');
     $this->runControllerShouldResultInAccessFailureAndGetContent('emailTemplates/default/listForMarketing');
     $this->runControllerShouldResultInAccessFailureAndGetContent('emailTemplates/default/listForWorkflow');
     $this->setGetArray(array('type' => EmailTemplate::TYPE_CONTACT));
     $this->runControllerShouldResultInAccessFailureAndGetContent('emailTemplates/default/create');
     $this->setGetArray(array('id' => $emailTemplate->id));
     $this->runControllerShouldResultInAccessFailureAndGetContent('emailTemplates/default/edit');
     $this->runControllerShouldResultInAccessFailureAndGetContent('emailTemplates/default/details');
     $this->runControllerShouldResultInAccessFailureAndGetContent('emailTemplates/default/delete');
     $this->resetGetArray();
     $this->user->setRight('EmailTemplatesModule', EmailTemplatesModule::getAccessRight());
     $this->assertTrue($this->user->save());
     $this->runControllerWithNoExceptionsAndGetContent('emailTemplates/default');
     $this->runControllerWithNoExceptionsAndGetContent('emailTemplates/default/index');
     $this->runControllerWithNoExceptionsAndGetContent('emailTemplates/default/listForMarketing');
     $this->runControllerWithNoExceptionsAndGetContent('emailTemplates/default/listForWorkflow');
     $this->setGetArray(array('id' => $emailTemplate->id));
     $this->runControllerWithNoExceptionsAndGetContent('emailTemplates/default/details');
     $this->resetGetArray();
     $this->user->setRight('EmailTemplatesModule', EmailTemplatesModule::getCreateRight());
     $this->assertTrue($this->user->save());
     $this->setGetArray(array('type' => EmailTemplate::TYPE_CONTACT));
     $this->runControllerWithNoExceptionsAndGetContent('emailTemplates/default/create');
     $this->setGetArray(array('type' => EmailTemplate::TYPE_WORKFLOW));
     $this->runControllerWithNoExceptionsAndGetContent('emailTemplates/default/create');
     $this->setGetArray(array('id' => $emailTemplate->id));
     $this->runControllerWithNoExceptionsAndGetContent('emailTemplates/default/edit');
     $this->user->setRight('EmailTemplatesModule', EmailTemplatesModule::getDeleteRight());
     $this->assertTrue($this->user->save());
     $this->runControllerWithRedirectExceptionAndGetUrl('emailTemplates/default/delete');
     $this->setGetArray(array('id' => static::$templateOwnedBySuper->id));
     $this->runControllerShouldResultInAccessFailureAndGetContent('emailTemplates/default/edit');
     $this->runControllerShouldResultInAccessFailureAndGetContent('emailTemplates/default/details');
     $this->runControllerShouldResultInAccessFailureAndGetContent('emailTemplates/default/delete');
 }