|
|
@@ -334,4 +334,58 @@ class TextHelperTest extends CakeTestCase {
|
|
|
$this->assertEquals($expected, $result);
|
|
|
}
|
|
|
|
|
|
+/**
|
|
|
+ * testAutoParagraph method
|
|
|
+ *
|
|
|
+ * @return void
|
|
|
+ */
|
|
|
+ public function testAutoParagraph() {
|
|
|
+ $text = 'This is a test text';
|
|
|
+ $expected = <<<TEXT
|
|
|
+<p>This is a test text</p>
|
|
|
+
|
|
|
+TEXT;
|
|
|
+ $result = $this->Text->autoParagraph($text);
|
|
|
+ $text = 'This is a <br/> <BR> test text';
|
|
|
+ $expected = <<<TEXT
|
|
|
+<p>This is a </p>
|
|
|
+<p> test text</p>
|
|
|
+
|
|
|
+TEXT;
|
|
|
+ $result = $this->Text->autoParagraph($text);
|
|
|
+ $this->assertEquals($expected, $result);
|
|
|
+ $result = $this->Text->autoParagraph($text);
|
|
|
+ $text = 'This is a <BR id="test"/><br class="test"> test text';
|
|
|
+ $expected = <<<TEXT
|
|
|
+<p>This is a </p>
|
|
|
+<p> test text</p>
|
|
|
+
|
|
|
+TEXT;
|
|
|
+ $result = $this->Text->autoParagraph($text);
|
|
|
+ $this->assertEquals($expected, $result);
|
|
|
+ $text = <<<TEXT
|
|
|
+This is a test text.
|
|
|
+This is a line return.
|
|
|
+TEXT;
|
|
|
+ $expected = <<<TEXT
|
|
|
+<p>This is a test text.<br />
|
|
|
+This is a line return.</p>
|
|
|
+
|
|
|
+TEXT;
|
|
|
+ $result = $this->Text->autoParagraph($text);
|
|
|
+ $this->assertEquals($expected, $result);
|
|
|
+ $text = <<<TEXT
|
|
|
+This is a test text.
|
|
|
+
|
|
|
+This is a new line.
|
|
|
+TEXT;
|
|
|
+ $expected = <<<TEXT
|
|
|
+<p>This is a test text.</p>
|
|
|
+<p>This is a new line.</p>
|
|
|
+
|
|
|
+TEXT;
|
|
|
+ $result = $this->Text->autoParagraph($text);
|
|
|
+ $this->assertEquals($expected, $result);
|
|
|
+ }
|
|
|
+
|
|
|
}
|