mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-14 13:33:14 +00:00
Fix failing tests
- SQL query error - Reload updated collections in tests (error in test logic)
This commit is contained in:
@@ -333,7 +333,7 @@ class RegistrationService
|
||||
return;
|
||||
}
|
||||
|
||||
$collection = \collection::get_from_base_id($this->app, $baseId);
|
||||
$collection = \collection::getByBaseId($this->app, $baseId);
|
||||
$registrationManipulator->createRegistration($user, $collection);
|
||||
$successfulRegistrations[$baseId] = $collection;
|
||||
});
|
||||
|
@@ -66,14 +66,22 @@ class DbalCollectionRepository implements CollectionRepository
|
||||
public function findAll()
|
||||
{
|
||||
$references = $this->referenceRepository->findAllByDatabox($this->databoxId);
|
||||
$params = [];
|
||||
|
||||
foreach ($references as $reference) {
|
||||
$params[':id_' . $reference->getCollectionId()] = $reference->getCollectionId();
|
||||
if (empty($references)) {
|
||||
return [];
|
||||
}
|
||||
|
||||
$query = self::$selectQuery . sprintf(' WHERE coll_id IN (%s)', implode(', ', array_keys($params)));
|
||||
$rows = $this->connection->fetchAll($query, $params);
|
||||
$parameters = [];
|
||||
|
||||
foreach ($references as $reference) {
|
||||
$parameters[] = $reference->getCollectionId();
|
||||
}
|
||||
|
||||
$query = self::$selectQuery . ' WHERE coll_id IN (:collectionIds)';
|
||||
$parameters = [ 'collectionIds' => $parameters ];
|
||||
$parameterTypes = [ 'collectionIds' => Connection::PARAM_INT_ARRAY ];
|
||||
|
||||
$rows = $this->connection->fetchAll($query, $parameters, $parameterTypes);
|
||||
|
||||
return $this->collectionFactory->createMany($this->databoxId, $references, $rows);
|
||||
}
|
||||
|
@@ -439,7 +439,13 @@ class AdminCollectionTest extends \PhraseanetAuthenticatedWebTestCase
|
||||
|
||||
$json = $this->getJson(self::$DI['client']->getResponse());
|
||||
$this->assertTrue($json->success);
|
||||
|
||||
// Collection has to be reloaded since it was modified outside of the current process
|
||||
$databox = $this->getApplication()->findDataboxById($collection->get_sbas_id());
|
||||
$collection = \collection::getByCollectionId($this->getApplication(), $databox, $collection->get_coll_id());
|
||||
|
||||
$this->assertEquals($collection->get_name(), 'test_rename_coll');
|
||||
|
||||
$collection->unmount();
|
||||
$collection->delete();
|
||||
}
|
||||
@@ -465,6 +471,10 @@ class AdminCollectionTest extends \PhraseanetAuthenticatedWebTestCase
|
||||
|
||||
$json = $this->getJson(self::$DI['client']->getResponse());
|
||||
$this->assertTrue($json->success);
|
||||
|
||||
$databox = $this->getApplication()->findDataboxById($collection->get_sbas_id());
|
||||
$collection = \collection::getByCollectionId($this->getApplication(), $databox, $collection->get_coll_id());
|
||||
|
||||
$this->assertEquals($collection->get_label('de'), 'german label');
|
||||
$this->assertEquals($collection->get_label('nl'), 'netherlands label');
|
||||
$this->assertEquals($collection->get_label('fr'), 'label français');
|
||||
|
@@ -173,6 +173,7 @@ class UploadTest extends \PhraseanetAuthenticatedWebTestCase
|
||||
)
|
||||
]
|
||||
];
|
||||
|
||||
self::$DI['app']['border-manager']->registerChecker(new Sha256(self::$DI['app']));
|
||||
self::$DI['client']->request('POST', '/prod/upload/', $params, $files, ['HTTP_Accept' => 'application/json']);
|
||||
|
||||
|
Reference in New Issue
Block a user