mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-23 18:03:17 +00:00
Merge branch '3.8'
Conflicts: .gitignore bin/console composer.json composer.lock hudson/fixtures.sql lib/Alchemy/Phrasea/Command/Developer/IniReset.php lib/Alchemy/Phrasea/Command/Setup/Install.php lib/Alchemy/Phrasea/Controller/Api/Oauth2.php lib/Alchemy/Phrasea/Controller/Api/V1.php lib/Alchemy/Phrasea/Controller/Prod/Export.php lib/Alchemy/Phrasea/Controller/Root/Login.php lib/Alchemy/Phrasea/Core/Provider/PhraseanetServiceProvider.php lib/Alchemy/Phrasea/Core/Version.php lib/Alchemy/Phrasea/Helper/DatabaseHelper.php lib/Alchemy/Phrasea/Helper/Prod.php lib/classes/API/OAuth2/Application.php lib/classes/API/V1/Interface.php lib/classes/API/V1/adapter.php lib/classes/Setup/Upgrade.php lib/classes/media/subdef.php lib/classes/task/period/RecordMover.php templates/web/prod/index.html.twig templates/web/setup/step2.html.twig tests/Alchemy/Tests/Phrasea/Controller/Admin/RootTest.php tests/Alchemy/Tests/Phrasea/Controller/Root/LoginTest.php tests/classes/api/v1/api_v1_adapterTest.php tests/db-ref.sqlite vagrant/vms/phraseanet-php54-nginx/puphpet/config.yaml vagrant/vms/phraseanet-php54-nginx/puphpet/files/exec-once/setup
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
<?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' => '/')),
|
||||
);
|
||||
}
|
||||
}
|
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
namespace Alchemy\Tests\Phrasea\Http\StaticFile;
|
||||
|
||||
use Alchemy\Phrasea\Http\StaticFile\Nginx;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
|
||||
class NginxModeTest extends \PhraseanetPHPUnitAbstract
|
||||
{
|
||||
public function testGetVirtualHost()
|
||||
{
|
||||
$mode = new Nginx(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 Nginx($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' => '/')),
|
||||
);
|
||||
}
|
||||
}
|
@@ -0,0 +1,54 @@
|
||||
<?php
|
||||
|
||||
namespace Alchemy\Tests\Phrasea\Http\XSendFile;
|
||||
|
||||
use Alchemy\Phrasea\Http\StaticFile\StaticFileFactory;
|
||||
|
||||
class StaticFileFactoryTest extends \PhraseanetPHPUnitAbstract
|
||||
{
|
||||
public function testFactoryCreation()
|
||||
{
|
||||
$factory = StaticFileFactory::create(self::$DI['app']);
|
||||
$this->assertInstanceOf('Alchemy\Phrasea\Http\StaticFile\StaticFileFactory', $factory);
|
||||
}
|
||||
|
||||
public function testFactoryWithStaticFileEnable()
|
||||
{
|
||||
$logger = $this->getMock('Psr\Log\LoggerInterface');
|
||||
|
||||
$factory = new StaticFileFactory($logger, true, 'nginx', self::$DI['app']['phraseanet.thumb-symlinker']);
|
||||
$this->assertInstanceOf('Alchemy\Phrasea\Http\StaticFile\AbstractStaticMode', $factory->getMode());
|
||||
}
|
||||
|
||||
public function testFactoryWithStaticFileDisabled()
|
||||
{
|
||||
$logger = $this->getMock('Psr\Log\LoggerInterface');
|
||||
|
||||
$factory = new StaticFileFactory($logger, false, 'nginx', self::$DI['app']['phraseanet.thumb-symlinker']);
|
||||
$this->assertInstanceOf('Alchemy\Phrasea\Http\StaticFile\NullMode', $factory->getMode());
|
||||
$this->assertFalse($factory->isStaticFileModeEnabled());
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException Alchemy\Phrasea\Exception\InvalidArgumentException
|
||||
*/
|
||||
public function testFactoryWithWrongTypeThrowsAnExceptionIfRequired()
|
||||
{
|
||||
$logger = $this->getMock('Psr\Log\LoggerInterface');
|
||||
|
||||
$factory = new StaticFileFactory($logger, true, 'wrong-type', self::$DI['app']['phraseanet.thumb-symlinker']);
|
||||
$factory->getMode(true);
|
||||
}
|
||||
|
||||
public function testFactoryWithWrongTypeDoesNotThrowsAnException()
|
||||
{
|
||||
$logger = $this->getMock('Psr\Log\LoggerInterface');
|
||||
|
||||
$logger->expects($this->once())
|
||||
->method('error')
|
||||
->with($this->isType('string'));
|
||||
|
||||
$factory = new StaticFileFactory($logger, true, 'wrong-type', self::$DI['app']['phraseanet.thumb-symlinker']);
|
||||
$this->assertInstanceOf('Alchemy\Phrasea\Http\StaticFile\NullMode', $factory->getMode(false));
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user