mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-15 05:53:13 +00:00
set_original_name wasn't working as expected. Added test.
This commit is contained in:
@@ -89,7 +89,7 @@ class databox_descriptionStructure implements IteratorAggregate, Countable
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @param string $name
|
* @param string $name
|
||||||
* @return databox_field
|
* @return databox_field|null
|
||||||
*/
|
*/
|
||||||
public function get_element_by_name($name)
|
public function get_element_by_name($name)
|
||||||
{
|
{
|
||||||
|
@@ -667,7 +667,7 @@ class record_adapter implements RecordInterface, cache_cacheableInterface
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Replacing original name in multi values is non sense
|
// Replacing original name in multi values is non sense
|
||||||
if (!$data_field->is_multi()) {
|
if ($data_field->is_multi()) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -684,9 +684,7 @@ class record_adapter implements RecordInterface, cache_cacheableInterface
|
|||||||
}
|
}
|
||||||
|
|
||||||
$this->set_metadatas([
|
$this->set_metadatas([
|
||||||
'meta_struct_id' => $meta_struct_id,
|
['meta_struct_id' => $meta_struct_id, 'meta_id' => $meta_id, 'value' => $original_name],
|
||||||
'meta_id' => $meta_id,
|
|
||||||
'value' => $original_name,
|
|
||||||
], true);
|
], true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -264,6 +264,24 @@ class record_adapterTest extends \PhraseanetAuthenticatedTestCase
|
|||||||
$this->assertEquals('test001.jpg', $this->getRecord1()->get_original_name());
|
$this->assertEquals('test001.jpg', $this->getRecord1()->get_original_name());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function testSetOriginalName()
|
||||||
|
{
|
||||||
|
$record_1 = $this->getRecord1();
|
||||||
|
$originalName = $record_1->get_original_name();
|
||||||
|
|
||||||
|
$record_1->set_original_name('test001-renamed.jpg');
|
||||||
|
|
||||||
|
$this->assertEquals('test001-renamed.jpg', $record_1->get_original_name());
|
||||||
|
|
||||||
|
$values = $record_1->get_caption()->get_field('FileName')->get_values();
|
||||||
|
$this->assertCount(1, $values);
|
||||||
|
foreach ($values as $value) {
|
||||||
|
$this->assertEquals('test001-renamed.jpg', $value->getValue());
|
||||||
|
}
|
||||||
|
|
||||||
|
$record_1->set_original_name($originalName);
|
||||||
|
}
|
||||||
|
|
||||||
public function testGet_title()
|
public function testGet_title()
|
||||||
{
|
{
|
||||||
$this->markTestSkipped('Unable to test title');
|
$this->markTestSkipped('Unable to test title');
|
||||||
|
Reference in New Issue
Block a user