mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-18 07:23:13 +00:00
Fix story set metadata collection.
This commit is contained in:
@@ -49,8 +49,6 @@ class caption_record implements caption_interface, cache_cacheableInterface
|
|||||||
$this->sbas_id = $record->get_sbas_id();
|
$this->sbas_id = $record->get_sbas_id();
|
||||||
$this->record = $record;
|
$this->record = $record;
|
||||||
$this->databox = $databox;
|
$this->databox = $databox;
|
||||||
|
|
||||||
return $this;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function get_record()
|
public function get_record()
|
||||||
|
@@ -676,16 +676,14 @@ class record_adapter implements RecordInterface, cache_cacheableInterface
|
|||||||
$values = $field->get_values();
|
$values = $field->get_values();
|
||||||
$value = end($values);
|
$value = end($values);
|
||||||
|
|
||||||
$meta_struct_id = $field->get_meta_struct_id();
|
$this->set_metadatas([[
|
||||||
$meta_id = $value->getId();
|
'meta_struct_id' => $field->get_meta_struct_id(),
|
||||||
|
'meta_id' => $value->getId(),
|
||||||
|
'value' => $original_name,
|
||||||
|
]], true);
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
$meta_struct_id = null;
|
// Caption is not setup, ignore error
|
||||||
$meta_id = null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->set_metadatas([
|
|
||||||
['meta_struct_id' => $meta_struct_id, 'meta_id' => $meta_id, 'value' => $original_name],
|
|
||||||
], true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->get_databox()->get_connection()->executeUpdate(
|
$this->get_databox()->get_connection()->executeUpdate(
|
||||||
|
@@ -73,22 +73,25 @@ abstract class ApiTestCase extends \PhraseanetWebTestCase
|
|||||||
$this->setToken($this->userAccessToken);
|
$this->setToken($this->userAccessToken);
|
||||||
$route = '/api/v1/stories';
|
$route = '/api/v1/stories';
|
||||||
|
|
||||||
$story['base_id'] = self::$DI['collection']->get_base_id();
|
$collection = $this->getCollection();
|
||||||
|
$story['base_id'] = $collection->get_base_id();
|
||||||
$story['title'] = uniqid('story');
|
$story['title'] = uniqid('story');
|
||||||
|
|
||||||
|
$app = $this->getApplication();
|
||||||
$file = new File(
|
$file = new File(
|
||||||
self::$DI['app'],
|
$app,
|
||||||
self::$DI['app']['mediavorus']->guess(__DIR__ . '/../../../../../files/p4logo.jpg'),
|
$app['mediavorus']->guess(__DIR__ . '/../../../../../files/p4logo.jpg'),
|
||||||
self::$DI['collection']
|
$collection
|
||||||
);
|
);
|
||||||
$record = \record_adapter::createFromFile($file, self::$DI['app']);
|
$record = \record_adapter::createFromFile($file, $app);
|
||||||
|
|
||||||
$story['story_records'] = array(array(
|
$story['story_records'] = array(array(
|
||||||
'databox_id' => $record->get_sbas_id(),
|
'databox_id' => $record->get_sbas_id(),
|
||||||
'record_id' => $record->get_record_id()
|
'record_id' => $record->get_record_id()
|
||||||
));
|
));
|
||||||
|
|
||||||
self::$DI['client']->request(
|
$client = $this->getClient();
|
||||||
|
$client->request(
|
||||||
'POST',
|
'POST',
|
||||||
$route,
|
$route,
|
||||||
$this->getParameters(),
|
$this->getParameters(),
|
||||||
@@ -99,16 +102,16 @@ abstract class ApiTestCase extends \PhraseanetWebTestCase
|
|||||||
],
|
],
|
||||||
json_encode(array('stories' => array($story)))
|
json_encode(array('stories' => array($story)))
|
||||||
);
|
);
|
||||||
$content = $this->unserialize(self::$DI['client']->getResponse()->getContent());
|
$content = $this->unserialize($client->getResponse()->getContent());
|
||||||
|
|
||||||
$this->evaluateResponse200(self::$DI['client']->getResponse());
|
$this->evaluateResponse200($client->getResponse());
|
||||||
$this->evaluateMeta200($content);
|
$this->evaluateMeta200($content);
|
||||||
$data = $content['response'];
|
$data = $content['response'];
|
||||||
|
|
||||||
$this->assertArrayHasKey('stories', $data);
|
$this->assertArrayHasKey('stories', $data);
|
||||||
$this->assertCount(1, $data['stories']);
|
$this->assertCount(1, $data['stories']);
|
||||||
list($empty, $path, $databox_id, $story_id) = explode('/', current($data['stories']));
|
list($empty, $path, $databox_id, $story_id) = explode('/', current($data['stories']));
|
||||||
$databox = self::$DI['app']->findDataboxById($databox_id);
|
$databox = $app->findDataboxById($databox_id);
|
||||||
$story = $databox->get_record($story_id);
|
$story = $databox->get_record($story_id);
|
||||||
$story->delete();
|
$story->delete();
|
||||||
$record->delete();
|
$record->delete();
|
||||||
|
Reference in New Issue
Block a user