Permalink
Browse files

recreating TextHelperTest

  • Loading branch information...
1 parent 8074959 commit fbd3f87be69ebc3f7afb7f74c21e8cd7a7abdea4 @rchavik rchavik committed Feb 6, 2012
Showing with 25 additions and 0 deletions.
  1. +25 −0 lib/Cake/Test/Case/View/Helper/TextHelperTest.php
View
25 lib/Cake/Test/Case/View/Helper/TextHelperTest.php
@@ -20,6 +20,14 @@
App::uses('View', 'View');
App::uses('TextHelper', 'View/Helper');
+class TextHelperTestObject extends TextHelper {
+
+ public function attach(String $string) {
+ $this->_String = $string;
+ }
+
+}
+
/**
* TextHelperTest class
*
@@ -48,6 +56,23 @@ public function tearDown() {
}
/**
+ * test String class methods are called correctly
+ */
+ public function testTextHelperProxyMethodCalls() {
+ $this->String = $this->getMock('String');
+ unset($this->Text);
+ $this->Text = new TextHelperTestObject($this->View);
+ $this->Text->attach($this->String);
+ $methods = array(
+ 'highlight', 'stripLinks', 'truncate', 'excerpt', 'toList',
+ );
+ foreach ($methods as $method) {
+ $this->String->expects($this->at(0))->method($method);
+ $this->Text->{$method}('who', 'what', 'when', 'where', 'how');
+ }
+ }
+
+/**
* testAutoLink method
*
* @return void

0 comments on commit fbd3f87

Please sign in to comment.