mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-17 06:53:15 +00:00
Fix unit tests on fresh install
This commit is contained in:
@@ -99,8 +99,13 @@ class AbstractCheckerTest extends \PhraseanetPHPUnitAbstract
|
||||
{
|
||||
$othercollection = $collection = null;
|
||||
$app = new Application('test');
|
||||
$databoxes = $app['phraseanet.appbox']->get_databoxes();
|
||||
if (count($databoxes) === 0) {
|
||||
$this->fail('Unable to find collections');
|
||||
}
|
||||
$databox = array_pop($databoxes);
|
||||
|
||||
foreach ($app['phraseanet.appbox']->get_databoxes() as $db) {
|
||||
foreach ($databoxes as $db) {
|
||||
if (! $collection) {
|
||||
foreach ($db->get_collections() as $coll) {
|
||||
$collection = $coll;
|
||||
@@ -118,6 +123,13 @@ class AbstractCheckerTest extends \PhraseanetPHPUnitAbstract
|
||||
}
|
||||
}
|
||||
|
||||
if (null === $othercollection) {
|
||||
$othercollection = \collection::create($app, $databox, $app['phraseanet.appbox'], 'other coll');
|
||||
}
|
||||
if (null === $collection) {
|
||||
$collection = \collection::create($app, $databox, $app['phraseanet.appbox'], 'other coll');
|
||||
}
|
||||
|
||||
return array(
|
||||
array(array($collection), $collection, true),
|
||||
array($collection, $collection, true),
|
||||
|
@@ -21,6 +21,8 @@ class FilenameTest extends \PhraseanetPHPUnitAbstract
|
||||
public function setUp()
|
||||
{
|
||||
parent::setUp();
|
||||
// initialize record so that it already exist
|
||||
$record = self::$DI['record_1'];
|
||||
$this->object = new Filename(self::$DI['app']);
|
||||
$this->filename = __DIR__ . '/../../../../../../tmp/test001.jpg';
|
||||
copy(__DIR__ . '/../../../../../files/test001.jpg', $this->filename);
|
||||
|
@@ -16,6 +16,7 @@ use Symfony\Component\HttpFoundation\Response;
|
||||
class LoginTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
|
||||
{
|
||||
public static $demands;
|
||||
public static $collections;
|
||||
public static $login;
|
||||
public static $email;
|
||||
|
||||
@@ -26,6 +27,16 @@ class LoginTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
|
||||
if (null === self::$demands) {
|
||||
self::$demands = array(self::$DI['collection']->get_coll_id());
|
||||
}
|
||||
if (null === self::$collections) {
|
||||
self::$collections = array(self::$DI['collection']->get_base_id());
|
||||
|
||||
$sxml = simplexml_load_string(self::$DI['collection']->get_prefs());
|
||||
$sxml->caninscript = 1;
|
||||
$dom = new \DOMDocument();
|
||||
$dom->loadXML($sxml->asXML());
|
||||
|
||||
self::$DI['collection']->set_prefs($dom);
|
||||
}
|
||||
if (null === self::$login) {
|
||||
self::$login = self::$DI['user']->get_login();
|
||||
}
|
||||
@@ -417,6 +428,7 @@ class LoginTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
|
||||
*/
|
||||
public function testGetRegister($type, $message)
|
||||
{
|
||||
self::$DI['app']['registration.enabled'] = true;
|
||||
self::$DI['app']['authentication']->closeAccount();
|
||||
self::$DI['app']->addFlash($type, $message);
|
||||
$crawler = self::$DI['client']->request('GET', '/login/register-classic/');
|
||||
@@ -429,6 +441,7 @@ class LoginTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
|
||||
|
||||
public function testGetRegisterWithRegisterIdBindDataToForm()
|
||||
{
|
||||
self::$DI['app']['registration.enabled'] = true;
|
||||
self::$DI['app']['authentication']->closeAccount();
|
||||
|
||||
$provider = $this->getMock('Alchemy\Phrasea\Authentication\Provider\ProviderInterface');
|
||||
@@ -485,6 +498,7 @@ class LoginTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
|
||||
*/
|
||||
public function testPostRegisterbadArguments($parameters, $extraParameters, $errors)
|
||||
{
|
||||
self::$DI['app']['registration.enabled'] = true;
|
||||
self::$DI['app']['registration.fields'] = $extraParameters;
|
||||
|
||||
self::$DI['app']['authentication']->closeAccount();
|
||||
|
Reference in New Issue
Block a user