mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-23 18:03:17 +00:00
51 lines
1.3 KiB
PHP
51 lines
1.3 KiB
PHP
<?php
|
|
|
|
namespace Alchemy\Tests\Phrasea\Http\H264PseudoStream;
|
|
|
|
use Alchemy\Phrasea\Http\H264PseudoStreaming\Apache;
|
|
|
|
/**
|
|
* @group functional
|
|
* @group legacy
|
|
*/
|
|
class ApacheTest extends \PhraseanetTestCase
|
|
{
|
|
/**
|
|
* @dataProvider provideMappingsAndFiles
|
|
*/
|
|
public function testGetUrl(array $mapping, $expectedRegExp, $pathfile)
|
|
{
|
|
$mode = new Apache($mapping);
|
|
if (null === $expectedRegExp) {
|
|
$this->assertNull($mode->getUrl($pathfile));
|
|
} else {
|
|
$this->assertRegExp($expectedRegExp, (string) $mode->getUrl($pathfile));
|
|
}
|
|
}
|
|
|
|
public function provideMappingsAndFiles()
|
|
{
|
|
$dir = sys_get_temp_dir().'/to/subdef';
|
|
$file = $dir . '/to/file';
|
|
|
|
if (!is_dir(dirname($file))) {
|
|
mkdir(dirname($file), 0777, true);
|
|
}
|
|
if (!is_file($file)) {
|
|
touch($file);
|
|
}
|
|
|
|
$mapping = [[
|
|
'directory' => $dir,
|
|
'mount-point' => 'mp4-videos',
|
|
'passphrase' => '123456',
|
|
]];
|
|
|
|
return [
|
|
[[], null, '/path/to/file'],
|
|
[$mapping, null, '/path/to/file'],
|
|
[$mapping, '/^\/mp4-videos\/[a-zA-Z0-9]+\/[0-9a-f]+\/to\/file$/', $file],
|
|
];
|
|
}
|
|
}
|