port 1776 databox create to master

This commit is contained in:
aina-esokia
2018-03-01 17:41:08 +04:00
parent 71f6e5d964
commit 9226e5a478
18 changed files with 411 additions and 166 deletions

View File

@@ -4,6 +4,7 @@ namespace Alchemy\Tests\Phrasea\Command\Setup;
use Alchemy\Phrasea\Command\Setup\Install;
use Symfony\Component\Yaml\Yaml;
use Alchemy\Phrasea\Core\Configuration\StructureTemplate;
/**
* @group functional
@@ -20,7 +21,7 @@ class InstallTest extends \PhraseanetTestCase
$password = 'sup4ssw0rd';
$serverName = 'http://phrasea.io';
$dataPath = '/tmp';
$template = 'fr';
$template = 'fr-simple';
$infoDb = Yaml::parse(file_get_contents(__DIR__ . '/../../../../../../resources/hudson/InstallDBs.yml'));
@@ -81,7 +82,7 @@ class InstallTest extends \PhraseanetTestCase
return true;
break;
default:
return;
return '';
}
}));
@@ -93,7 +94,9 @@ class InstallTest extends \PhraseanetTestCase
->method('install')
->with($email, $password, $this->isInstanceOf('Doctrine\DBAL\Driver\Connection'), $serverName, $dataPath, $this->isInstanceOf('Doctrine\DBAL\Driver\Connection'), $template, $this->anything());
$command = new Install('system:check');
$structureTemplate = self::$DI['cli']['phraseanet.structure-template'];
$command = new Install('system:check', $structureTemplate);
$command->setHelperSet($helperSet);
$command->setContainer(self::$DI['cli']);
$this->assertEquals(0, $command->execute($input, $output));

View File

@@ -75,7 +75,7 @@ class InstallerTest extends \PhraseanetTestCase
$dataPath = __DIR__ . '/../../../../../datas/';
$installer = new Installer($app);
$installer->install(uniqid('admin') . '@example.com', 'sdfsdsd', $abConn, 'http://local.phrasea.test.installer/', $dataPath, $dbConn, 'en');
$installer->install(uniqid('admin') . '@example.com', 'sdfsdsd', $abConn, 'http://local.phrasea.test.installer/', $dataPath, $dbConn, 'en-simple');
$this->assertTrue($app['configuration.store']->isSetup());
$this->assertTrue($app['phraseanet.configuration-tester']->isUpToDate());

View File

@@ -52,4 +52,27 @@ class StringHelperTest extends \PhraseanetTestCase
["ABC\n\rDEF", "ABC\n\nDEF"],
];
}
/**
* @dataProvider provideStringsForSqlQuote
* @covers Alchemy\Phrasea\Utilities\StringHelper::SqlQuote
*/
public function testSqlQuote($string, $mode, $expected)
{
$result = StringHelper::SqlQuote($string, $mode);
$this->assertEquals($expected, $result);
}
public function provideStringsForSqlQuote()
{
return [
["azerty", StringHelper::SQL_VALUE, "'azerty'"],
["aze'rty", StringHelper::SQL_VALUE, "'aze''rty'"],
["aze`rty", StringHelper::SQL_VALUE, "'aze`rty'"],
["azerty", StringHelper::SQL_IDENTIFIER, "`azerty`"],
["aze'rty", StringHelper::SQL_IDENTIFIER, "`aze'rty`"],
["aze`rty", StringHelper::SQL_IDENTIFIER, "`aze``rty`"],
];
}
}