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