Browse Source

Added comma to regex when mode is URL

Sandra Vigo 7 years ago
parent
commit
741081e6bf

+ 1 - 1
src/Model/Behavior/SluggedBehavior.php

@@ -442,7 +442,7 @@ class SluggedBehavior extends Behavior {
 		if ($mode === 'display') {
 			return $return;
 		}
-		$return .= preg_quote(' \'"/?<>.$/:;?@=+&%\#', '@');
+		$return .= preg_quote(' \'"/?<>.$/:;?@=+&%\#,', '@');
 		if ($mode === 'url') {
 			return $return;
 		}

+ 2 - 2
tests/TestCase/Model/Behavior/SluggedBehaviorTest.php

@@ -490,8 +490,8 @@ class SluggedBehaviorTest extends TestCase {
 		$result = $this->articles->generateSlug($string);
 		$this->assertEquals($expected, $result);
 
-		$string = 'something with a # in it';
-		$expected = 'something-with-a-in-isaaddat';
+		$string = 'something with a , in it';
+		$expected = 'something-with-a-in-it';
 		$result = $this->articles->generateSlug($string);
 		$this->assertEquals($expected, $result);
 	}