Blame view

framework/tests/forms/TextareaFieldTest.php 1.35 KB
0084d336   Administrator   Importers CRUD
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
  <?php
  
  class TextareaFieldTest extends SapphireTest {
  
  	/**
  	 * Quick smoke test to ensure that text is being encoded properly.
  	 */
  	public function testTextEncoding() {
  		$inputText = "These are some unicodes: äöü";
  		$field = new TextareaField("Test", "Test");
  		$field->setValue($inputText);
  		$this->assertContains('These are some unicodes: &auml;&ouml;&uuml;', $field->Field());
  	}
  
  	/**
  	 * Quick smoke test to ensure that text with unicodes is being displayed properly in readonly fields.
  	 */
  	public function testReadonlyDisplayUnicodes() {
  		$inputText = "These are some unicodes: äöü";
  		$field = new TextareaField("Test", "Test");
  		$field->setValue($inputText);
  		$field = $field->performReadonlyTransformation();
  		$this->assertContains('These are some unicodes: äöü', $field->Field());
  	}
  	
  	/**
  	 * Quick smoke test to ensure that text with special html chars is being displayed properly in readonly fields.
  	 */
  	public function testReadonlyDisplaySepcialHTML() {
  		$inputText = "These are some special <html> chars including 'single' & \"double\" quotations";
  		$field = new TextareaField("Test", "Test");
  		$field = $field->performReadonlyTransformation();
  		$field->setValue($inputText);
  		$this->assertContains('These are some special &lt;html&gt; chars including &#039;single&#039; &amp;'
  			. ' &quot;double&quot; quotations', $field->Field());
  	}
  	
  }