|
| 1 | +<?php |
| 2 | + |
| 3 | +namespace JamesHeinrich\GetID3\Tests; |
| 4 | + |
| 5 | +use ExternalUrlTest; |
| 6 | +use JamesHeinrich\GetID3\Exception; |
| 7 | +use JamesHeinrich\GetID3\GetID3; |
| 8 | +use PHPUnit\Framework\TestCase; |
| 9 | + |
| 10 | +class UrlsTest extends TestCase |
| 11 | +{ |
| 12 | + |
| 13 | + public function testHttps() |
| 14 | + { |
| 15 | + try{ |
| 16 | + $getID3 = new GetID3(); |
| 17 | + $info = $getID3->analyze("https://example.com/test.mp3"); |
| 18 | + $this->assertArrayHasKey('error', $info); |
| 19 | + $this->assertContains('Remote files are not supported - please copy the file locally first', $info['error']); |
| 20 | + }catch (Exception $e){ |
| 21 | + $this->assertFalse(true, "Exception: ".$e->getMessage()); |
| 22 | + } |
| 23 | + } |
| 24 | + |
| 25 | + public function testHttp() |
| 26 | + { |
| 27 | + try{ |
| 28 | + $getID3 = new GetID3(); |
| 29 | + $info = $getID3->analyze("http://example.com/test.mp3"); |
| 30 | + $this->assertArrayHasKey('error', $info); |
| 31 | + $this->assertContains('Remote files are not supported - please copy the file locally first', $info['error']); |
| 32 | + }catch (Exception $e){ |
| 33 | + $this->assertFalse(true, "Exception: ".$e->getMessage()); |
| 34 | + } |
| 35 | + } |
| 36 | + |
| 37 | + public function testFtp() |
| 38 | + { |
| 39 | + try{ |
| 40 | + $getID3 = new GetID3(); |
| 41 | + $info = $getID3->analyze("ftp://example.com/test.mp3"); |
| 42 | + $this->assertArrayHasKey('error', $info); |
| 43 | + $this->assertContains('Remote files are not supported - please copy the file locally first', $info['error']); |
| 44 | + }catch (Exception $e){ |
| 45 | + $this->assertFalse(true, "Exception: ".$e->getMessage()); |
| 46 | + } |
| 47 | + } |
| 48 | + |
| 49 | + public function testFtps() |
| 50 | + { |
| 51 | + try{ |
| 52 | + $getID3 = new GetID3(); |
| 53 | + $info = $getID3->analyze("ftps://example.com/test.mp3"); |
| 54 | + $this->assertArrayHasKey('error', $info); |
| 55 | + $this->assertContains('Remote files are not supported - please copy the file locally first', $info['error']); |
| 56 | + }catch (Exception $e){ |
| 57 | + $this->assertFalse(true, "Exception: ".$e->getMessage()); |
| 58 | + } |
| 59 | + } |
| 60 | + |
| 61 | +} |
0 commit comments