Browse Source

Anomalie #772: Url non géré

Sevajol Bastien 11 years ago
parent
commit
0f3987c24b

+ 4 - 2
src/Muzich/CoreBundle/Factory/UrlMatchs.php View File

95
   
95
   
96
   public static $youtube = array(
96
   public static $youtube = array(
97
     Element::TYPE_OTHER => array(
97
     Element::TYPE_OTHER => array(
98
-      // https://www.youtube.com/watch?v=2-5xt9MrI9w
99
       // https://www.youtube.com/watch?feature=player_detailpage&v=M9PkADawUKU#t=73s
98
       // https://www.youtube.com/watch?feature=player_detailpage&v=M9PkADawUKU#t=73s
100
       "#\/(watch|)(\?|)feature\=player_detailpage\&v=([a-zA-Z0-9_-]+)([.\w\W\d]*)#" => 3,
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 View File

88
     $this->assertTrue($url_analyzer->haveMatch());
88
     $this->assertTrue($url_analyzer->haveMatch());
89
     $this->assertEquals(Element::TYPE_OTHER, $url_analyzer->getType());
89
     $this->assertEquals(Element::TYPE_OTHER, $url_analyzer->getType());
90
     $this->assertEquals('M9PkADawUKU', $url_analyzer->getRefId());
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
 }