Implement save collection VO

This commit is contained in:
Thibaud Fabre
2015-07-10 17:32:09 +02:00
parent 616f57e8ed
commit 569c2ff6d8
12 changed files with 165 additions and 96 deletions

View File

@@ -9,6 +9,8 @@
*/ */
namespace Alchemy\Phrasea\Application\Helper; namespace Alchemy\Phrasea\Application\Helper;
use Alchemy\Phrasea\Collection\CollectionService;
trait ApplicationBoxAware trait ApplicationBoxAware
{ {
/** @var \appbox|callable */ /** @var \appbox|callable */
@@ -61,6 +63,14 @@ trait ApplicationBoxAware
return $this->applicationBox; return $this->applicationBox;
} }
/**
* @return CollectionService
*/
public function getCollectionService()
{
return $this['services.collection'];
}
/** /**
* Find a registered Databoxes. * Find a registered Databoxes.
* *

View File

@@ -3,6 +3,7 @@
namespace Alchemy\Phrasea\Collection; namespace Alchemy\Phrasea\Collection;
use Alchemy\Phrasea\Collection\Reference\CollectionReference; use Alchemy\Phrasea\Collection\Reference\CollectionReference;
use PHPExiftool\Exception\LogicException;
class Collection class Collection
{ {
@@ -64,6 +65,14 @@ class Collection
<sugestedValues></sugestedValues> <sugestedValues></sugestedValues>
</baseprefs> </baseprefs>
EOT; EOT;
$this->logo = '';
$this->labels = array(
'en' => '',
'fr' => '',
'de' => '',
'nl' => ''
);
$this->publicWatermark = '';
} }
/** /**
@@ -82,6 +91,18 @@ EOT;
return $this->collectionId; return $this->collectionId;
} }
/**
* @param $collectionId
*/
public function setCollectionId($collectionId)
{
if ($this->collectionId > 0) {
throw new LogicException('Cannot change the ID of an existing collection.');
}
$this->collectionId = (int) $collectionId;
}
/** /**
* @return string * @return string
*/ */

View File

