mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-15 14:03:27 +00:00
Merge branch '3.8'
Conflicts: .travis.yml bin/developer build-env.sh lib/Alchemy/Phrasea/Application.php lib/Alchemy/Phrasea/Core/Provider/LocaleServiceProvider.php tests/Alchemy/Tests/Phrasea/Command/Setup/XSendFileMappingGeneratorTest.php tests/Alchemy/Tests/Phrasea/Controller/SetupTest.php tests/Alchemy/Tests/Phrasea/Form/Login/PhraseaRegisterFormTest.php
This commit is contained in:
12
.travis.yml
12
.travis.yml
@@ -56,17 +56,17 @@ script:
|
||||
- bin/developer assets:compile-less
|
||||
- bin/developer system:uninstall
|
||||
- sh -c " if [ '$SETUP_MODE' = 'update' ]; then
|
||||
cp hudson/connexion.inc config/;
|
||||
cp hudson/_GV.php config/;
|
||||
mysql -e 'source `pwd`/hudson/fixtures.sql';
|
||||
bin/setup system:install --email=test@phraseanet.com --password=test --db-user=root --db-template=fr --db-password= --databox=db_test --appbox=ab_test --server-name=http://127.0.0.1 -y -v;
|
||||
bin/developer ini:reset --v3.1 -v;
|
||||
bin/setup system:upgrade -y -v -f;
|
||||
fi"
|
||||
- sh -c " if [ '$SETUP_MODE' = 'install' ]; then
|
||||
bin/setup system:install --email=test@phraseanet.com --password=test --db-user=root --db-template=fr --db-password= --databox=db_test --appbox=ab_test --server-name=http://127.0.0.1 -y;
|
||||
bin/setup system:install --email=test@phraseanet.com --password=test --db-user=root --db-template=fr --db-password= --databox=db_test --appbox=ab_test --server-name=http://127.0.0.1 -y -v;
|
||||
bin/developer ini:setup-tests-dbs -v;
|
||||
fi"
|
||||
- php hudson/cleanupSubdefs.php
|
||||
#sqlite db generation should occur once Phraseanet is up to date :
|
||||
#sqlite db generation should occur once Phraseanet is up to date :
|
||||
- bin/developer phraseanet:regenerate-sqlite
|
||||
- ./node_modules/.bin/grunt test
|
||||
#ls -d tests/Alchemy/Tests/Phrasea/*/ | parallel --gnu 'bin/phpunit {};'
|
||||
#ls -d tests/Alchemy/Tests/Phrasea/*/ | parallel --gnu 'bin/phpunit {};'
|
||||
- bin/phpunit
|
||||
|
3
Vagrantfile
vendored
3
Vagrantfile
vendored
@@ -79,7 +79,7 @@ Vagrant.configure("2") do |config|
|
||||
end
|
||||
if folder['source'] != '' && folder['target'] != ''
|
||||
if folder['sync_type'] == 'nfs'
|
||||
node.vm.synced_folder "#{folder['source']}", "#{folder['target']}", id: "#{i}", type: "nfs"
|
||||
node.vm.synced_folder "#{folder['source']}", "#{folder['target']}", id: "#{i}", type: "nfs", mount_options: ['rw', 'vers=3', 'tcp', 'fsc']
|
||||
elsif folder['sync_type'] == 'smb'
|
||||
node.vm.synced_folder "#{folder['source']}", "#{folder['target']}", id: "#{i}", type: "smb"
|
||||
elsif folder['sync_type'] == 'rsync'
|
||||
@@ -155,6 +155,7 @@ Vagrant.configure("2") do |config|
|
||||
end
|
||||
|
||||
v.memory = "#{data['vm']['memory']}"
|
||||
v.cpus = "#{data['vm']['cpus']}"
|
||||
|
||||
if data['vm']['hostname'].to_s.strip.length != 0
|
||||
v.name = node.vm.hostname
|
||||
|
@@ -15,11 +15,13 @@ use Alchemy\Phrasea\Command\Developer\APIRoutesDumper;
|
||||
use Alchemy\Phrasea\Command\Developer\Behat;
|
||||
use Alchemy\Phrasea\Command\Developer\BowerInstall;
|
||||
use Alchemy\Phrasea\Command\Developer\ComposerInstall;
|
||||
use Alchemy\Phrasea\Command\Developer\LessCompiler;
|
||||
use Alchemy\Phrasea\Command\Developer\IniReset;
|
||||
use Alchemy\Phrasea\Command\Developer\InstallAll;
|
||||
use Alchemy\Phrasea\Command\Developer\JsFixtures;
|
||||
use Alchemy\Phrasea\Command\Developer\LessCompiler;
|
||||
use Alchemy\Phrasea\Command\Developer\RegenerateSqliteDb;
|
||||
use Alchemy\Phrasea\Command\Developer\RoutesDumper;
|
||||
use Alchemy\Phrasea\Command\Developer\SetupTestsDbs;
|
||||
use Alchemy\Phrasea\Command\Developer\Uninstaller;
|
||||
use Alchemy\Phrasea\Command\Developer\TranslationDumper;
|
||||
|
||||
@@ -89,6 +91,8 @@ $cli->command(new Behat());
|
||||
$cli->command(new LessCompiler());
|
||||
$cli->command(new Uninstaller());
|
||||
$cli->command(new JsFixtures());
|
||||
$cli->command(new IniReset());
|
||||
$cli->command(new SetupTestsDbs());
|
||||
$cli->command(new \module_console_systemTemplateGenerator('system:generate-templates'));
|
||||
|
||||
|
||||
|
26
build-env.sh
26
build-env.sh
@@ -1,26 +0,0 @@
|
||||
composer install --dev
|
||||
./bin/developer system:uninstall || exit 1
|
||||
cp -f hudson/connexion.inc config/ || exit 1
|
||||
cp -f hudson/_GV.php config/ || exit 1
|
||||
sudo npm install -g uglify-js recess grunt-cli jake
|
||||
npm install
|
||||
if [ "$1" != "--no-dependencies" ]
|
||||
then
|
||||
./bin/developer dependencies:all --clear-cache --prefer-source || exit 1
|
||||
else
|
||||
echo "Dependencies retrieval discarded"
|
||||
fi
|
||||
sudo mysql -e 'drop database update39_test;'
|
||||
sudo mysql -e 'drop database ab_test;'
|
||||
sudo mysql -e 'drop database db_test;'
|
||||
sudo mysql -e 'drop database ab_unitTests;'
|
||||
sudo mysql -e 'drop database db_unitTests;'
|
||||
sudo mysql -e 'create database update39_test;'
|
||||
sudo mysql -e 'create database ab_test;'
|
||||
sudo mysql -e 'create database db_test;'
|
||||
sudo mysql -e 'create database ab_unitTests;'
|
||||
sudo mysql -e 'create database db_unitTests;'
|
||||
sudo mysql -e "GRANT ALL PRIVILEGES ON ab_unitTests.* TO 'phraseaUnitTests'@'localhost' IDENTIFIED BY 'iWvGxPE8' WITH GRANT OPTION" || exit 1
|
||||
sudo mysql -e "GRANT ALL PRIVILEGES ON db_unitTests.* TO 'phraseaUnitTests'@'localhost' IDENTIFIED BY 'iWvGxPE8' WITH GRANT OPTION" || exit 1
|
||||
sudo mysql -e "source `pwd`/hudson/fixtures.sql" || exit 1
|
||||
sudo mysql -e 'SET @@global.sql_mode= "";' || exit 1
|
@@ -1,7 +1,7 @@
|
||||
database:
|
||||
host: 127.0.0.1
|
||||
port: port
|
||||
user: phraseaUnitTests
|
||||
port: 3306
|
||||
user: phr_user
|
||||
password: iWvGxPE8
|
||||
applicationBox: ab_unitTests
|
||||
dataBox: db_unitTests
|
||||
ab_name: ab_setup_test
|
||||
db_name: db_setup_test
|
||||
|
@@ -261,10 +261,8 @@ class Application extends SilexApplication
|
||||
}
|
||||
}
|
||||
|
||||
$imagineDriver = $app['conf']->get(['registry', 'executables', 'imagine-driver']);
|
||||
|
||||
$configuration['ffmpeg.threads'] = $app['conf']->get(['registry', 'executables', 'ffmpeg-threads']);
|
||||
$configuration['imagine.driver'] = $imagineDriver ?: null;
|
||||
$configuration['ffmpeg.threads'] = $app['conf']->get(['registry', 'executables', 'ffmpeg-threads']) ?: null;
|
||||
$configuration['imagine.driver'] = $app['conf']->get(['registry', 'executables', 'imagine-driver']) ?: null;
|
||||
|
||||
return $configuration;
|
||||
});
|
||||
|
136
lib/Alchemy/Phrasea/Command/Developer/IniReset.php
Normal file
136
lib/Alchemy/Phrasea/Command/Developer/IniReset.php
Normal file
@@ -0,0 +1,136 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of Phraseanet
|
||||
*
|
||||
* (c) 2005-2014 Alchemy
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Alchemy\Phrasea\Command\Developer;
|
||||
|
||||
use Alchemy\Phrasea\Command\Command;
|
||||
use Alchemy\Phrasea\Exception\RuntimeException;
|
||||
use Symfony\Component\Console\Input\ArrayInput;
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
use Symfony\Component\Console\Input\InputOption;
|
||||
use Symfony\Component\Yaml\Yaml;
|
||||
use Symfony\Component\Process\Process;
|
||||
|
||||
class IniReset extends Command
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct('ini:reset');
|
||||
|
||||
$this->setDescription('Reset environment')
|
||||
->addOption('name', null, InputOption::VALUE_OPTIONAL, 'Databox name to reset, in case of multiple databox are mounted', null)
|
||||
->addOption('dependencies', null, InputOption::VALUE_NONE, 'Fetch dependencies', null)
|
||||
->addOption('v3.1', null, InputOption::VALUE_NONE, 'Reset with v3.1 fixtures', null)
|
||||
->addOption('uninstall', null, InputOption::VALUE_NONE, 'Uninstall Phraseanet', null);
|
||||
;
|
||||
}
|
||||
|
||||
protected function doExecute(InputInterface $input, OutputInterface $output)
|
||||
{
|
||||
if (!$this->container['phraseanet.configuration']->isSetup()) {
|
||||
throw new RuntimeException(sprintf(
|
||||
'Phraseanet is not setup. You can run <info>bin/setup system::install</info> command to install Phraseanet.'
|
||||
));
|
||||
}
|
||||
|
||||
// get dbs
|
||||
$conf = $this->container['phraseanet.configuration']->getConfig();
|
||||
$dbs = array('ab' => $conf['main']['database']['dbname'], 'dbs' => array(), 'setup_dbs' => array());
|
||||
foreach($this->container['phraseanet.appbox']->get_databoxes() as $databox) {
|
||||
$dbs['dbs'][] = $databox->get_dbname();
|
||||
}
|
||||
|
||||
//uninstall
|
||||
if ($input->getOption('uninstall')) {
|
||||
$command = $this->getApplication()->find('system:uninstall');
|
||||
|
||||
$output->writeln('Uninstalling...<info>OK</info>');
|
||||
$input = new ArrayInput(array(
|
||||
'command' => 'system:uninstall'
|
||||
));
|
||||
$command->run($input, $output);
|
||||
}
|
||||
|
||||
//run composer
|
||||
//run bower
|
||||
if ($input->getOption('dependencies')) {
|
||||
$command = $this->getApplication()->find('dependencies:composer');
|
||||
|
||||
$input = new ArrayInput(array(
|
||||
'command' => 'dependencies:composer'
|
||||
));
|
||||
$command->run($input, $output);
|
||||
|
||||
$command = $this->getApplication()->find('dependencies:bower');
|
||||
|
||||
$input = new ArrayInput(array(
|
||||
'command' => 'dependencies:bower'
|
||||
));
|
||||
$command->run($input, $output);
|
||||
}
|
||||
|
||||
if (count($dbs['dbs']) > 1) {
|
||||
if ($input->getOption('name')) {
|
||||
$dbName = $input->getOption('name');
|
||||
} else {
|
||||
$dialog = $this->getHelperSet()->get('dialog');
|
||||
$dbName = $dialog->ask(
|
||||
$output,
|
||||
_('Please enter the databox name to reset')
|
||||
);
|
||||
}
|
||||
} else {
|
||||
$dbName = current($dbs['dbs']);
|
||||
}
|
||||
|
||||
$schema = $this->container['EM']->getConnection()->getSchemaManager();
|
||||
$output->writeln('Creating database "'.$dbs['ab'].'"...<info>OK</info>');
|
||||
$schema->dropAndCreateDatabase($dbs['ab']);
|
||||
$output->writeln('Creating database "'.$dbName.'"...<info>OK</info>');
|
||||
$schema->dropAndCreateDatabase($dbName);
|
||||
|
||||
// inject v3.1 fixtures
|
||||
if ($input->getOption('v3.1')) {
|
||||
$this->container['filesystem']->copy($this->container['root.path'].'/hudson/connexion.inc', $this->container['root.path'].'/config/connexion.inc');
|
||||
$this->container['filesystem']->copy($this->container['root.path'].'/hudson/_GV.php', $this->container['root.path'].'/config/_GV.php');
|
||||
|
||||
$command = $this->getApplication()->find('dbal:import');
|
||||
|
||||
$content = file_get_contents($this->container['root.path'] . '/hudson/fixtures.sql');
|
||||
$content = str_replace('ab_test', $dbs['ab'], $content);
|
||||
$content = str_replace('db_test', $dbName, $content);
|
||||
|
||||
$tmpFile = tempnam(sys_get_temp_dir(), 'fixtures-v3.1-');
|
||||
$this->container['filesystem']->dumpFile($tmpFile, $content);
|
||||
|
||||
$input = new ArrayInput(array(
|
||||
'command' => 'dbal:import',
|
||||
'file' => $tmpFile
|
||||
));
|
||||
|
||||
$verbosity = $output->getVerbosity();
|
||||
$output->setVerbosity(OutputInterface::VERBOSITY_QUIET);
|
||||
$command->run($input, $output);
|
||||
$output->setVerbosity($verbosity);
|
||||
$output->writeln('Importing Phraseanet v3.1 fixtures...<info>OK</info>');
|
||||
}
|
||||
|
||||
// create setup dbs
|
||||
$command = $this->getApplication()->find('ini:setup-tests-dbs');
|
||||
$input = new ArrayInput(array(
|
||||
'command' => 'ini:setup-tests-dbs'
|
||||
));
|
||||
$command->run($input, $output);
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
66
lib/Alchemy/Phrasea/Command/Developer/SetupTestsDbs.php
Normal file
66
lib/Alchemy/Phrasea/Command/Developer/SetupTestsDbs.php
Normal file
@@ -0,0 +1,66 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of Phraseanet
|
||||
*
|
||||
* (c) 2005-2014 Alchemy
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Alchemy\Phrasea\Command\Developer;
|
||||
|
||||
use Alchemy\Phrasea\Command\Command;
|
||||
use Alchemy\Phrasea\Exception\RuntimeException;
|
||||
use Symfony\Component\Console\Input\ArrayInput;
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
use Symfony\Component\Console\Input\InputOption;
|
||||
use Symfony\Component\Yaml\Yaml;
|
||||
use Symfony\Component\Process\Process;
|
||||
|
||||
class SetupTestsDbs extends Command
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct('ini:setup-tests-dbs');
|
||||
|
||||
$this->setDescription('Setup dbs for tests environment');
|
||||
}
|
||||
|
||||
protected function doExecute(InputInterface $input, OutputInterface $output)
|
||||
{
|
||||
if (!$this->container['phraseanet.configuration']->isSetup()) {
|
||||
throw new RuntimeException(sprintf(
|
||||
'Phraseanet is not setup. You can run <info>bin/setup system::install</info> command to install Phraseanet.'
|
||||
));
|
||||
}
|
||||
|
||||
$settings = Yaml::parse(file_get_contents(__DIR__ . '/../../../../../hudson/InstallDBs.yml'));
|
||||
|
||||
$dbs = array();
|
||||
|
||||
$dbs[] = $settings['database']['ab_name'];
|
||||
$dbs[] = $settings['database']['db_name'];
|
||||
|
||||
$schema = $this->container['EM']->getConnection()->getSchemaManager();
|
||||
|
||||
foreach($dbs as $name) {
|
||||
$output->writeln('Creating database "'.$name.'"...<info>OK</info>');
|
||||
$schema->dropAndCreateDatabase($name);
|
||||
}
|
||||
|
||||
$this->container['EM']->getConnection()->executeUpdate('
|
||||
GRANT ALL PRIVILEGES ON '.$settings['database']['ab_name'].'.* TO \''.$settings['database']['user'].'\'@\''.$settings['database']['host'].'\' IDENTIFIED BY \''.$settings['database']['password'].'\' WITH GRANT OPTION
|
||||
');
|
||||
|
||||
$this->container['EM']->getConnection()->executeUpdate('
|
||||
GRANT ALL PRIVILEGES ON '.$settings['database']['db_name'].'.* TO \''.$settings['database']['user'].'\'@\''.$settings['database']['host'].'\' IDENTIFIED BY \''.$settings['database']['password'].'\' WITH GRANT OPTION
|
||||
');
|
||||
|
||||
$this->container['EM']->getConnection()->executeUpdate('SET @@global.sql_mode= ""');
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
@@ -10,6 +10,7 @@
|
||||
*/
|
||||
|
||||
use Alchemy\Phrasea\Command\Command;
|
||||
use Alchemy\Phrasea\Core\Version;
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
use Symfony\Component\Console\Input\InputOption;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
@@ -58,7 +59,7 @@ class module_console_systemUpgrade extends Command
|
||||
}
|
||||
|
||||
if ($continue == 'y') {
|
||||
$output->write('<info>Upgrading...</info>', true);
|
||||
$output->write(sprintf('Upgrading... from version <info>%s</info> to <info>%s</info>', $this->container['phraseanet.appbox']->get_version(), Version::getNumber()), true);
|
||||
|
||||
try {
|
||||
$upgrader = new Setup_Upgrade($this->container, $input->getOption('force'));
|
||||
|
@@ -19,11 +19,6 @@ class XSendFileMappingGeneratorTest extends \PhraseanetTestCase
|
||||
->with('type')
|
||||
->will($this->returnValue('nginx'));
|
||||
|
||||
$input->expects($this->any())
|
||||
->method('getOption')
|
||||
->with($this->isType('string'))
|
||||
->will($this->returnValue($option));
|
||||
|
||||
$command = new XSendFileMappingGenerator();
|
||||
|
||||
self::$DI['cli']['monolog'] = self::$DI['cli']->share(function () {
|
||||
|
@@ -32,10 +32,10 @@ class SetupTest extends \PhraseanetWebTestCase
|
||||
|
||||
public function testRouteSlashWhenInstalled()
|
||||
{
|
||||
$this->app['phraseanet.configuration-tester']->expects($this->exactly(1))
|
||||
$this->app['phraseanet.configuration-tester']->expects($this->any())
|
||||
->method('isInstalled')
|
||||
->will($this->returnValue(true));
|
||||
$this->app['phraseanet.configuration-tester']->expects($this->once())
|
||||
$this->app['phraseanet.configuration-tester']->expects($this->any())
|
||||
->method('isBlank')
|
||||
->will($this->returnValue(false));
|
||||
|
||||
@@ -48,10 +48,10 @@ class SetupTest extends \PhraseanetWebTestCase
|
||||
|
||||
public function testRouteInstructionsWhenUpgradeRequired()
|
||||
{
|
||||
$this->app['phraseanet.configuration-tester']->expects($this->exactly(1))
|
||||
$this->app['phraseanet.configuration-tester']->expects($this->any())
|
||||
->method('isInstalled')
|
||||
->will($this->returnValue(false));
|
||||
$this->app['phraseanet.configuration-tester']->expects($this->once())
|
||||
$this->app['phraseanet.configuration-tester']->expects($this->any())
|
||||
->method('isBlank')
|
||||
->will($this->returnValue(false));
|
||||
|
||||
@@ -66,7 +66,7 @@ class SetupTest extends \PhraseanetWebTestCase
|
||||
{
|
||||
$client = $this->createClient();
|
||||
|
||||
$this->app['phraseanet.configuration-tester']->expects($this->once())
|
||||
$this->app['phraseanet.configuration-tester']->expects($this->any())
|
||||
->method('isBlank')
|
||||
->will($this->returnValue(true));
|
||||
|
||||
@@ -79,7 +79,7 @@ class SetupTest extends \PhraseanetWebTestCase
|
||||
{
|
||||
$client = $this->createClient();
|
||||
|
||||
$this->app['phraseanet.configuration-tester']->expects($this->once())
|
||||
$this->app['phraseanet.configuration-tester']->expects($this->any())
|
||||
->method('isBlank')
|
||||
->will($this->returnValue(true));
|
||||
|
||||
@@ -103,45 +103,38 @@ class SetupTest extends \PhraseanetWebTestCase
|
||||
->getMock();
|
||||
|
||||
$user = $this->createUserMock();
|
||||
|
||||
$user->expects($this->once())
|
||||
->method('getId')
|
||||
->will($this->returnValue(self::$DI['user']->getId()));
|
||||
|
||||
$acl = $this->getMockBuilder('ACL')
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
$acl->expects($this->once())
|
||||
->method('get_granted_sbas')
|
||||
->will($this->returnValue([]));
|
||||
|
||||
$aclProvider = $this->getMockBuilder('Alchemy\Phrasea\Authentication\ACLProvider')
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
$aclProvider->expects($this->any())
|
||||
->method('get')
|
||||
->will($this->returnValue($acl));
|
||||
|
||||
$this->app['acl'] = $aclProvider;
|
||||
|
||||
$this->app['phraseanet.installer']->expects($this->once())
|
||||
->method('install')
|
||||
->will($this->returnValue($user));
|
||||
|
||||
$authenticator = $this->getMockBuilder('Alchemy\Phrasea\Authentication\Authenticator')
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
$session = $this->getMock('Entities\Session');
|
||||
|
||||
$authenticator->expects($this->once())
|
||||
->method('openAccount')
|
||||
->with($this->equalTo($user))
|
||||
->will($this->returnValue($session));
|
||||
|
||||
$this->app['authentication'] = $authenticator;
|
||||
|
||||
$client = $this->createClient();
|
||||
$settings = Yaml::parse(file_get_contents(__DIR__ . '/../../../../../hudson/InstallDBs.yml'));
|
||||
$settings = $settings['database'];
|
||||
|
||||
$host = isset($settings['host']) ? $settings['host'] : 'localhost';
|
||||
$port = isset($settings['port']) ? $settings['port'] : '3306';
|
||||
$MySQLuser = isset($settings['user']) ? $settings['user'] : 'root';
|
||||
$MySQLpassword = isset($settings['password']) ? $settings['password'] : '';
|
||||
$abName = isset($settings['applicationBox']) ? $settings['applicationBox'] : null;
|
||||
$dbName = isset($settings['dataBox']) ? $settings['dataBox'] : null;
|
||||
$user = isset($settings['user']) ? $settings['user'] : 'root';
|
||||
$password = isset($settings['password']) ? $settings['password'] : '';
|
||||
$abName = isset($settings['ab_name']) ? $settings['ab_name'] : null;
|
||||
$dbName = isset($settings['db_name']) ? $settings['db_name'] : null;
|
||||
|
||||
$dataDir = sys_get_temp_dir() . '/datainstall/';
|
||||
|
||||
$params = [
|
||||
$params = array(
|
||||
'email' => 'user@example.org',
|
||||
'password' => 'prètty%%password',
|
||||
'binary_xpdf' => '/path/to/xpdf',
|
||||
@@ -156,22 +149,22 @@ class SetupTest extends \PhraseanetWebTestCase
|
||||
'binary_composite' => '/path/to/composite',
|
||||
'binary_convert' => '/path/to/convert',
|
||||
'binary_php' => '/path/to/php',
|
||||
'datapath_noweb' => $dataDir . 'noweb',
|
||||
'datapath_noweb' => sys_get_temp_dir() . '/datainstall/noweb',
|
||||
'ab_hostname' => $host,
|
||||
'ab_port' => $port,
|
||||
'ab_user' => $MySQLuser,
|
||||
'ab_password' => $MySQLpassword,
|
||||
'ab_user' => $user,
|
||||
'ab_password' => $password,
|
||||
'ab_name' => $abName,
|
||||
'db_name' => $dbName,
|
||||
'db_template' => 'en-simple',
|
||||
'create_task' => [],
|
||||
'db_template' => 'en',
|
||||
'create_task' => array(),
|
||||
'binary_phraseanet_indexer' => '/path/to/phraseanet_indexer',
|
||||
];
|
||||
);
|
||||
|
||||
$client->request('POST', '/setup/installer/install/', $params);
|
||||
$response = $client->getResponse();
|
||||
$this->assertEquals(302, $response->getStatusCode());
|
||||
$this->assertTrue(false === strpos($response->headers->get('location'), '/setup/installer/'));
|
||||
$this->assertTrue(false === strpos($response->headers->get('location'), '/setup/installer/'), $response);
|
||||
}
|
||||
|
||||
public function testSetupProvidesPathTest()
|
||||
|
@@ -28,53 +28,77 @@ class PhraseaRegisterFormTest extends FormTestCase
|
||||
|
||||
public function testFormDoesRegisterValidFields()
|
||||
{
|
||||
$available = [
|
||||
'parameter' => [
|
||||
$available = array(
|
||||
'extra-parameter' => array(
|
||||
'type' => 'text',
|
||||
'label' => 'Yollah !',
|
||||
],
|
||||
'parameter2' => [
|
||||
'label' => '',
|
||||
),
|
||||
'extra-parameter2' => array(
|
||||
'type' => 'text',
|
||||
'label' => 'Yollah !',
|
||||
]
|
||||
];
|
||||
$params = [
|
||||
[
|
||||
'name' => 'parameter',
|
||||
'label' => '',
|
||||
)
|
||||
);
|
||||
$params = array(
|
||||
array(
|
||||
'name' => 'extra-parameter',
|
||||
'required' => true
|
||||
],
|
||||
[
|
||||
'name' => 'parameter2',
|
||||
),
|
||||
array(
|
||||
'name' => 'extra-parameter2',
|
||||
'required' => true
|
||||
]
|
||||
)
|
||||
];
|
||||
|
||||
$expected = array('email', 'password', 'provider-id', '_token', 'extraParameter','extraParameter2');
|
||||
|
||||
if (self::$DI['app']->hasTermsOfUse()) {
|
||||
$expected[] = 'accept-tou';
|
||||
}
|
||||
|
||||
if (!self::$DI['app']['phraseanet.registry']->get('GV_autoselectDB')) {
|
||||
$expected[] = 'collections';
|
||||
}
|
||||
|
||||
$form = new PhraseaRegisterForm(self::$DI['app'], $available, $params, new Camelizer());
|
||||
|
||||
$this->assertCount(self::$DI['app']['conf']->get(['registry', 'registration', 'auto-select-collections']) ? 7 : 8, self::$DI['app']->form($form)->createView()->vars['form']->children);
|
||||
foreach (array_keys(self::$DI['app']->form($form)->createView()->vars['form']->children) as $name) {
|
||||
$this->assertContains($name, $expected);
|
||||
}
|
||||
}
|
||||
|
||||
public function testFormDoesNotRegisterNonValidFields()
|
||||
{
|
||||
$available = [
|
||||
'parameter' => [
|
||||
$available = array(
|
||||
'extra-parameter' => array(
|
||||
'type' => 'text',
|
||||
'label' => 'Yollah !',
|
||||
]
|
||||
];
|
||||
$params = [
|
||||
[
|
||||
'name' => 'parameter',
|
||||
'label' => '',
|
||||
)
|
||||
);
|
||||
$params = array(
|
||||
array(
|
||||
'name' => 'extra-parameter',
|
||||
'required' => true
|
||||
],
|
||||
[
|
||||
'name' => 'parameter2',
|
||||
),
|
||||
array(
|
||||
'name' => 'extra-parameter2',
|
||||
'required' => true
|
||||
]
|
||||
];
|
||||
)
|
||||
);
|
||||
|
||||
$expected = array('email', 'password', 'provider-id', '_token', 'extraParameter');
|
||||
|
||||
if (self::$DI['app']->hasTermsOfUse()) {
|
||||
$expected[] = 'accept-tou';
|
||||
}
|
||||
|
||||
if (!self::$DI['app']['phraseanet.registry']->get('GV_autoselectDB')) {
|
||||
$expected[] = 'collections';
|
||||
}
|
||||
|
||||
$form = new PhraseaRegisterForm(self::$DI['app'], $available, $params, new Camelizer());
|
||||
|
||||
$this->assertCount(self::$DI['app']['conf']->get(['registry', 'registration', 'auto-select-collections']) ? 6 : 7, self::$DI['app']->form($form)->createView()->vars['form']->children);
|
||||
foreach (array_keys(self::$DI['app']->form($form)->createView()->vars['form']->children) as $name) {
|
||||
$this->assertContains($name, $expected);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -6,6 +6,7 @@ vagrantfile-local:
|
||||
box_url: puphpet/debian75-x64
|
||||
hostname: phraseanet-php54-nginx
|
||||
memory: '2048'
|
||||
cpus: '2'
|
||||
chosen_provider: virtualbox
|
||||
network:
|
||||
private_network: 192.168.56.101
|
||||
@@ -84,6 +85,7 @@ server:
|
||||
- libfreetype6-dev
|
||||
- libgif-dev
|
||||
- libjpeg62-dev
|
||||
- cachefilesd
|
||||
dot_files:
|
||||
-
|
||||
bash_aliases: null
|
||||
@@ -183,6 +185,7 @@ php:
|
||||
- mysql
|
||||
- mbstring
|
||||
- sqlite
|
||||
- redis
|
||||
pear: { }
|
||||
pecl:
|
||||
- zip
|
||||
|
@@ -8,3 +8,19 @@ sudo iptables -I INPUT -p tcp --dport 9200 -j ACCEPT
|
||||
|
||||
# open mysql ports
|
||||
sudo iptables -I INPUT -p tcp --dport 3306 -j ACCEPT
|
||||
|
||||
#closure
|
||||
echo 'export JS_COMPILER=$HOME/closure/compiler.jar' >> ~/.bashrc
|
||||
source ~/.bashrc
|
||||
|
||||
# java
|
||||
echo 'export JAVA_HOME=/usr/lib/jvm/java-7-openjdk-amd64/jre/' >> ~/.bashrc
|
||||
source ~/.bashrc
|
||||
|
||||
# locales
|
||||
|
||||
export LANGUAGE=fr_FR.UTF-8
|
||||
export LANG=fr_FR.UTF-8
|
||||
export LC_ALL=fr_FR.UTF-8
|
||||
|
||||
source ~/.bashrc
|
@@ -39,12 +39,6 @@ cd /tmp
|
||||
wget –quiet http://dl.google.com/closure-compiler/compiler-latest.zip
|
||||
unzip compiler-latest.zip -d closure
|
||||
mv closure $HOME
|
||||
echo 'export JS_COMPILER=$HOME/closure/compiler.jar' >> ~/.bashrc
|
||||
source ~/.bashrc
|
||||
|
||||
# java
|
||||
echo 'export JAVA_HOME=/usr/lib/jvm/java-7-openjdk-amd64/jre/' >> ~/.bashrc
|
||||
source ~/.bashrc
|
||||
|
||||
#twig
|
||||
cd /tmp
|
||||
@@ -104,6 +98,9 @@ if [ $? -eq 0 ]; then
|
||||
sudo sh -c 'echo ";extension=libevent.so" > /etc/php5/fpm/conf.d/libevent.ini'
|
||||
fi
|
||||
|
||||
# cache file sd
|
||||
sudo sh -c 'echo "RUN=yes" > /etc/default/cachefilesd'
|
||||
|
||||
# copy www.conf
|
||||
sudo sh -c "cat /vagrant/vagrant/config/nginx/php5-fpm-www.conf > /etc/php5/fpm/pool.d/www.conf"
|
||||
|
||||
|
Reference in New Issue
Block a user