Ejemplo n.º 1
0
 public function actionDeleteuser($id)
 {
     //if(!Yii::$app->user->isGuest && Yii::$app->user->identity->role == 'admin'){
     User::findOne($id)->delete();
     //}
     //return $this->goBack();
 }
Ejemplo n.º 2
0
 public function testDeleteUser()
 {
     $count1 = User::find()->count();
     $user = new User();
     $user->username = "******";
     $user->password = "******";
     $user->fio = "fio";
     $user->pol = "male";
     $user->email = "*****@*****.**";
     $user->save();
     $controller = new SiteController();
     $controller->actionDeleteuser($user->id);
     $count2 = User::find()->count();
     //$this->assert($count1, $count2, 'count before inserting and after deleting are not equals');
     if ($count1 != $count2) {
         $this->fire('UserDeletingError', new TestEvent($this));
     }
 }
Ejemplo n.º 3
0
 function loginAgent()
 {
     //          if ($this->getScenario()->current('env') != 'firefox') {
     if ($this->loadSessionSnapshot('agent_login')) {
         return;
     }
     //        }
     $this->amOnPage(Login::$URL);
     $this->waitForElement(Login::$email);
     $this->fillField(Login::$email, User::getCurrentAgentEmail());
     $this->fillField(Login::$pass, User::$agentPass);
     $this->click(Login::$submitLoginBtn);
     $this->wait(3);
     //$this->seeElement("//img[@alt='$this->agencyChiefFName $this->agencyChiefLName']");
     $this->saveSessionSnapshot('agent_login');
 }
Ejemplo n.º 4
0
 public function checkAgencyRegistration()
 {
     $I = $this;
     $I->wantTo('check registration of agency');
     $I->amOnPage(AdminUsersList::$users_list_url);
     $I->wait(2);
     $I->waitForElement(AdminUsersList::$searchByName);
     $I->fillField(AdminUsersList::$searchByName, User::getCurrentAgencyEmail());
     $I->click(AdminUsersList::$filterUsersBtn);
     $I->wait(2);
     $I->see(User::getCurrentAgencyEmail(), AdminUsersList::$agencyEmail);
     $I->wait(2);
     $I->click(AdminUsersList::$changeUserStatusBtn);
     $I->wait(2);
     $I->click(AdminUsersList::$statusesSelectClick);
     $I->wait(1);
     $I->fillField(AdminUsersList::$statusesSelect, AdminUsersList::$activeStateWord);
     $I->pressKey(AdminUsersList::$statusesSelect, WebDriverKeys::ENTER);
     $I->click(AdminUsersList::$submitStatusChangeBtn);
 }
Ejemplo n.º 5
0
 function apiAgencyRegistration()
 {
     $agencyOfficeRegion0 = $this->getRegion(21);
     $agencyOfficeCity0 = $this->getCity(4);
     $agencyOfficeAddress0 = $this->getStreetNameById(1);
     $agencyOfficeRegion1 = $this->getRegion(21);
     $agencyOfficeCity1 = $this->getCity(4);
     $agencyOfficeAddress1 = $this->getStreetNameById(1);
     $this->restModule->haveHttpHeader('Content-Type', 'application/json');
     $this->restModule->sendPOST('/registration/agency', ['name' => User::$agencyName, 'subdomain' => User::uniqueSubdomain(), 'firstName' => User::$agencyfirstName, 'lastName' => User::$agencylastName, 'email' => User::uniqueApiAgencyEmail(), 'plainPassword' => User::$agencyRegPass, 'description' => User::$agencyDescription, 'logo' => User::getAgencyLogo(), 'userAvatar' => User::getAgencyAvatar(), 'offices' => [array('officeName' => User::$agencyOfficeName0, 'region' => $agencyOfficeRegion0, 'city' => $agencyOfficeCity0, 'address' => $agencyOfficeAddress0, 'officeNumbers' => User::$agencyOfficeNumbers0, 'phones' => [array('phone' => User::$agencyOfficePhoneNumber0_0), array('phone' => User::$agencyOfficePhoneNumber0_1)]), array('officeName' => User::$agencyOfficeName1, 'region' => $agencyOfficeRegion1, 'city' => $agencyOfficeCity1, 'address' => $agencyOfficeAddress1, 'officeNumbers' => User::$agencyOfficeNumbers1)], 'socialAccounts' => [array('facebook' => User::$agencySocialFb, 'vk' => User::$agencySocialVk)], 'schedule' => [array('dayOfWeek' => '1-5', 'startTime' => '09:00', 'endTime' => '18:00'), array('dayOfWeek' => '6', 'startTime' => '10:00', 'endTime' => '13:00')]]);
     $this->restModule->seeResponseCodeIs(201);
     $this->restModule->seeResponseIsJson();
     $agency_data = $this->restModule->grabResponse();
     file_put_contents(codecept_data_dir('agency_data.json'), $agency_data);
 }
Ejemplo n.º 6
0
 function checkAgencyEditProfile()
 {
     $agencyFirstName = User::$agencyfirstNameEdit;
     $agencyLastName = User::$agencylastNameEdit;
     $this->wantTo('check edited agency profile');
     $this->reloadPage();
     $this->wait(3);
     $this->waitForElement(EditProfiles::$agencyName);
     $this->seeInField(EditProfiles::$agencyName, User::$agencyNameEdit);
     $this->seeInField(EditProfiles::$agencySubdomain, User::getCurrentSubdomain());
     $this->seeInField(EditProfiles::$firstName, User::$agencyfirstNameEdit);
     $this->seeInField(EditProfiles::$lastName, User::$agencylastNameEdit);
     $this->seeElement("//img[@alt='{$agencyFirstName} {$agencyLastName}']");
     $this->seeInField(EditProfiles::$email, User::getCurrentAgencyEmail());
     $about_text = $this->grabValueFrom(EditProfiles::$agencyAbout);
     $this->seeInDescriptionField($about_text);
     $this->seeInField(EditProfiles::$agencyOfficeName0, User::$agencyOfficeName0Edit);
     $this->seeInField(EditProfiles::$agencyAddressName0, User::$agencyAddressName0Edit);
     $this->seeInField(EditProfiles::$agencyCabinet0, User::$agencyCabinet0Edit);
     $this->seeInField(EditProfiles::$agencyPhoneNumber1, User::$agencyOfficePhoneNumberEdit0_0);
     $this->seeInField(EditProfiles::$agencySocialVk, User::$agencySocialEmpty);
     $this->seeInField(EditProfiles::$agencySocialTw, User::$agencySocialTw);
 }