PHPCS fixing

This commit is contained in:
Benoît Burnichon
2016-03-29 16:48:53 +02:00
parent cdd37110bb
commit d33a1d0dcc
2 changed files with 33 additions and 26 deletions

View File

@@ -21,10 +21,6 @@ use Alchemy\Phrasea\Core\Event\Record\RecordEvents;
use Alchemy\Phrasea\Core\Event\Record\StatusChangedEvent; use Alchemy\Phrasea\Core\Event\Record\StatusChangedEvent;
use Alchemy\Phrasea\Core\PhraseaTokens; use Alchemy\Phrasea\Core\PhraseaTokens;
use Alchemy\Phrasea\Filesystem\FilesystemService; use Alchemy\Phrasea\Filesystem\FilesystemService;
use Alchemy\Phrasea\Media\ArrayTechnicalDataSet;
use Alchemy\Phrasea\Media\FloatTechnicalData;
use Alchemy\Phrasea\Media\IntegerTechnicalData;
use Alchemy\Phrasea\Media\StringTechnicalData;
use Alchemy\Phrasea\Media\TechnicalData; use Alchemy\Phrasea\Media\TechnicalData;
use Alchemy\Phrasea\Media\TechnicalDataSet; use Alchemy\Phrasea\Media\TechnicalDataSet;
use Alchemy\Phrasea\Metadata\Tag\TfBasename; use Alchemy\Phrasea\Metadata\Tag\TfBasename;
@@ -1375,8 +1371,9 @@ class record_adapter implements RecordInterface, cache_cacheableInterface
$ftodel = []; $ftodel = [];
foreach ($this->get_subdefs() as $subdef) { foreach ($this->get_subdefs() as $subdef) {
if (!$subdef->is_physically_present()) if (!$subdef->is_physically_present()) {
continue; continue;
}
if ($subdef->get_name() === 'thumbnail') { if ($subdef->get_name() === 'thumbnail') {
$this->app['phraseanet.thumb-symlinker']->unlink($subdef->getRealPath()); $this->app['phraseanet.thumb-symlinker']->unlink($subdef->getRealPath());
@@ -1384,12 +1381,14 @@ class record_adapter implements RecordInterface, cache_cacheableInterface
$ftodel[] = $subdef->getRealPath(); $ftodel[] = $subdef->getRealPath();
$watermark = $subdef->getWatermarkRealPath(); $watermark = $subdef->getWatermarkRealPath();
if (file_exists($watermark)) if (file_exists($watermark)) {
$ftodel[] = $watermark; $ftodel[] = $watermark;
}
$stamp = $subdef->getStampRealPath(); $stamp = $subdef->getStampRealPath();
if (file_exists($stamp)) if (file_exists($stamp)) {
$ftodel[] = $stamp; $ftodel[] = $stamp;
} }
}
$origcoll = $this->collection_id; $origcoll = $this->collection_id;
@@ -1518,16 +1517,16 @@ class record_adapter implements RecordInterface, cache_cacheableInterface
public function delete_data_from_cache($option = null) public function delete_data_from_cache($option = null)
{ {
switch ($option) { switch ($option)
{
case self::CACHE_STATUS: case self::CACHE_STATUS:
$this->status = null; $this->status = null;
break; break;
case self::CACHE_SUBDEFS: case self::CACHE_SUBDEFS:
$this->subdefs = null; $this->subdefs = null;
break; break;
default:
break;
} }
$databox = $this->getDatabox(); $databox = $this->getDatabox();
$databox->delete_data_from_cache($this->get_cache_key($option)); $databox->delete_data_from_cache($this->get_cache_key($option));
@@ -1558,7 +1557,7 @@ class record_adapter implements RecordInterface, cache_cacheableInterface
/** /**
* @todo de meme avec stories * @todo de meme avec stories
* @return Array * @return \Alchemy\Phrasea\Model\Entities\Basket[]
*/ */
public function get_container_baskets(EntityManager $em, User $user) public function get_container_baskets(EntityManager $em, User $user)
{ {

View File

@@ -29,22 +29,30 @@ class ACLTest extends \PhraseanetTestCase
$this->assertTrue($this->object->has_status_access_to_record(self::$DI['record_1'])); $this->assertTrue($this->object->has_status_access_to_record(self::$DI['record_1']));
} }
public function testHasAccesToRecordStatus() public function testHasAccessToRecordStatus()
{ {
self::$DI['record_1']->set_binary_status(str_repeat('0', 32)); $record1 = $this->getRecord1();
$this->object->set_masks_on_base(self::$DI['record_1']->get_base_id(), '10000', '10000', '0', '0');
self::$DI['record_1']->set_binary_status('10000'); $record1->set_binary_status(str_repeat('0', 32));
$this->assertFalse($this->object->has_status_access_to_record(self::$DI['record_1'])); $this->object->set_masks_on_base($record1->getBaseId(), '10000', '10000', '0', '0');
self::$DI['record_1']->set_binary_status('00000');
$this->assertTrue($this->object->has_status_access_to_record(self::$DI['record_1'])); $record1->set_binary_status('10000');
$this->object->set_masks_on_base(self::$DI['record_1']->get_base_id(), '10000', '10000', '10000', '10000'); $this->assertFalse($this->object->has_status_access_to_record($record1));
$this->assertFalse($this->object->has_status_access_to_record(self::$DI['record_1']));
self::$DI['record_1']->set_binary_status('10000'); $record1->set_binary_status('00000');
$this->assertTrue($this->object->has_status_access_to_record(self::$DI['record_1'])); $this->assertTrue($this->object->has_status_access_to_record($record1));
$this->object->set_masks_on_base(self::$DI['record_1']->get_base_id(), '0', '0', '0', '0');
$this->assertTrue($this->object->has_status_access_to_record(self::$DI['record_1'])); $this->object->set_masks_on_base($record1->getBaseId(), '10000', '10000', '10000', '10000');
self::$DI['record_1']->set_binary_status(str_repeat('0', 32)); $this->assertFalse($this->object->has_status_access_to_record($record1));
$this->assertTrue($this->object->has_status_access_to_record(self::$DI['record_1']));
$record1->set_binary_status('10000');
$this->assertTrue($this->object->has_status_access_to_record($record1));
$this->object->set_masks_on_base($record1->getBaseId(), '0', '0', '0', '0');
$this->assertTrue($this->object->has_status_access_to_record($record1));
$record1->set_binary_status(str_repeat('0', 32));
$this->assertTrue($this->object->has_status_access_to_record($record1));
} }
public function testHasAccesToRecordFailsOnBase() public function testHasAccesToRecordFailsOnBase()