@@ -9,6 +9,8 @@ class FFProbeProviderTest extends TestCase
99{
1010
1111 protected static $ moviePath ;
12+
13+ protected static $ movieUrl ;
1214 /**
1315 * @var FFProbeProvider
1416 */
@@ -18,6 +20,12 @@ public static function setUpBeforeClass(): void
1820 {
1921 $ path = dirname (__FILE__ ).DIRECTORY_SEPARATOR .'.. ' .DIRECTORY_SEPARATOR .'data ' .DIRECTORY_SEPARATOR ;
2022 self ::$ moviePath = realpath ($ path .'test.mp4 ' );
23+ self ::$ movieUrl = array (
24+ 'base ' => 'https://github.com/char0n/ffmpeg-php/blob/master/tests/data/ ' ,
25+ 'fileName ' => 'test ' ,
26+ 'fileExtension ' => '.mp4 ' ,
27+ 'query ' => '?raw=true '
28+ );
2129 }
2230
2331 public static function tearDownAfterClass (): void
@@ -42,7 +50,7 @@ public function testGetOutput()
4250 $ this ->assertEquals (1 , preg_match ('/FFprobe version/i ' , $ output ));
4351 }
4452
45- public function testGetOutputFileDoesntExist ()
53+ public function testGetOutputFileDoesNotExist ()
4654 {
4755 $ this ->expectException (\UnexpectedValueException::class);
4856 $ this ->expectExceptionCode (334561 );
@@ -52,6 +60,32 @@ public function testGetOutputFileDoesntExist()
5260 $ provider ->getOutput ();
5361 }
5462
63+ public function testGetOutputUrl ()
64+ {
65+ $ provider = new FFProbeProvider ();
66+ $ provider ->setMovieFile (implode (self ::$ movieUrl ));
67+ $ output = $ provider ->getOutput ();
68+
69+ $ this ->assertEquals (1 , preg_match ('/FFprobe version/i ' , $ output ));
70+ }
71+
72+ public function testGetOutputUrlFileDoesNotExist ()
73+ {
74+ $ this ->expectException (\UnexpectedValueException::class);
75+ $ this ->expectExceptionCode (334561 );
76+
77+ $ provider = new FFProbeProvider ();
78+ $ nonExistingUrlFile = sprintf (
79+ '%s%s%s%s ' ,
80+ self ::$ movieUrl ['base ' ],
81+ uniqid ('test ' , true ),
82+ self ::$ movieUrl ['fileExtension ' ],
83+ self ::$ movieUrl ['query ' ]
84+ );
85+ $ provider ->setMovieFile ($ nonExistingUrlFile );
86+ $ provider ->getOutput ();
87+ }
88+
5589 public function testPersistentResourceSimulation ()
5690 {
5791 Timer::start ();
0 commit comments