-
Notifications
You must be signed in to change notification settings - Fork 1
/
user_registration.php
66 lines (55 loc) · 1.81 KB
/
user_registration.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
<?php
require_once dirname( __FILE__ ).'/../autoload.php';
require_once 'definitions/user_registration.php';
class ymcHtmlFormUserRegistrationTest extends PHPUnit_Framework_Testcase
{
protected $group;
protected $form;
protected $input;
public function setUp()
{
$this->group = new ymcHtmlFormTestGroupUserRegistration;
$this->form = new ymcHtmlFormGeneric( $this->group );
$this->input = new ymcHtmlFormInputSourceDummy;
}
public function testInstantiateGroup()
{
$this->assertThat( $this->group, $this->isInstanceOf( 'ymcHtmlFormElementsGroup' ) );
}
public function testEmptyInputIsInvalid()
{
$this->form->init();
$this->form->validate( $this->input );
$this->assertFalse( $this->form->isValid() );
}
public function testGoodInputIsValid()
{
$input = $this->input;
$input->nickname = 'thkoch';
$input->password = 'wontsay';
$input->password_repeat = 'wontsay';
$input->email = 'thomas@koch.ro';
$this->form->init();
$this->form->validate( $this->input );
$this->assertTrue( $this->form->isValid() );
}
public function testNoCredentialsIsInvalid()
{
$input = $this->input;
$input->nickname = 'thkoch';
$input->email = 'thomas@koch.ro';
$this->form->init();
$this->form->validate( $this->input );
$this->assertFalse( $this->form->isValid() );
}
public function testCredentialOpenidIsValid()
{
$input = $this->input;
$input->nickname = 'thkoch';
$input->email = 'thomas@koch.ro';
$input->openid_url = 'http://thomas.koch.ro';
$this->form->init();
$this->form->validate( $this->input );
$this->assertTrue( $this->form->isValid() );
}
}