Gentics Portal.Node PHP API
 All Classes Namespaces Functions Variables Pages
UserWidgetTest.php
1 <?php
2 /**
3  * Gentics Portal.Node PHP
4  * Author & Copyright (c) by Gentics Software GmbH
5  * sales@gentics.com
6  * http://www.gentics.com
7  * Licenses can be found in the LICENSE.txt file in the root-folder of this installation
8  * You must not use this software without a valid license agreement.
9  *
10  */
12 {
13  public function setUp()
14  {
15  parent::setUp();
16  }
17 
18  public function testLoginEmailAndStatus()
19  {
20  $this->open('widgetsTests/userLogin');
21  $this->assertTextPresent('Remember me next time');
22  $this->assertTextPresent('Google open Id');
23 
24  $this->type('name=UserLogin[authField]', 'webmaster@example.com');
25  $this->type('name=UserLogin[password]', 'admin');
26  $this->clickAndWait("//input[@value='Login']");
27  $this->assertTextPresent('User id: 1');
28 
29  $this->open('widgetsTests/userStatus');
30  $this->assertTextPresent('User: ');
31 
32  }
33 
34  public function testLogout()
35  {
36  $this->open('widgetsTests/userLogin');
37  $this->type('name=UserLogin[authField]', 'webmaster@example.com');
38  $this->type('name=UserLogin[password]', 'admin');
39  $this->clickAndWait("//input[@value='Login']");
40 
41  $this->open('widgetsTests/userLogout');
42  $this->assertElementPresent('xpath=//a[text()="Logout"]');
43  $this->clickAndWait('link=Logout');
44  $this->assertElementNotPresent('xpath=//a[text()="Logout"]');
45  }
46 
47  public function testRegistration()
48  {
49  $this->open('widgetsTests/userRegistration');
50 
51  $this->assertTextPresent('E-mail *');
52  $this->assertTextPresent('Verification Code *');
53 
54  $username = $password = 'test_' . uniqid();
55  $email = "$username@gmail.com";
56 
57  $this->type('name=RegistrationForm[username]', $username);
58  $this->type('name=RegistrationForm[email]', $email);
59  $this->type('name=RegistrationForm[password]', $password);
60  $this->type('name=RegistrationForm[verifyPassword]', $password);
61  $this->type('name=Profile[lastname]', $username);
62  $this->type('name=Profile[firstname]', $username);
63  $this->type('name=RegistrationForm[verifyCode]', Yii::app()->params['captcha']);
64 
65  $this->clickAndWait("//input[@value='Register']");
66  $this->assertTextPresent('Thank you for your registration');
67  }
68 
69  public function testRecovery()
70  {
71  $this->open('widgetsTests/userRecovery');
72  $this->type('UserRecoveryForm[login_or_email]', 'webmaster@example.com');
73  $this->clickAndWait("//input[@value='Restore']");
74  $this->assertTextPresent('Please check your email.');
75 
76  $this->open('widgetsTests/userRecovery');
77  $this->type('UserRecoveryForm[login_or_email]', '.com');
78  $this->clickAndWait("//input[@value='Restore']");
79  $this->assertTextPresent('Please fix the following input errors');
80  }
81 
82 
83 }