Kaynağa Gözat

Anomalie #772: Url non géré

Sevajol Bastien 11 yıl önce
ebeveyn
işleme
0f3987c24b

+ 4 - 2
src/Muzich/CoreBundle/Factory/UrlMatchs.php Dosyayı Görüntüle

@@ -95,10 +95,12 @@ class UrlMatchs
95 95
   
96 96
   public static $youtube = array(
97 97
     Element::TYPE_OTHER => array(
98
-      // https://www.youtube.com/watch?v=2-5xt9MrI9w
99 98
       // https://www.youtube.com/watch?feature=player_detailpage&v=M9PkADawUKU#t=73s
100 99
       "#\/(watch|)(\?|)feature\=player_detailpage\&v=([a-zA-Z0-9_-]+)([.\w\W\d]*)#" => 3,
101
-      "#\/(watch|)(\?|)v=([a-zA-Z0-9_-]+)#" => 3
100
+      // https://www.youtube.com/watch?v=2-5xt9MrI9w
101
+      "#\/(watch|)(\?|)v=([a-zA-Z0-9_-]+)#" => 3,
102
+      // http://m.youtube.com/watch?feature=youtu.be&v=QQ3L3mqP5JY&desktop_uri=%2Fwatch%3Fv%3DQQ3L3mqP5JY%26feature%3Dyoutu.be
103
+      "#\/(watch|)(\?|)feature\=youtu.be\&v=([a-zA-Z0-9_-]+)([.\w\W\d]*)#" => 3
102 104
     )
103 105
   );
104 106
 }

+ 10 - 0
src/Muzich/CoreBundle/Tests/ElementFactory/UrlAnalyzerTest.php Dosyayı Görüntüle

@@ -88,6 +88,16 @@ class UrlAnalyzerTest extends \PHPUnit_Framework_TestCase
88 88
     $this->assertTrue($url_analyzer->haveMatch());
89 89
     $this->assertEquals(Element::TYPE_OTHER, $url_analyzer->getType());
90 90
     $this->assertEquals('M9PkADawUKU', $url_analyzer->getRefId());
91
+    
92
+    $url_analyzer = new UrlAnalyzer($this->getNewElement('youtube.com', 'http://m.youtube.com/watch?feature=youtu.be&v=QQ3L3mqP5JY&desktop_uri=%2Fwatch%3Fv%3DQQ3L3mqP5JY%26feature%3Dyoutu.be'), UrlMatchs::$youtube);
93
+    $this->assertTrue($url_analyzer->haveMatch());
94
+    $this->assertEquals(Element::TYPE_OTHER, $url_analyzer->getType());
95
+    $this->assertEquals('QQ3L3mqP5JY', $url_analyzer->getRefId());
96
+    
97
+    $url_analyzer = new UrlAnalyzer($this->getNewElement('youtube.com', 'http://m.youtube.com/watch?feature=youtu.be&v=QQ3L3mqP5JY'), UrlMatchs::$youtube);
98
+    $this->assertTrue($url_analyzer->haveMatch());
99
+    $this->assertEquals(Element::TYPE_OTHER, $url_analyzer->getType());
100
+    $this->assertEquals('QQ3L3mqP5JY', $url_analyzer->getRefId());
91 101
   }
92 102
   
93 103
 }