public static function deleteAllContactWebForms() { $contactWebForms = ContactWebForm::getAll(); foreach ($contactWebForms as $webForm) { $webForm->delete(); } }
public function testSuperUserAllDefaultControllerActions() { $super = $this->logoutCurrentUserLoginNewUserAndGetByUsername('super'); //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('contactWebForms/default'); $this->runControllerWithNoExceptionsAndGetContent('contactWebForms/default/index'); $this->runControllerWithNoExceptionsAndGetContent('contactWebForms/default/create'); $content = $this->runControllerWithNoExceptionsAndGetContent('contactWebForms/default/list'); $this->assertContains('anyMixedAttributes', $content); //Test the search or paging of the listview. Yii::app()->clientScript->reset(); //to make sure old js doesn't make it to the UI $this->setGetArray(array('ajax' => 'list-view')); $content = $this->runControllerWithNoExceptionsAndGetContent('contactWebForms/default/list'); $this->assertNotContains('anyMixedAttributes', $content); $this->resetGetArray(); //Default Controller actions requiring some sort of parameter via POST or GET //Load Model Edit Views $contactWebForms = ContactWebForm::getAll(); $this->assertEquals(12, count($contactWebForms)); $contactWebFormId = self::getModelIdByModelNameAndName('ContactWebForm', 'Web Form 1'); $contactWebFormId2 = self::getModelIdByModelNameAndName('ContactWebForm', 'Web Form 2'); $contactWebFormId3 = self::getModelIdByModelNameAndName('ContactWebForm', 'Web Form 3'); $contactWebFormId4 = self::getModelIdByModelNameAndName('ContactWebForm', 'Web Form 4'); $contactWebFormId5 = self::getModelIdByModelNameAndName('ContactWebForm', 'Web Form 5'); $contactWebFormId6 = self::getModelIdByModelNameAndName('ContactWebForm', 'Web Form 6'); $contactWebFormId7 = self::getModelIdByModelNameAndName('ContactWebForm', 'Web Form 7'); $contactWebFormId8 = self::getModelIdByModelNameAndName('ContactWebForm', 'Web Form 8'); $contactWebFormId9 = self::getModelIdByModelNameAndName('ContactWebForm', 'Web Form 9'); $contactWebFormId10 = self::getModelIdByModelNameAndName('ContactWebForm', 'Web Form 10'); $contactWebFormId10 = self::getModelIdByModelNameAndName('ContactWebForm', 'Web Form 11'); $contactWebFormId10 = self::getModelIdByModelNameAndName('ContactWebForm', 'Web Form 12'); $this->setGetArray(array('id' => $contactWebFormId)); $this->runControllerWithNoExceptionsAndGetContent('contactWebForms/default/edit'); //Save web form. $contactWebForm = ContactWebForm::getById($contactWebFormId); $attributes = ContactWebFormTestHelper::getContactWebFormAttributes(); $this->setPostArray(array('ContactWebForm' => array('submitButtonLabel' => 'Test Save'), 'ContactWebFormAttributeForm' => $attributes)); $this->runControllerWithRedirectExceptionAndGetContent('contactWebForms/default/edit'); $contactWebForm = ContactWebForm::getById($contactWebFormId); $this->assertEquals('Test Save', $contactWebForm->submitButtonLabel); //Test having a failed validation on the contact during save. $this->setGetArray(array('id' => $contactWebFormId)); $this->setPostArray(array('ContactWebForm' => array('name' => ''), 'ContactWebFormAttributeForm' => $attributes)); $content = $this->runControllerWithNoExceptionsAndGetContent('contactWebForms/default/edit'); $this->assertContains('Name cannot be blank', $content); //Load Model Detail Views $this->setGetArray(array('id' => $contactWebFormId)); $this->resetPostArray(); $this->runControllerWithNoExceptionsAndGetContent('contactWebForms/default/details'); }
/** * @depends testCreateWebFormEntries */ public function testDeleteContactWebForm() { $contactWebForms = ContactWebForm::getAll(); $this->assertEquals(1, count($contactWebForms)); $contactWebForms[0]->delete(); $contactWebForms = ContactWebForm::getAll(); $this->assertEquals(0, count($contactWebForms)); }