mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-16 22:43:19 +00:00
rename is_downloable to isDownloable
Change Functional to unit test
This commit is contained in:
@@ -309,7 +309,7 @@ class databox_subdef
|
|||||||
/**
|
/**
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function is_downloadable()
|
public function isDownloadable()
|
||||||
{
|
{
|
||||||
return $this->downloadable;
|
return $this->downloadable;
|
||||||
}
|
}
|
||||||
|
@@ -108,7 +108,7 @@ class patch_370alpha6a extends patchAbstract
|
|||||||
$options['meta'] = $subdef->isMetadataUpdateRequired() ? 'yes' : 'no';
|
$options['meta'] = $subdef->isMetadataUpdateRequired() ? 'yes' : 'no';
|
||||||
$options['devices'] = [databox_subdef::DEVICE_SCREEN];
|
$options['devices'] = [databox_subdef::DEVICE_SCREEN];
|
||||||
|
|
||||||
$root->set_subdef($groupname, $subdef->get_name(), $subdef->get_class(), $subdef->is_downloadable(), $options, []);
|
$root->set_subdef($groupname, $subdef->get_name(), $subdef->get_class(), $subdef->isDownloadable(), $options, []);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function addMobileSubdefVideo($root, $baseSubdef, $groupname)
|
protected function addMobileSubdefVideo($root, $baseSubdef, $groupname)
|
||||||
|
@@ -85,11 +85,10 @@ class record_exportElement extends record_adapter
|
|||||||
|
|
||||||
$sbas_id = phrasea::sbasFromBas($this->app, $this->get_base_id());
|
$sbas_id = phrasea::sbasFromBas($this->app, $this->get_base_id());
|
||||||
|
|
||||||
$subdefgroups = $this->app->findDataboxById($sbas_id)->get_subdef_structure();
|
/** @var databox_subdef[] $subdefs */
|
||||||
|
|
||||||
$subdefs = [];
|
$subdefs = [];
|
||||||
|
|
||||||
foreach ($subdefgroups as $subdef_type => $subdefs_obj) {
|
foreach ($this->app->findDataboxById($sbas_id)->get_subdef_structure() as $subdef_type => $subdefs_obj) {
|
||||||
if ($subdef_type == $this->get_type()) {
|
if ($subdef_type == $this->get_type()) {
|
||||||
$subdefs = $subdefs_obj;
|
$subdefs = $subdefs_obj;
|
||||||
break;
|
break;
|
||||||
@@ -173,7 +172,7 @@ class record_exportElement extends record_adapter
|
|||||||
|
|
||||||
$downloadable[$name] = false;
|
$downloadable[$name] = false;
|
||||||
|
|
||||||
$downloadable_settings = $subdef->is_downloadable();
|
$downloadable_settings = $subdef->isDownloadable();
|
||||||
|
|
||||||
if (! $downloadable_settings || $go_dl[$class] === false) {
|
if (! $downloadable_settings || $go_dl[$class] === false) {
|
||||||
continue;
|
continue;
|
||||||
|
@@ -227,7 +227,7 @@
|
|||||||
{% endfor %}
|
{% endfor %}
|
||||||
<tr>
|
<tr>
|
||||||
<td>{{ 'Telechargeable' | trans }}</td>
|
<td>{{ 'Telechargeable' | trans }}</td>
|
||||||
<td><input type="checkbox" name="{{subdefgroup}}_{{subdefname}}_downloadable" {% if subdef.is_downloadable() %}checked="checked"{% endif %} value="1" /></td>
|
<td><input type="checkbox" name="{{subdefgroup}}_{{subdefname}}_downloadable" {% if subdef.isDownloadable() %}checked="checked"{% endif %} value="1" /></td>
|
||||||
<td></td>
|
<td></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
|
@@ -94,8 +94,7 @@ class SubdefsTest extends \PhraseanetAuthenticatedWebTestCase
|
|||||||
$subdefs = new \databox_subdefsStructure($app->findDataboxById($this->databox_id), $app['translator']);
|
$subdefs = new \databox_subdefsStructure($app->findDataboxById($this->databox_id), $app['translator']);
|
||||||
$subdef = $subdefs->get_subdef("image", $name);
|
$subdef = $subdefs->get_subdef("image", $name);
|
||||||
|
|
||||||
/* @var $subdef \databox_subdef */
|
$this->assertFalse($subdef->isDownloadable());
|
||||||
$this->assertFalse($subdef->is_downloadable());
|
|
||||||
|
|
||||||
$options = $subdef->getOptions();
|
$options = $subdef->getOptions();
|
||||||
|
|
||||||
|
@@ -1,27 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
/**
|
class databox_subdefTest extends \PHPUnit_Framework_TestCase
|
||||||
* @group functional
|
|
||||||
* @group legacy
|
|
||||||
*/
|
|
||||||
class databox_subdefTest extends \PhraseanetTestCase
|
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
|
||||||
* @covers databox_subdef::__construct
|
|
||||||
* @covers databox_subdef::get_class
|
|
||||||
* @covers databox_subdef::get_name
|
|
||||||
* @covers databox_subdef::isMetadataUpdateRequired
|
|
||||||
* @covers databox_subdef::getAvailableSubdefTypes
|
|
||||||
* @covers databox_subdef::is_downloadable
|
|
||||||
* @covers databox_subdef::get_labels
|
|
||||||
* @covers databox_subdef::getSubdefGroup
|
|
||||||
* @covers databox_subdef::getSubdefType
|
|
||||||
* @covers databox_subdef::get_path
|
|
||||||
* @covers databox_subdef::getSpecs
|
|
||||||
* @covers databox_subdef::getOptions
|
|
||||||
* @covers databox_subdef::buildImageSubdef
|
|
||||||
*/
|
|
||||||
public function testImage()
|
public function testImage()
|
||||||
{
|
{
|
||||||
$xml = '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
$xml = '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||||
@@ -52,7 +32,7 @@ class databox_subdefTest extends \PhraseanetTestCase
|
|||||||
$this->assertArrayHasKey('en', $labels);
|
$this->assertArrayHasKey('en', $labels);
|
||||||
$this->assertEquals('Preview', $labels['en']);
|
$this->assertEquals('Preview', $labels['en']);
|
||||||
|
|
||||||
$this->assertTrue($object->is_downloadable());
|
$this->assertTrue($object->isDownloadable());
|
||||||
$this->assertTrue(is_array($object->getAvailableSubdefTypes()));
|
$this->assertTrue(is_array($object->getAvailableSubdefTypes()));
|
||||||
$this->assertTrue(count($object->getAvailableSubdefTypes()) > 0);
|
$this->assertTrue(count($object->getAvailableSubdefTypes()) > 0);
|
||||||
|
|
||||||
@@ -73,21 +53,6 @@ class databox_subdefTest extends \PhraseanetTestCase
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @covers databox_subdef::__construct
|
|
||||||
* @covers databox_subdef::get_class
|
|
||||||
* @covers databox_subdef::get_name
|
|
||||||
* @covers databox_subdef::isMetadataUpdateRequired
|
|
||||||
* @covers databox_subdef::getAvailableSubdefTypes
|
|
||||||
* @covers databox_subdef::is_downloadable
|
|
||||||
* @covers databox_subdef::get_labels
|
|
||||||
* @covers databox_subdef::getSubdefGroup
|
|
||||||
* @covers databox_subdef::getSubdefType
|
|
||||||
* @covers databox_subdef::get_path
|
|
||||||
* @covers databox_subdef::getSpecs
|
|
||||||
* @covers databox_subdef::getOptions
|
|
||||||
* @covers databox_subdef::buildVideoSubdef
|
|
||||||
*/
|
|
||||||
public function testVideo()
|
public function testVideo()
|
||||||
{
|
{
|
||||||
$xml = '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
$xml = '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||||
@@ -118,7 +83,7 @@ class databox_subdefTest extends \PhraseanetTestCase
|
|||||||
$this->assertTrue(is_array($labels));
|
$this->assertTrue(is_array($labels));
|
||||||
$this->assertEquals(0, count($labels));
|
$this->assertEquals(0, count($labels));
|
||||||
|
|
||||||
$this->assertFalse($object->is_downloadable());
|
$this->assertFalse($object->isDownloadable());
|
||||||
$this->assertTrue(is_array($object->getAvailableSubdefTypes()));
|
$this->assertTrue(is_array($object->getAvailableSubdefTypes()));
|
||||||
$this->assertTrue(count($object->getAvailableSubdefTypes()) > 0);
|
$this->assertTrue(count($object->getAvailableSubdefTypes()) > 0);
|
||||||
|
|
||||||
@@ -139,12 +104,6 @@ class databox_subdefTest extends \PhraseanetTestCase
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @covers databox_subdef::__construct
|
|
||||||
* @covers databox_subdef::getSpecs
|
|
||||||
* @covers databox_subdef::getOptions
|
|
||||||
* @covers databox_subdef::buildGifSubdef
|
|
||||||
*/
|
|
||||||
public function testGif()
|
public function testGif()
|
||||||
{
|
{
|
||||||
$xml = '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
$xml = '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||||
@@ -170,12 +129,6 @@ class databox_subdefTest extends \PhraseanetTestCase
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @covers databox_subdef::__construct
|
|
||||||
* @covers databox_subdef::getSpecs
|
|
||||||
* @covers databox_subdef::getOptions
|
|
||||||
* @covers databox_subdef::buildAudioSubdef
|
|
||||||
*/
|
|
||||||
public function testAudio()
|
public function testAudio()
|
||||||
{
|
{
|
||||||
$xml = '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
$xml = '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||||
@@ -197,12 +150,6 @@ class databox_subdefTest extends \PhraseanetTestCase
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @covers databox_subdef::__construct
|
|
||||||
* @covers databox_subdef::getSpecs
|
|
||||||
* @covers databox_subdef::getOptions
|
|
||||||
* @covers databox_subdef::buildFlexPaperSubdef
|
|
||||||
*/
|
|
||||||
public function testFlexPaper()
|
public function testFlexPaper()
|
||||||
{
|
{
|
||||||
$xml = '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
$xml = '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||||
@@ -226,11 +173,9 @@ class databox_subdefTest extends \PhraseanetTestCase
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @dataProvider getVariouasTypeAndSubdefs
|
* @dataProvider getVariouasTypeAndSubdefs
|
||||||
* @covers databox_subdef::getAvailableSubdefTypes
|
|
||||||
*/
|
*/
|
||||||
public function testGetAvailableSubdefTypes($object)
|
public function testGetAvailableSubdefTypes($object)
|
||||||
{
|
{
|
||||||
|
|
||||||
foreach ($object->getAvailableSubdefTypes() as $type) {
|
foreach ($object->getAvailableSubdefTypes() as $type) {
|
||||||
$this->assertInstanceOf('\\Alchemy\\Phrasea\\Media\\Subdef\\Subdef', $type);
|
$this->assertInstanceOf('\\Alchemy\\Phrasea\\Media\\Subdef\\Subdef', $type);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user