mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
6f9177ef43
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@97057 467b73ca-7a2a-4603-9d3b-597d59a354a9
25 lines
552 B
PHP
25 lines
552 B
PHP
<?php
|
|
|
|
class CurrencyFieldTest extends SapphireTest {
|
|
function testValidation() {
|
|
$field = new CurrencyField('cf');
|
|
$vr = new RequiredFields();
|
|
|
|
$field->setValue('$10.23');
|
|
$this->assertTrue($field->validate($vr));
|
|
|
|
$field->setValue('$1a0.23');
|
|
$this->assertFalse($field->validate($vr));
|
|
}
|
|
|
|
function testDataValues() {
|
|
$field = new CurrencyField('cf');
|
|
|
|
$field->setValue('$10.34');
|
|
$this->assertEquals($field->dataValue(), '10.34');
|
|
|
|
$field->setValue('$1s0.34');
|
|
$this->assertEquals($field->dataValue(), '0.00');
|
|
}
|
|
}
|
|
?>
|