@@ -33,7 +33,17 @@ class CollectionFactory
throw new \InvalidArgumentException('Reference does not belong to given databoxId.'); throw new \InvalidArgumentException('Reference does not belong to given databoxId.');
} }
return new \collection($this->app, $reference->getBaseId(), $reference, $row); $collection = new Collection($databoxId, $row['coll_id'], $row['asciiname']);
$collection->setLabel('en', $row['label_en']);
$collection->setLabel('fr', $row['label_fr']);
$collection->setLabel('de', $row['label_de']);
$collection->setLabel('nl', $row['label_nl']);
$collection->setLogo($row['logo']);
$collection->setPreferences($row['prefs']);
$collection->setPublicWatermark($row['pub_wm']);
return new \collection($this->app, $collection, $reference, $row);
} }
/** /**

View File

@@ -67,6 +67,11 @@ class CollectionRepositoryRegistry
throw new \OutOfBoundsException('No repository available for given base [baseId: ' . $baseId . ' ].'); throw new \OutOfBoundsException('No repository available for given base [baseId: ' . $baseId . ' ].');
} }
public function purgeRegistry()
{
$this->baseIdMap = null;
}
private function loadBaseIdMap() private function loadBaseIdMap()
{ {
$references = $this->referenceRepository->findAll(); $references = $this->referenceRepository->findAll();

View File

@@ -25,7 +25,7 @@ class DbalCollectionReferenceRepository implements CollectionReferenceRepository
private static $insertQuery = 'INSERT INTO bas (sbas_id, server_coll_id, ord, active, aliases) private static $insertQuery = 'INSERT INTO bas (sbas_id, server_coll_id, ord, active, aliases)
VALUES (:databoxId, :collectionId, VALUES (:databoxId, :collectionId,
(SELECT COALESCE(MAX(ord), 0) + 1 AS ord FROM bas WHERE sbas_id = :sbas_id), (SELECT COALESCE(MAX(b.ord), 0) + 1 AS ord FROM bas b WHERE b.sbas_id = :databoxId),
:isActive, :alias)'; :isActive, :alias)';
private static $updateQuery = 'UPDATE bas SET ord = :displayIndex, active = :isActive, aliases = :alias private static $updateQuery = 'UPDATE bas SET ord = :displayIndex, active = :isActive, aliases = :alias

View File

@@ -11,9 +11,15 @@ use Doctrine\DBAL\Connection;
class DbalCollectionRepository implements CollectionRepository class DbalCollectionRepository implements CollectionRepository
{ {
private static $query = 'SELECT coll_id, asciiname, label_en, label_fr, label_de, label_nl, prefs, logo, majLogo, pub_wm private static $selectQuery = 'SELECT coll_id, asciiname, label_en, label_fr, label_de, label_nl, prefs, logo, majLogo, pub_wm
FROM coll'; FROM coll';
private static $insertQuery = 'INSERT INTO coll (asciiname, prefs, logo) VALUES (:name, :preferences, :logo)';
private static $updateQuery = 'UPDATE coll SET asciiname = :name, label_en = :labelEn, label_fr = :labelFr,
label_de = :labelDe, label_nl = :labelNl, prefs = :preferences, logo = :logo,
majLogo = :logoTimestamp, pub_wm = :publicWatermark WHERE coll_id = :collectionId';
/** /**
* @var int * @var int
*/ */
@@ -64,7 +70,7 @@ class DbalCollectionRepository implements CollectionRepository
$params[':id_' . $reference->getCollectionId()] = $reference->getCollectionId(); $params[':id_' . $reference->getCollectionId()] = $reference->getCollectionId();
} }
$query = self::$query . sprintf(' WHERE coll_id IN (%s)', implode(', ', array_keys($params))); $query = self::$selectQuery . sprintf(' WHERE coll_id IN (%s)', implode(', ', array_keys($params)));
$rows = $this->connection->fetchAll($query, $params); $rows = $this->connection->fetchAll($query, $params);
return $this->collectionFactory->createMany($this->databoxId, $references, $rows); return $this->collectionFactory->createMany($this->databoxId, $references, $rows);
@@ -82,7 +88,7 @@ class DbalCollectionRepository implements CollectionRepository
return null; return null;
} }
$query = self::$query . ' WHERE coll_id = :collectionId'; $query = self::$selectQuery . ' WHERE coll_id = :collectionId';
$row = $this->connection->fetchAssoc($query, [ ':collectionId' => $reference->getCollectionId() ]); $row = $this->connection->fetchAssoc($query, [ ':collectionId' => $reference->getCollectionId() ]);
if ($row !== false) { if ($row !== false) {
@@ -105,7 +111,7 @@ class DbalCollectionRepository implements CollectionRepository
return null; return null;
} }
$query = self::$query . ' WHERE coll_id = :collectionId'; $query = self::$selectQuery . ' WHERE coll_id = :collectionId';
$row = $this->connection->fetchAssoc($query, [ ':collectionId' => $reference->getCollectionId() ]); $row = $this->connection->fetchAssoc($query, [ ':collectionId' => $reference->getCollectionId() ]);
if ($row !== false) { if ($row !== false) {
@@ -117,6 +123,31 @@ class DbalCollectionRepository implements CollectionRepository
public function save(Collection $collection) public function save(Collection $collection)
{ {
$isInsert = true;
$query = self::$insertQuery;
$parameters = array(
'name' => $collection->getName(),
'preferences' => $collection->getPreferences(),
'logo' => $collection->getLogo()
);
if ($collection->getCollectionId() > 0) {
$parameters['collectionId'] = $collection->getCollectionId();
$parameters['labelEn'] = $collection->getLabel('en', false);
$parameters['labelFr'] = $collection->getLabel('fr', false);
$parameters['labelDe'] = $collection->getLabel('de', false);
$parameters['labelNl'] = $collection->getLabel('nl', false);
$parameters['logoTimestamp'] = $collection->getLogoUpdatedAt();
$parameters['publicWatermark'] = $collection->getPublicWatermark();
$query = self::$updateQuery;
$isInsert = false;
}
$this->connection->executeQuery($query, $parameters);
if ($isInsert) {
$collection->setCollectionId($this->connection->lastInsertId());
}
} }
} }

