2009-06-27 06:00:10 +02:00
|
|
|
<?php
|
|
|
|
/**
|
2012-04-12 08:02:46 +02:00
|
|
|
* @package framework
|
2009-06-27 06:00:10 +02:00
|
|
|
* @subpackage tests
|
|
|
|
*/
|
|
|
|
class ConfirmedPasswordFieldTest extends SapphireTest {
|
|
|
|
function testSetValue() {
|
|
|
|
$field = new ConfirmedPasswordField('Test', 'Testing', 'valueA');
|
|
|
|
$this->assertEquals('valueA', $field->Value());
|
2011-10-29 06:01:52 +02:00
|
|
|
$this->assertEquals('valueA', $field->children->fieldByName($field->getName() . '[_Password]')->Value());
|
|
|
|
$this->assertEquals('valueA', $field->children->fieldByName($field->getName() . '[_ConfirmPassword]')->Value());
|
2009-06-27 06:00:10 +02:00
|
|
|
$field->setValue('valueB');
|
|
|
|
$this->assertEquals('valueB', $field->Value());
|
2011-10-29 06:01:52 +02:00
|
|
|
$this->assertEquals('valueB', $field->children->fieldByName($field->getName() . '[_Password]')->Value());
|
|
|
|
$this->assertEquals('valueB', $field->children->fieldByName($field->getName() . '[_ConfirmPassword]')->Value());
|
2009-06-27 06:00:10 +02:00
|
|
|
}
|
2011-02-25 05:01:46 +01:00
|
|
|
|
|
|
|
function testSetShowOnClick() {
|
|
|
|
//hide by default and display show/hide toggle button
|
|
|
|
$field = new ConfirmedPasswordField('Test', 'Testing', 'valueA', null, true);
|
|
|
|
$fieldHTML = $field->Field();
|
|
|
|
$this->assertContains("showOnClickContainer",$fieldHTML,"Test class for hiding/showing the form contents is set");
|
|
|
|
$this->assertContains("showOnClick",$fieldHTML,"Test class for hiding/showing the form contents is set");
|
|
|
|
|
|
|
|
//show all by default
|
|
|
|
$field = new ConfirmedPasswordField('Test', 'Testing', 'valueA', null, false);
|
|
|
|
$fieldHTML = $field->Field();
|
|
|
|
$this->assertNotContains("showOnClickContainer",$fieldHTML,"Test class for hiding/showing the form contents is set");
|
|
|
|
$this->assertNotContains("showOnClick",$fieldHTML,"Test class for hiding/showing the form contents is set");
|
|
|
|
}
|
2009-06-27 06:00:10 +02:00
|
|
|
}
|