Files
Phraseanet/tests/Alchemy/Tests/Phrasea/Http/StaticFile/ApacheModeTest.php
Nicolas Le Goff ad69e19b92 Add unit tests
2014-09-10 11:25:31 +02:00

38 lines
1.1 KiB
PHP

<?php
namespace Alchemy\Tests\Phrasea\Http\StaticFile;
use Alchemy\Phrasea\Http\StaticFile\Apache;
use Symfony\Component\HttpFoundation\Request;
class ApacheModeTest extends \PhraseanetPHPUnitAbstract
{
public function testGetVirtualHost()
{
$mode = new Apache(array(
'directory' => __DIR__,
'mount-point' => '/thumbs'
), self::$DI['app']['phraseanet.thumb-symlinker']);
$conf = $mode->getVirtualHostConfiguration();
$this->assertRegExp('#'.__DIR__ . '#', $conf);
}
/**
* @dataProvider provideMappings
* @expectedException Alchemy\Phrasea\Exception\InvalidArgumentException
*/
public function testInvalidMapping($mapping)
{
new Apache($mapping, self::$DI['app']['phraseanet.thumb-symlinker']);
}
public function provideMappings()
{
return array(
array(array('Directory' => __DIR__)),
array(array('wrong-key' => __DIR__, 'mount-point' => '/')),
array(array('directory' => __DIR__, 'wrong-key' => '/')),
);
}
}