View File

@@ -474,7 +474,7 @@ class CollectionController extends Controller
if ($collection->get_record_amount() > 0) { if ($collection->get_record_amount() > 0) {
$msg = $this->app->trans('Empty the collection before removing'); $msg = $this->app->trans('Empty the collection before removing');
} else { } else {
$collection->unmount_collection($this->app); $collection->unmount();
$collection->delete(); $collection->delete();
$success = true; $success = true;
$msg = $this->app->trans('Successful removal'); $msg = $this->app->trans('Successful removal');
@@ -525,7 +525,7 @@ class CollectionController extends Controller
$collection = \collection::getByBaseId($this->app, $bas_id); $collection = \collection::getByBaseId($this->app, $bas_id);
try { try {
$collection->unmount_collection($this->app); $collection->unmount();
$success = true; $success = true;
} catch (\Exception $e) { } catch (\Exception $e) {

View File

@@ -10,9 +10,11 @@
*/ */
use Alchemy\Phrasea\Application; use Alchemy\Phrasea\Application;
use Alchemy\Phrasea\Collection\CollectionService;
use Alchemy\Phrasea\Core\Configuration\AccessRestriction; use Alchemy\Phrasea\Core\Configuration\AccessRestriction;
use Alchemy\Phrasea\Core\Connection\ConnectionSettings; use Alchemy\Phrasea\Core\Connection\ConnectionSettings;
use Alchemy\Phrasea\Core\Version\AppboxVersionRepository; use Alchemy\Phrasea\Core\Version\AppboxVersionRepository;
use Alchemy\Phrasea\Databox\DataboxConnectionProvider;
use Alchemy\Phrasea\Databox\DataboxRepository; use Alchemy\Phrasea\Databox\DataboxRepository;
use Doctrine\ORM\Tools\SchemaTool; use Doctrine\ORM\Tools\SchemaTool;
use MediaAlchemyst\Alchemyst; use MediaAlchemyst\Alchemyst;
@@ -41,6 +43,10 @@ class appbox extends base
* @var \databox[] * @var \databox[]
*/ */
protected $databoxes; protected $databoxes;
/**
* @var CollectionService
*/
protected $collectionService;
public function __construct(Application $app) public function __construct(Application $app)
{ {
@@ -289,6 +295,19 @@ class appbox extends base
parent::delete_data_from_cache($option); parent::delete_data_from_cache($option);
} }
public function getCollectionService()
{
if ($this->collectionService === null) {
$this->collectionService = new CollectionService(
$this->app,
$this->connection,
new DataboxConnectionProvider($this)
);
}
return $this->collectionService;
}
/** /**
* @return AccessRestriction * @return AccessRestriction
*/ */

View File

@@ -25,7 +25,7 @@ use Alchemy\Phrasea\Core\Thumbnail\ThumbnailManager;
use Alchemy\Phrasea\Model\Entities\User; use Alchemy\Phrasea\Model\Entities\User;
use Symfony\Component\HttpFoundation\File\File; use Symfony\Component\HttpFoundation\File\File;
class collection implements cache_cacheableInterface, ThumbnailedElement class collection implements ThumbnailedElement
{ {
const PIC_LOGO = 'minilogos'; const PIC_LOGO = 'minilogos';
@@ -66,13 +66,12 @@ class collection implements cache_cacheableInterface, ThumbnailedElement
$repository->save($collectionReference); $repository->save($collectionReference);
$databox->delete_data_from_cache(databox::CACHE_COLLECTIONS); $app['repo.collections-registry']->purgeRegistry();
$appbox->delete_data_from_cache(appbox::CACHE_LIST_BASES);
phrasea::reset_baseDatas($appbox); $collection = new self($app, $collection, $collectionReference);
if (null !== $user) { if (null !== $user) {
$collection->set_admin($collectionReference->getBaseId(), $user); $collection->collectionService->grantAdminRights($collectionReference, $user);
} }
$app['dispatcher']->dispatch(CollectionEvents::CREATED, new CreatedEvent($collection)); $app['dispatcher']->dispatch(CollectionEvents::CREATED, new CreatedEvent($collection));
@@ -85,16 +84,10 @@ class collection implements cache_cacheableInterface, ThumbnailedElement
$reference = new CollectionReference(0, $databox->get_sbas_id(), $coll_id, 0, true, ''); $reference = new CollectionReference(0, $databox->get_sbas_id(), $coll_id, 0, true, '');
$app['repo.collection-references']->save($reference); $app['repo.collection-references']->save($reference);
$app['repo.collections-registry']->purgeRegistry();
$databox->get_appbox()->delete_data_from_cache(appbox::CACHE_LIST_BASES); $collection = self::getByBaseId($app, $reference->getBaseId());
$databox->delete_data_from_cache(databox::CACHE_COLLECTIONS); $collection->collectionService->grantAdminRights($collection->reference, $user);
cache_databox::update($app, $databox->get_sbas_id(), 'structure');
phrasea::reset_baseDatas($databox->get_appbox());
$coll = self::getByBaseId($app, $reference->getBaseId());
$coll->set_admin($reference->getBaseId(), $user);
return $reference->getBaseId(); return $reference->getBaseId();
} }
@@ -121,9 +114,10 @@ class collection implements cache_cacheableInterface, ThumbnailedElement
{ {
if (!isset(self::$_watermarks['base_id'])) { if (!isset(self::$_watermarks['base_id'])) {
if (is_file(__DIR__ . '/../../config/wm/' . $base_id)) if (is_file(__DIR__ . '/../../config/wm/' . $base_id)) {
self::$_watermarks['base_id'] = '<img src="/custom/wm/' . $base_id . '" />'; self::$_watermarks['base_id'] = '<img src="/custom/wm/' . $base_id . '" />';
} }
}
return isset(self::$_watermarks['base_id']) ? self::$_watermarks['base_id'] : ''; return isset(self::$_watermarks['base_id']) ? self::$_watermarks['base_id'] : '';
} }
@@ -132,9 +126,10 @@ class collection implements cache_cacheableInterface, ThumbnailedElement
{ {
if (!isset(self::$_presentations['base_id'])) { if (!isset(self::$_presentations['base_id'])) {
if (is_file(__DIR__ . '/../../config/presentation/' . $base_id)) if (is_file(__DIR__ . '/../../config/presentation/' . $base_id)) {
self::$_presentations['base_id'] = '<img src="/custom/presentation/' . $base_id . '" />'; self::$_presentations['base_id'] = '<img src="/custom/presentation/' . $base_id . '" />';
} }
}
return isset(self::$_presentations['base_id']) ? self::$_presentations['base_id'] : ''; return isset(self::$_presentations['base_id']) ? self::$_presentations['base_id'] : '';
} }
@@ -143,9 +138,10 @@ class collection implements cache_cacheableInterface, ThumbnailedElement
{ {
if (!isset(self::$_stamps['base_id'])) { if (!isset(self::$_stamps['base_id'])) {
if (is_file(__DIR__ . '/../../config/stamp/' . $base_id)) if (is_file(__DIR__ . '/../../config/stamp/' . $base_id)) {
self::$_stamps['base_id'] = '<img src="/custom/stamp/' . $base_id . '" />'; self::$_stamps['base_id'] = '<img src="/custom/stamp/' . $base_id . '" />';
} }
}
return isset(self::$_stamps['base_id']) ? self::$_stamps['base_id'] : ''; return isset(self::$_stamps['base_id']) ? self::$_stamps['base_id'] : '';
} }
@@ -260,8 +256,9 @@ class collection implements cache_cacheableInterface, ThumbnailedElement
{ {
$this->app = $app; $this->app = $app;
$this->databox = $app->getApplicationBox()->get_databox($reference->getDataboxId()); $this->databox = $app->getApplicationBox()->get_databox($reference->getDataboxId());
$this->collectionService = $app->getApplicationBox()->getCollectionService();
$this->collection = $collection; $this->collectionVO = $collection;
$this->reference = $reference; $this->reference = $reference;
} }
@@ -294,12 +291,13 @@ class collection implements cache_cacheableInterface, ThumbnailedElement
{ {
$this->app = $app; $this->app = $app;
$this->databox = $app->getApplicationBox()->get_databox($this->reference->getDataboxId()); $this->databox = $app->getApplicationBox()->get_databox($this->reference->getDataboxId());
$this->collectionService = $app->getApplicationBox()->getCollectionService();
} }
public function __sleep() public function __sleep()
{ {
return array( return array(
'collection', 'collectionVO',
'reference' 'reference'
); );
} }
@@ -345,6 +343,7 @@ class collection implements cache_cacheableInterface, ThumbnailedElement
{ {
$this->collectionVO->setPublicWatermark($publi); $this->collectionVO->setPublicWatermark($publi);
$this->getCollectionRepository()->save($this->collectionVO); $this->getCollectionRepository()->save($this->collectionVO);
$this->app['repo.collections-registry']->purgeRegistry();
return $this; return $this;
} }
@@ -358,12 +357,13 @@ class collection implements cache_cacheableInterface, ThumbnailedElement
{ {
try { try {
$this->collectionVO->setName($name); $this->collectionVO->setName($name);
} } catch (\InvalidArgumentException $e) {
catch (\InvalidArgumentException $e) {
throw new Exception_InvalidArgument(); throw new Exception_InvalidArgument();
} }
$this->getCollectionRepository()->save($this->collectionVO); $this->getCollectionRepository()->save($this->collectionVO);
$this->app['repo.collections-registry']->purgeRegistry();
$this->dispatch(CollectionEvents::NAME_CHANGED, new NameChangedEvent($this)); $this->dispatch(CollectionEvents::NAME_CHANGED, new NameChangedEvent($this));
return $this; return $this;
@@ -377,7 +377,9 @@ class collection implements cache_cacheableInterface, ThumbnailedElement
public function set_label($code, $label) public function set_label($code, $label)
{ {
$this->collectionVO->setLabel($code, $label); $this->collectionVO->setLabel($code, $label);
$this->getCollectionRepository()->save($this->collectionVO); $this->getCollectionRepository()->save($this->collectionVO);
$this->app['repo.collections-registry']->purgeRegistry();
return $this; return $this;
} }
@@ -407,7 +409,9 @@ class collection implements cache_cacheableInterface, ThumbnailedElement
public function set_ord($ord) public function set_ord($ord)
{ {
$this->reference->setDisplayIndex($ord); $this->reference->setDisplayIndex($ord);
$this->getReferenceRepository()->save($this->reference); $this->getReferenceRepository()->save($this->reference);
$this->app['repo.collections-registry']->purgeRegistry();
return $this; return $this;
} }
@@ -459,7 +463,9 @@ class collection implements cache_cacheableInterface, ThumbnailedElement
public function set_prefs(DOMDocument $dom) public function set_prefs(DOMDocument $dom)
{ {
$this->collectionVO->setPreferences($dom->saveXML()); $this->collectionVO->setPreferences($dom->saveXML());
$this->getCollectionRepository()->save($this->collectionVO); $this->getCollectionRepository()->save($this->collectionVO);
$this->app['repo.collections-registry']->purgeRegistry();
return $this->collectionVO->getPreferences(); return $this->collectionVO->getPreferences();
} }
@@ -502,7 +508,9 @@ class collection implements cache_cacheableInterface, ThumbnailedElement
public function disable() public function disable()
{ {
$this->reference->disable(); $this->reference->disable();
$this->getReferenceRepository()->save($this->reference); $this->getReferenceRepository()->save($this->reference);
$this->app['repo.collections-registry']->purgeRegistry();
cache_databox::update($this->app, $this->databox->get_sbas_id(), 'structure'); cache_databox::update($this->app, $this->databox->get_sbas_id(), 'structure');
@@ -515,7 +523,9 @@ class collection implements cache_cacheableInterface, ThumbnailedElement
public function enable() public function enable()
{ {
$this->reference->enable(); $this->reference->enable();
$this->getReferenceRepository()->save($this->reference); $this->getReferenceRepository()->save($this->reference);
$this->app['repo.collections-registry']->purgeRegistry();
cache_databox::update($this->app, $this->databox->get_sbas_id(), 'structure'); cache_databox::update($this->app, $this->databox->get_sbas_id(), 'structure');
@@ -588,7 +598,9 @@ class collection implements cache_cacheableInterface, ThumbnailedElement
} }
$this->collectionVO->setLogo($fileContents); $this->collectionVO->setLogo($fileContents);
$this->getCollectionRepository()->save($this->collectionVO); $this->getCollectionRepository()->save($this->collectionVO);
$this->app['repo.collections-registry']->purgeRegistry();
return $this; return $this;
} }
@@ -601,6 +613,9 @@ class collection implements cache_cacheableInterface, ThumbnailedElement
{ {
$this->collectionService->resetWatermark($this->collectionVO); $this->collectionService->resetWatermark($this->collectionVO);
$this->getCollectionRepository()->save($this->collectionVO);
$this->app['repo.collections-registry']->purgeRegistry();
return $this; return $this;
} }
@@ -613,6 +628,9 @@ class collection implements cache_cacheableInterface, ThumbnailedElement
{ {
$this->collectionService->resetStamp($this->collectionVO, $record_id); $this->collectionService->resetStamp($this->collectionVO, $record_id);
$this->getCollectionRepository()->save($this->collectionVO);
$this->app['repo.collections-registry']->purgeRegistry();
return $this; return $this;
} }
@@ -622,70 +640,25 @@ class collection implements cache_cacheableInterface, ThumbnailedElement
public function delete() public function delete()
{ {
$this->collectionService->delete($this->databox, $this->collectionVO, $this->reference); $this->collectionService->delete($this->databox, $this->collectionVO, $this->reference);
$this->getCollectionRepository()->delete($this->collectionVO);
$this->app['repo.collections-registry']->purgeRegistry();
} }
/** /**
* @param Application $app
* @return $this * @return $this
* @throws \Doctrine\DBAL\DBALException * @throws \Doctrine\DBAL\DBALException
*/ */
public function unmount_collection(Application $app) public function unmount()
{ {
$this->collectionService->unmountCollection($this->reference); $this->collectionService->unmountCollection($this->reference);
$this->getReferenceRepository()->delete($this->reference);
$this->app['repo.collections-registry']->purgeRegistry();
return $this; return $this;
} }
/**
* @param $base_id
* @param User $user
* @return bool
*/
public function set_admin($base_id, User $user)
{
$this->collectionService->grantAdminRights($this->reference, $user);
return true;
}
/**
* @param null $option
* @return string
*/
public function get_cache_key($option = null)
{
return 'collection_' . $this->get_coll_id() . ($option ? '_' . $option : '');
}
/**
* @param null $option
* @return string
*/
public function get_data_from_cache($option = null)
{
return $this->databox->get_data_from_cache($this->get_cache_key($option));
}
/**
* @param $value
* @param null $option
* @param int $duration
* @return bool
*/
public function set_data_to_cache($value, $option = null, $duration = 0)
{
return $this->databox->set_data_to_cache($value, $this->get_cache_key($option), $duration);
}
/**
* @param null $option
*/
public function delete_data_from_cache($option = null)
{
$this->getCollectionRepository()->save($this->collectionVO);
$this->databox->delete_data_from_cache($this->get_cache_key($option));
}
/** /**
* Tells whether registration is activated for provided collection or not. * Tells whether registration is activated for provided collection or not.
* *

View File

@@ -380,7 +380,7 @@ class databox extends base implements \Alchemy\Phrasea\Core\Thumbnail\Thumbnaile
public function unmount_databox() public function unmount_databox()
{ {
foreach ($this->get_collections() as $collection) { foreach ($this->get_collections() as $collection) {
$collection->unmount_collection($this->app); $collection->unmount();
} }
$query = $this->app['phraseanet.user-query']; $query = $this->app['phraseanet.user-query'];

View File

@@ -30,7 +30,7 @@ class AdminCollectionTest extends \PhraseanetAuthenticatedWebTestCase
self::$DI['app']['acl'] = new ACLProvider(self::$DI['app']); self::$DI['app']['acl'] = new ACLProvider(self::$DI['app']);
foreach (self::$createdCollections as $collection) { foreach (self::$createdCollections as $collection) {
try { try {
$collection->unmount_collection(self::$DI['app']); $collection->unmount();
} catch (\Exception $e) { } catch (\Exception $e) {
} }
@@ -440,7 +440,7 @@ class AdminCollectionTest extends \PhraseanetAuthenticatedWebTestCase
$json = $this->getJson(self::$DI['client']->getResponse()); $json = $this->getJson(self::$DI['client']->getResponse());
$this->assertTrue($json->success); $this->assertTrue($json->success);
$this->assertEquals($collection->get_name(), 'test_rename_coll'); $this->assertEquals($collection->get_name(), 'test_rename_coll');
$collection->unmount_collection(self::$DI['app']); $collection->unmount();
$collection->delete(); $collection->delete();
} }
@@ -469,7 +469,7 @@ class AdminCollectionTest extends \PhraseanetAuthenticatedWebTestCase
$this->assertEquals($collection->get_label('nl'), 'netherlands label'); $this->assertEquals($collection->get_label('nl'), 'netherlands label');
$this->assertEquals($collection->get_label('fr'), 'label français'); $this->assertEquals($collection->get_label('fr'), 'label français');
$this->assertEquals($collection->get_label('en'), 'label à l\'anglaise'); $this->assertEquals($collection->get_label('en'), 'label à l\'anglaise');
$collection->unmount_collection(self::$DI['app']); $collection->unmount();
$collection->delete(); $collection->delete();
} }

View File

@@ -34,7 +34,7 @@ class DataboxTest extends \PhraseanetAuthenticatedWebTestCase
foreach (self::$createdCollections as $collection) { foreach (self::$createdCollections as $collection) {
try { try {
$collection->unmount_collection(self::$DI['app']); $collection->unmount();
} catch (\Exception $e) { } catch (\Exception $e) {
} }
@@ -515,7 +515,7 @@ class DataboxTest extends \PhraseanetAuthenticatedWebTestCase
$this->setAdmin(true); $this->setAdmin(true);
$collection = $this->createOneCollection(); $collection = $this->createOneCollection();
$collection->unmount_collection(self::$DI['app']); $collection->unmount();
self::$DI['client']->request('POST', '/admin/databox/' . $collection->get_sbas_id() . '/collection/' . $collection->get_coll_id() . '/mount/', [ self::$DI['client']->request('POST', '/admin/databox/' . $collection->get_sbas_id() . '/collection/' . $collection->get_coll_id() . '/mount/', [
'othcollsel' => self::$DI['collection']->get_base_id() 'othcollsel' => self::$DI['collection']->get_base_id()