浏览代码

more tests

euromark 13 年之前
父节点
当前提交
1630ca2d85
共有 3 个文件被更改,包括 29 次插入18 次删除
  1. 11 11
      Test/Case/View/Helper/TypographyHelperTest.php
  2. 17 6
      View/Helper/QrCodeHelper.php
  3. 1 1
      View/Helper/TextExtHelper.php

+ 11 - 11
Test/Case/View/Helper/TypographyHelperTest.php

@@ -41,22 +41,22 @@ class TypographyHelperTest extends MyCakeTestCase {
  */
 	public function testFormatCharacter() {
 		$strs = array(
-			'"double quotes"' 				=> '“double quotes”',
+			'"double quotes"' => '“double quotes”',
 			'"testing" in "theory" that is' => '“testing” in “theory” that is',
-			"Here's what I'm" 				=> 'Here’s what I’m',
-			'&' 							=> '&',
-			'&' 						=> '&',
-			' '						=> ' ',
-			'--'							=> '—',
-			'foo...'						=> 'foo…',
-			'foo..'							=> 'foo..',
-			'foo...bar.'					=> 'foo…bar.',
-			'test. new'					=> 'test.  new',
+			"Here's what I'm" => 'Here’s what I’m',
+			'&' => '&',
+			'&' => '&',
+			' ' => ' ',
+			'--' => '—',
+			'foo...' => 'foo…',
+			'foo..' => 'foo..',
+			'foo...bar.' => 'foo…bar.',
+			'test.  new' => 'test.  new',
 		);
 
 		foreach ($strs as $str => $expected) {
 			$result = $this->Typography->formatCharacters($str);
-			echo pre($result);
+			debug($result);
 			$this->assertEquals($expected, $result);
 		}
 

+ 17 - 6
View/Helper/QrCodeHelper.php

@@ -82,18 +82,29 @@ class QrCodeHelper extends AppHelper {
 	}
 
 	/**
-	 * just the url - without image tag
+	 * Just the url - without image tag
+	 * Note: cannot be url() due to AppHelper conflicts
+	 *
+	 * @param string $text
+	 * @return string $url
 	 * 2010-02-25 ms
 	 */
-	public function url($text) {
+	public function uri($text) {
 		$params = array();
-
-		$params['chl'] = rawurlencode($text); //urlencode($text);
-		return $this->_url($params);
+		$params['chl'] = rawurlencode($text);
+		return $this->_uri($params);
 	}
 
+	/**
+	 * @deprecated
+	 * old method - use uri() instead
+	 */
+	public function url($url = null, $full = false) {
+		//trigger_error('use uri() instead', E_DEPRECATED);
+		return $this->uri($url);
+	}
 
- 	protected function _url($params = array()) {
+ 	protected function _uri($params = array()) {
 		$params = array_merge($this->options, $params);
 		$pieces = array();
 		foreach ($params as $key => $value) {

+ 1 - 1
View/Helper/TextExtHelper.php

@@ -83,7 +83,7 @@ class TextExtHelper extends TextHelper {
 	 * @static
 	 * 2010-11-20 ms
 	 */
-	public function prepareEmail($email, $options = array(), $customOptions = array()) {
+	public static function prepareEmail($email, $options = array(), $customOptions = array()) {
 		$obfuscate = false;
 		if (isset($options['obfuscate'])) {
 			$obfuscate = $options['obfuscate'];