2009-06-17 13:36:49 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
class TextareaFieldTest extends SapphireTest {
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Quick smoke test to ensure that text is being encoded properly.
|
|
|
|
*/
|
2012-09-19 12:07:39 +02:00
|
|
|
public function testTextEncoding() {
|
2012-05-03 04:05:38 +02:00
|
|
|
$inputText = "These are some unicodes: äöü";
|
2012-01-10 04:58:27 +01:00
|
|
|
$field = new TextareaField("Test", "Test");
|
2009-06-17 13:36:49 +02:00
|
|
|
$field->setValue($inputText);
|
2012-05-03 04:05:38 +02:00
|
|
|
$this->assertContains('These are some unicodes: äöü', $field->Field());
|
2009-06-17 13:36:49 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2012-05-03 04:05:38 +02:00
|
|
|
* Quick smoke test to ensure that text with unicodes is being displayed properly in readonly fields.
|
2009-06-17 13:36:49 +02:00
|
|
|
*/
|
2012-09-19 12:07:39 +02:00
|
|
|
public function testReadonlyDisplayUnicodes() {
|
2012-05-03 04:05:38 +02:00
|
|
|
$inputText = "These are some unicodes: äöü";
|
|
|
|
$field = new TextareaField("Test", "Test");
|
|
|
|
$field->setValue($inputText);
|
|
|
|
$field = $field->performReadonlyTransformation();
|
|
|
|
$this->assertContains('These are some unicodes: äöü', $field->Field());
|
|
|
|
}
|
2014-08-15 08:53:05 +02:00
|
|
|
|
2012-05-03 04:05:38 +02:00
|
|
|
/**
|
|
|
|
* Quick smoke test to ensure that text with special html chars is being displayed properly in readonly fields.
|
|
|
|
*/
|
2012-09-19 12:07:39 +02:00
|
|
|
public function testReadonlyDisplaySepcialHTML() {
|
2012-05-03 04:05:38 +02:00
|
|
|
$inputText = "These are some special <html> chars including 'single' & \"double\" quotations";
|
2012-01-10 04:58:27 +01:00
|
|
|
$field = new TextareaField("Test", "Test");
|
2009-06-17 13:36:49 +02:00
|
|
|
$field = $field->performReadonlyTransformation();
|
|
|
|
$field->setValue($inputText);
|
2012-09-26 23:34:00 +02:00
|
|
|
$this->assertContains('These are some special <html> chars including 'single' &'
|
|
|
|
. ' "double" quotations', $field->Field());
|
2009-06-17 13:36:49 +02:00
|
|
|
}
|
2014-08-15 08:53:05 +02:00
|
|
|
|
2012-03-24 04:04:52 +01:00
|
|
|
}
|