Skip to content
This repository
Browse code

adding sms as protocol

  • Loading branch information...
commit b6fe8af70194e93be61493f435b9d880e369d0c0 1 parent 2a674fc
Mark authored August 01, 2012
3  lib/Cake/Routing/Router.php
@@ -833,7 +833,8 @@ public static function url($url = null, $full = false) {
833 833
 				(strpos($url, '://') !== false ||
834 834
 				(strpos($url, 'javascript:') === 0) ||
835 835
 				(strpos($url, 'mailto:') === 0) ||
836  
-				(strpos($url, 'tel:') === 0)) ||
  836
+				(strpos($url, 'tel:') === 0) ||
  837
+				(strpos($url, 'sms:') === 0)) ||
837 838
 				(!strncmp($url, '#', 1))
838 839
 			) {
839 840
 				return $url;
6  lib/Cake/Test/Case/Routing/RouterTest.php
@@ -2485,8 +2485,14 @@ public function testUrlProtocol() {
2485 2485
 		$url = '://example.com';
2486 2486
 		$this->assertEquals($url, Router::url($url));
2487 2487
 
  2488
+		$url = 'javascript:void(0)';
  2489
+		$this->assertEquals($url, Router::url($url));
  2490
+
2488 2491
 		$url = 'tel:012345-678';
2489 2492
 		$this->assertEquals($url, Router::url($url));
  2493
+
  2494
+		$url = 'sms:012345-678';
  2495
+		$this->assertEquals($url, Router::url($url));
2490 2496
 	}
2491 2497
 
2492 2498
 /**
8  lib/Cake/Test/Case/View/Helper/HtmlHelperTest.php
@@ -349,6 +349,14 @@ public function testLink() {
349 349
 		$result = $this->Html->link('call me on 0123465-798', 'tel:0123465-798');
350 350
 		$expected = array('a' => array('href' => 'tel:0123465-798'), 'call me on 0123465-798', '/a');
351 351
 		$this->assertTags($result, $expected);
  352
+
  353
+		$result = $this->Html->link('text me on 0123465-798', 'sms:0123465-798');
  354
+		$expected = array('a' => array('href' => 'sms:0123465-798'), 'text me on 0123465-798', '/a');
  355
+		$this->assertTags($result, $expected);
  356
+
  357
+		$result = $this->Html->link('say hello to 0123465-798', 'sms:0123465-798?body=hello there');
  358
+		$expected = array('a' => array('href' => 'sms:0123465-798?body=hello there'), 'say hello to 0123465-798', '/a');
  359
+		$this->assertTags($result, $expected);
352 360
 	}
353 361
 
354 362
 /**

0 notes on commit b6fe8af

Please sign in to comment.
Something went wrong with that request. Please try again.