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:
Nicolas Le Goff
2014-10-09 19:40:33 +02:00
51 changed files with 2138 additions and 1147 deletions

View File

@@ -19,113 +19,4 @@ class RootTest extends \PhraseanetAuthenticatedWebTestCase
self::$DI['client']->request('GET', '/admin/');
$this->assertTrue(self::$DI['client']->getResponse()->isOk());
}
public function testRouteMysql()
{
$connexion = self::$DI['app']['phraseanet.configuration']['main']['database'];
$params = [
"hostname" => $connexion['host'],
"port" => $connexion['port'],
"user" => $connexion['user'],
"password" => $connexion['password'],
"dbname" => $connexion['dbname'],
];
self::$DI['client']->request("GET", "/admin/tests/connection/mysql/", $params);
$response = self::$DI['client']->getResponse();
$this->assertTrue($response->isOk());
$this->assertEquals("application/json", $response->headers->get("content-type"));
$content = json_decode($response->getContent());
$this->assertTrue(is_object($content));
$this->assertObjectHasAttribute('connection', $content);
$this->assertObjectHasAttribute('database', $content);
$this->assertObjectHasAttribute('is_empty', $content);
$this->assertObjectHasAttribute('is_appbox', $content);
$this->assertObjectHasAttribute('is_databox', $content);
$this->assertTrue($content->connection);
}
public function testRouteMysqlFailed()
{
$connexion = self::$DI['app']['phraseanet.configuration']['main']['database'];
$params = [
"hostname" => $connexion['host'],
"port" => $connexion['port'],
"user" => $connexion['user'] . 'fake',
"password" => $connexion['password'],
"dbname" => $connexion['dbname'],
];
self::$DI['client']->request("GET", "/admin/tests/connection/mysql/", $params);
$response = self::$DI['client']->getResponse();
$this->assertTrue($response->isOk());
$this->assertEquals("application/json", $response->headers->get("content-type"));
$content = json_decode($response->getContent());
$this->assertTrue(is_object($content));
$this->assertObjectHasAttribute('connection', $content);
$this->assertObjectHasAttribute('database', $content);
$this->assertObjectHasAttribute('is_empty', $content);
$this->assertObjectHasAttribute('is_appbox', $content);
$this->assertObjectHasAttribute('is_databox', $content);
$this->assertFalse($content->connection);
}
public function testRouteMysqlDbFailed()
{
$connexion = self::$DI['app']['phraseanet.configuration']['main']['database'];
$params = [
"hostname" => $connexion['host'],
"port" => $connexion['port'],
"user" => $connexion['user'],
"password" => $connexion['password'],
"dbname" => "fake-database-name"
];
self::$DI['client']->request("GET", "/admin/tests/connection/mysql/", $params);
$response = self::$DI['client']->getResponse();
$this->assertTrue($response->isOk());
$this->assertEquals("application/json", $response->headers->get("content-type"));
$content = json_decode($response->getContent());
$this->assertTrue(is_object($content));
$this->assertObjectHasAttribute('connection', $content);
$this->assertObjectHasAttribute('database', $content);
$this->assertObjectHasAttribute('is_empty', $content);
$this->assertObjectHasAttribute('is_appbox', $content);
$this->assertObjectHasAttribute('is_databox', $content);
$this->assertTrue($content->connection);
$this->assertFalse($content->database);
}
/**
* Default route test
*/
public function testRoutePath()
{
$file = new \SplFileObject(__DIR__ . '/../../../../../files/cestlafete.jpg');
self::$DI['client']->request("GET", "/admin/tests/pathurl/path/", ['path' => $file->getPathname()]);
$response = self::$DI['client']->getResponse();
$this->assertTrue($response->isOk());
$this->assertEquals("application/json", self::$DI['client']->getResponse()->headers->get("content-type"));
$content = json_decode(self::$DI['client']->getResponse()->getContent());
$this->assertTrue(is_object($content));
$this->assertObjectHasAttribute('exists', $content);
$this->assertObjectHasAttribute('file', $content);
$this->assertObjectHasAttribute('dir', $content);
$this->assertObjectHasAttribute('readable', $content);
$this->assertObjectHasAttribute('executable', $content);
}
public function testRouteUrl()
{
self::$DI['client']->request("GET", "/admin/tests/pathurl/url/", ['url' => "www.google.com"]);
$response = self::$DI['client']->getResponse();
$this->assertTrue($response->isOk());
$this->assertEquals("application/json", self::$DI['client']->getResponse()->headers->get("content-type"));
$content = json_decode(self::$DI['client']->getResponse()->getContent());
$this->assertTrue(is_object($content));
}
}