Use short array declaration

This commit is contained in:
Romain Neutron
2013-11-18 11:58:12 +01:00
parent 2898b317c4
commit 56b373ee6e
723 changed files with 8350 additions and 8352 deletions

View File

@@ -62,7 +62,7 @@ class FactoryTest extends \PhraseanetPHPUnitAbstract
$this->markTestSkipped('No databox field found');
}
$metafield = new MetaField($databox_field, array('value'));
$metafield = new MetaField($databox_field, ['value']);
$attribute = Factory::getFileAttribute(self::$DI['app'], AttributeInterface::NAME_METAFIELD, $metafield->asString());

View File

@@ -29,7 +29,7 @@ class MetaFieldTest extends \PhraseanetPHPUnitAbstract
*/
public function setUp()
{
$this->value = array("Un éléphant ça trompe");
$this->value = ["Un éléphant ça trompe"];
foreach (self::$DI['collection']->get_databox()->get_meta_structure() as $databox_field) {
$this->databox_field = $databox_field;
break;
@@ -58,8 +58,8 @@ class MetaFieldTest extends \PhraseanetPHPUnitAbstract
*/
public function testConstruct()
{
new MetaField($this->databox_field, array(0.57));
new MetaField($this->databox_field, array(3));
new MetaField($this->databox_field, [0.57]);
new MetaField($this->databox_field, [3]);
}
/**
@@ -119,6 +119,6 @@ class MetaFieldTest extends \PhraseanetPHPUnitAbstract
{
\PHPUnit_Framework_Error_Warning::$enabled = false;
\PHPUnit_Framework_Error_Notice::$enabled = false;
MetaField::loadFromString(self::$DI['app'], serialize(array('Elephant', 'sbas_id' => self::$DI['collection']->get_sbas_id(), 'id' => 0)));
MetaField::loadFromString(self::$DI['app'], serialize(['Elephant', 'sbas_id' => self::$DI['collection']->get_sbas_id(), 'id' => 0]));
}
}

View File

@@ -25,14 +25,14 @@ class StatusTest extends \PhraseanetPHPUnitAbstract
public function getValidStatuses()
{
return array(
array(123, '1111011'),
array('123', '1111011'),
array('0b1111011', '1111011'),
array('1111011', '1111011'),
array('0x7b', '1111011'),
array('7b', '1111011'),
);
return [
[123, '1111011'],
['123', '1111011'],
['0b1111011', '1111011'],
['1111011', '1111011'],
['0x7b', '1111011'],
['7b', '1111011'],
];
}
/**
@@ -47,11 +47,11 @@ class StatusTest extends \PhraseanetPHPUnitAbstract
public function getInvalidStatuses()
{
return array(
array('0b00z2'),
array('0x00g2'),
array('g2'),
);
return [
['0b00z2'],
['0x00g2'],
['g2'],
];
}
/**

View File

@@ -19,7 +19,7 @@ class AbstractCheckerTest extends \PhraseanetPHPUnitAbstract
parent::setUp();
$this->object = new AbstractCheckerTester(self::$DI['app']);
$this->file = $this->getMock('\\Alchemy\\Phrasea\\Border\\File', array('getCollection'), array(), 'CheckerTesterMock' . mt_rand(), false);
$this->file = $this->getMock('\\Alchemy\\Phrasea\\Border\\File', ['getCollection'], [], 'CheckerTesterMock' . mt_rand(), false);
}
public function tearDown()
@@ -66,14 +66,14 @@ class AbstractCheckerTest extends \PhraseanetPHPUnitAbstract
}
}
$ret = array(
array(array($collection->get_databox()), $collection, true),
array($collection->get_databox(), $collection, true),
array($collection->get_databox(), null, true),
);
$ret = [
[[$collection->get_databox()], $collection, true],
[$collection->get_databox(), $collection, true],
[$collection->get_databox(), null, true],
];
if ($databox) {
$ret[] = array($databox, $collection, false);
$ret[] = [$databox, $collection, false];
}
return $ret;
@@ -130,13 +130,13 @@ class AbstractCheckerTest extends \PhraseanetPHPUnitAbstract
$collection = \collection::create($app, $databox, $app['phraseanet.appbox'], 'other coll');
}
return array(
array(array($collection), $collection, true),
array($collection, $collection, true),
array($collection, null, true),
array($collection, $othercollection, false),
array(array($collection), $othercollection, false),
);
return [
[[$collection], $collection, true],
[$collection, $collection, true],
[$collection, null, true],
[$collection, $othercollection, false],
[[$collection], $othercollection, false],
];
}
/**
@@ -194,9 +194,9 @@ class AbstractCheckerTest extends \PhraseanetPHPUnitAbstract
}
}
return array(
array($databox, $collection),
);
return [
[$databox, $collection],
];
}
}

View File

@@ -19,7 +19,7 @@ class ColorspaceTest extends \PhraseanetPHPUnitAbstract
public function setUp()
{
parent::setUp();
$this->object = new Colorspace(self::$DI['app'], array('colorspaces' => array('RGB', 'cmyk')));
$this->object = new Colorspace(self::$DI['app'], ['colorspaces' => ['RGB', 'cmyk']]);
}
/**
@@ -59,6 +59,6 @@ class ColorspaceTest extends \PhraseanetPHPUnitAbstract
*/
public function testContructorInvalidArgumentException()
{
new Colorspace(self::$DI['app'], array(array('RGB', 'cmyk')));
new Colorspace(self::$DI['app'], [['RGB', 'cmyk']]);
}
}

View File

@@ -36,32 +36,32 @@ class DimensionTest extends \PhraseanetPHPUnitAbstract
$File = new File(self::$DI['app'], $media, self::$DI['collection']);
$object = new Dimension(self::$DI['app'], array('width' => 800));
$object = new Dimension(self::$DI['app'], ['width' => 800]);
$response = $object->check(self::$DI['app']['EM'], $File);
$this->assertInstanceOf('\\Alchemy\\Phrasea\\Border\\Checker\\Response', $response);
$this->assertFalse($response->isOk());
$object = new Dimension(self::$DI['app'], array('width' => 500));
$object = new Dimension(self::$DI['app'], ['width' => 500]);
$response = $object->check(self::$DI['app']['EM'], $File);
$this->assertInstanceOf('\\Alchemy\\Phrasea\\Border\\Checker\\Response', $response);
$this->assertFalse($response->isOk());
$object = new Dimension(self::$DI['app'], array('width' => 400));
$object = new Dimension(self::$DI['app'], ['width' => 400]);
$response = $object->check(self::$DI['app']['EM'], $File);
$this->assertInstanceOf('\\Alchemy\\Phrasea\\Border\\Checker\\Response', $response);
$this->assertTrue($response->isOk());
$object = new Dimension(self::$DI['app'], array('width' => 600, 'height' => 500));
$object = new Dimension(self::$DI['app'], ['width' => 600, 'height' => 500]);
$response = $object->check(self::$DI['app']['EM'], $File);
$this->assertInstanceOf('\\Alchemy\\Phrasea\\Border\\Checker\\Response', $response);
$this->assertFalse($response->isOk());
$object = new Dimension(self::$DI['app'], array('width' => 600, 'height' => 400));
$object = new Dimension(self::$DI['app'], ['width' => 600, 'height' => 400]);
$response = $object->check(self::$DI['app']['EM'], $File);
$this->assertInstanceOf('\\Alchemy\\Phrasea\\Border\\Checker\\Response', $response);
$this->assertTrue($response->isOk());
$object = new Dimension(self::$DI['app'], array('width' => 200, 'height' => 200));
$object = new Dimension(self::$DI['app'], ['width' => 200, 'height' => 200]);
$response = $object->check(self::$DI['app']['EM'], $File);
$this->assertInstanceOf('\\Alchemy\\Phrasea\\Border\\Checker\\Response', $response);
$this->assertTrue($response->isOk());
@@ -83,7 +83,7 @@ class DimensionTest extends \PhraseanetPHPUnitAbstract
$height = $dimensions['height'];
}
new Dimension(self::$DI['app'], array('width' => $width,'height' => $height));
new Dimension(self::$DI['app'], ['width' => $width,'height' => $height]);
$this->fail(sprintf('Exception raised with dimensions %s and %s', $width, $height));
} catch (\InvalidArgumentException $e) {
@@ -93,17 +93,17 @@ class DimensionTest extends \PhraseanetPHPUnitAbstract
public function getWrongDimensions()
{
return array(
array('width' => 0),
array('width' => -1),
array('width' => 5, 'height' => -4),
array('width' => 5, 'height' => 'a'),
array('width' => 'a', 'height' => 5),
array('width' => 'a', 'height' => 'b'),
array('width' => 'a'),
array('width' => 0, 'height' => 35),
array('width' => 30, 'height' => 0)
);
return [
['width' => 0],
['width' => -1],
['width' => 5, 'height' => -4],
['width' => 5, 'height' => 'a'],
['width' => 'a', 'height' => 5],
['width' => 'a', 'height' => 'b'],
['width' => 'a'],
['width' => 0, 'height' => 35],
['width' => 30, 'height' => 0]
];
}
/**
@@ -119,6 +119,6 @@ class DimensionTest extends \PhraseanetPHPUnitAbstract
*/
public function testContructorInvalidArgumentException()
{
new Dimension(self::$DI['app'], array('witdh' => 38));
new Dimension(self::$DI['app'], ['witdh' => 38]);
}
}

View File

@@ -19,7 +19,7 @@ class ExtensionTest extends \PhraseanetPHPUnitAbstract
public function setUp()
{
parent::setUp();
$this->object = new Extension(self::$DI['app'], array('extensions' => array('jpg', 'png', 'tiff')));
$this->object = new Extension(self::$DI['app'], ['extensions' => ['jpg', 'png', 'tiff']]);
}
/**
@@ -27,16 +27,16 @@ class ExtensionTest extends \PhraseanetPHPUnitAbstract
*/
public function testCheck()
{
$tests = array(
$tests = [
'jpg' => true,
'JPG' => true,
'tiff' => true,
'exe' => false,
);
];
foreach ($tests as $extension => $result) {
$spl = $this->getMock('\\Symfony\\Component\\HttpFoundation\\File\\File', array('getExtension'), array(__DIR__ . '/../../../../../files/test001.jpg'));
$spl = $this->getMock('\\Symfony\\Component\\HttpFoundation\\File\\File', ['getExtension'], [__DIR__ . '/../../../../../files/test001.jpg']);
$spl->expects($this->any())
->method('getExtension')
@@ -71,6 +71,6 @@ class ExtensionTest extends \PhraseanetPHPUnitAbstract
*/
public function testContructorInvalidArgumentException()
{
new Extension(self::$DI['app'], array(array('jpg', 'png', 'tiff')));
new Extension(self::$DI['app'], [['jpg', 'png', 'tiff']]);
}
}

View File

@@ -55,7 +55,7 @@ class FilenameTest extends \PhraseanetPHPUnitAbstract
*/
public function testCheckNoFile()
{
$mock = $this->getMock('\\Alchemy\\Phrasea\\Border\\File', array('getOriginalName'), array(self::$DI['app'], $this->media, self::$DI['collection']));
$mock = $this->getMock('\\Alchemy\\Phrasea\\Border\\File', ['getOriginalName'], [self::$DI['app'], $this->media, self::$DI['collection']]);
$mock
->expects($this->once())
@@ -78,7 +78,7 @@ class FilenameTest extends \PhraseanetPHPUnitAbstract
*/
public function testCheckSensitive()
{
$mock = $this->getMock('\\Alchemy\\Phrasea\\Border\\File', array('getOriginalName'), array(self::$DI['app'], $this->media, self::$DI['collection']));
$mock = $this->getMock('\\Alchemy\\Phrasea\\Border\\File', ['getOriginalName'], [self::$DI['app'], $this->media, self::$DI['collection']]);
$mock
->expects($this->any())
@@ -92,7 +92,7 @@ class FilenameTest extends \PhraseanetPHPUnitAbstract
$this->assertFalse($response->isOk());
$objectSensitive = new Filename(self::$DI['app'], array('sensitive' => true));
$objectSensitive = new Filename(self::$DI['app'], ['sensitive' => true]);
$responseSensitive = $objectSensitive->check(self::$DI['app']['EM'], $mock);
$this->assertTrue($responseSensitive->isOk());

View File

@@ -19,7 +19,7 @@ class MediaTypeTest extends \PhraseanetPHPUnitAbstract
public function setUp()
{
parent::setUp();
$this->object = new MediaType(self::$DI['app'], array('mediatypes' => array(MediaType::TYPE_IMAGE)));
$this->object = new MediaType(self::$DI['app'], ['mediatypes' => [MediaType::TYPE_IMAGE]]);
}
/**
@@ -33,7 +33,7 @@ class MediaTypeTest extends \PhraseanetPHPUnitAbstract
$this->assertTrue($response->isOk());
$object = new MediaType(self::$DI['app'], array('mediatypes' => array(MediaType::TYPE_VIDEO, MediaType::TYPE_AUDIO)));
$object = new MediaType(self::$DI['app'], ['mediatypes' => [MediaType::TYPE_VIDEO, MediaType::TYPE_AUDIO]]);
$media = self::$DI['app']['mediavorus']->guess(__DIR__ . '/../../../../../files/test001.jpg');
$file = new File(self::$DI['app'], $media, self::$DI['collection']);
@@ -55,6 +55,6 @@ class MediaTypeTest extends \PhraseanetPHPUnitAbstract
*/
public function testContructorInvalidArgumentException()
{
new MediaType(self::$DI['app'], array(array(MediaType::TYPE_IMAGE)));
new MediaType(self::$DI['app'], [[MediaType::TYPE_IMAGE]]);
}
}

View File

@@ -15,7 +15,7 @@ class ResponseTest extends \PHPUnit_Framework_TestCase
public function setUp()
{
parent::setUp();
$this->mock = $this->getMock('\\Alchemy\\Phrasea\\Border\\Checker\\CheckerInterface', array('getMessage', 'check', 'isApplicable'));
$this->mock = $this->getMock('\\Alchemy\\Phrasea\\Border\\Checker\\CheckerInterface', ['getMessage', 'check', 'isApplicable']);
$this->object = new Response(true, $this->mock);
}

View File

@@ -43,7 +43,7 @@ class Sha256Test extends \PhraseanetPHPUnitAbstract
self::$DI['app']['border-manager']->process($session, File::buildFromPathfile($this->media->getFile()->getPathname(), self::$DI['collection'], self::$DI['app']), null, Manager::FORCE_RECORD);
$mock = $this->getMock('\\Alchemy\\Phrasea\\Border\\File', array('getSha256'), array(self::$DI['app'], $this->media, self::$DI['collection']));
$mock = $this->getMock('\\Alchemy\\Phrasea\\Border\\File', ['getSha256'], [self::$DI['app'], $this->media, self::$DI['collection']]);
$mock
->expects($this->once())
@@ -63,7 +63,7 @@ class Sha256Test extends \PhraseanetPHPUnitAbstract
*/
public function testCheckNoFile()
{
$mock = $this->getMock('\\Alchemy\\Phrasea\\Border\\File', array('getSha256'), array(self::$DI['app'], $this->media, self::$DI['collection']));
$mock = $this->getMock('\\Alchemy\\Phrasea\\Border\\File', ['getSha256'], [self::$DI['app'], $this->media, self::$DI['collection']]);
$mock
->expects($this->once())

View File

@@ -49,7 +49,7 @@ class UUIDTest extends \PhraseanetPHPUnitAbstract
*/
public function testCheckNoFile()
{
$mock = $this->getMock('\\Alchemy\\Phrasea\\Border\\File', array('getUUID'), array(self::$DI['app'], $this->media, self::$DI['collection']));
$mock = $this->getMock('\\Alchemy\\Phrasea\\Border\\File', ['getUUID'], [self::$DI['app'], $this->media, self::$DI['collection']]);
$mock
->expects($this->once())

View File

@@ -160,7 +160,7 @@ class FileTest extends \PhraseanetPHPUnitAbstract
*/
public function testGetAttributes()
{
$this->assertSame(array(), $this->object->getAttributes());
$this->assertSame([], $this->object->getAttributes());
}
/**
@@ -175,16 +175,16 @@ class FileTest extends \PhraseanetPHPUnitAbstract
$attribute1 = new Metadata($metadata1);
$this->object->addAttribute($attribute1);
$this->assertSame(array($attribute1), $this->object->getAttributes());
$this->assertSame([$attribute1], $this->object->getAttributes());
$tag = new Keywords();
$value = new Multi(array('Later', 'Alligator'));
$value = new Multi(['Later', 'Alligator']);
$metadata2 = new PHPExiftoolMetadata($tag, $value);
$attribute2 = new Metadata($metadata2);
$this->object->addAttribute($attribute2);
$this->assertSame(array($attribute1, $attribute2), $this->object->getAttributes());
$this->assertSame([$attribute1, $attribute2], $this->object->getAttributes());
}
/**

View File

@@ -75,7 +75,7 @@ class ManagerTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
public function testProcess()
{
$records = array();
$records = [];
$postProcessRecord = function ($record) use (&$records) {
$records[] = $record;
@@ -117,7 +117,7 @@ class ManagerTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
*/
public function testProcessForceLazaret()
{
$records = array();
$records = [];
$postProcessRecord = function ($record) use (&$records) {
$records[] = $record;
@@ -137,7 +137,7 @@ class ManagerTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
*/
public function testCreateRecord()
{
$records = array();
$records = [];
$postProcessRecord = function ($record) use (&$records) {
$records[] = $record;
@@ -145,7 +145,7 @@ class ManagerTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
$file = File::buildFromPathfile(self::$file1, self::$DI['collection'], self::$DI['app']);
$first = $odd = false;
$tofetch = array();
$tofetch = [];
foreach (self::$DI['collection']->get_databox()->get_meta_structure() as $databox_field) {
if ($databox_field->is_readonly()) {
continue;
@@ -157,7 +157,7 @@ class ManagerTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
if ($databox_field->is_multi()) {
$data = array('a', 'Hello Multi ' . $databox_field->get_tag()->getTagname());
$data = ['a', 'Hello Multi ' . $databox_field->get_tag()->getTagname()];
$tofetch [$databox_field->get_name()] = $data;
$data[] = null;
@@ -166,7 +166,7 @@ class ManagerTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
$file->addAttribute(new Metadata(new \PHPExiftool\Driver\Metadata\Metadata($databox_field->get_tag(), $value)));
} else {
$data = array('Hello Mono ' . $databox_field->get_tag()->getTagname());
$data = ['Hello Mono ' . $databox_field->get_tag()->getTagname()];
if (!$first) {
if ($odd) {
@@ -178,7 +178,7 @@ class ManagerTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
$value = new \PHPExiftool\Driver\Value\Mono(current($data));
$tofetch [$databox_field->get_name()] = $data;
$file->addAttribute(new MetaField($databox_field, array(current($data))));
$file->addAttribute(new MetaField($databox_field, [current($data)]));
}
}
if ($first) {
@@ -230,7 +230,7 @@ class ManagerTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
foreach ($tofetch as $name => $values) {
$found = array();
$found = [];
foreach ($record->get_caption()->get_field($name)->get_values() as $value) {
$found[] = $value->getValue();
}
@@ -258,7 +258,7 @@ class ManagerTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
$file = File::buildFromPathfile(self::$file1, self::$DI['collection'], self::$DI['app']);
$odd = false;
$tofetchMeta = $tofetchField = array();
$tofetchMeta = $tofetchField = [];
foreach (self::$DI['collection']->get_databox()->get_meta_structure() as $databox_field) {
if ($databox_field->is_readonly()) {
continue;
@@ -270,7 +270,7 @@ class ManagerTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
if ($databox_field->is_multi()) {
$data = array('a', 'Hello Multi ' . $databox_field->get_tag()->getTagname());
$data = ['a', 'Hello Multi ' . $databox_field->get_tag()->getTagname()];
$tofetchMeta [$databox_field->get_tag()->getTagname()] = $data;
$value = new \PHPExiftool\Driver\Value\Multi($data);
@@ -278,7 +278,7 @@ class ManagerTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
$file->addAttribute(new Metadata(new \PHPExiftool\Driver\Metadata\Metadata($databox_field->get_tag(), $value)));
} else {
$data = array('Hello Mono ' . $databox_field->get_tag()->getTagname());
$data = ['Hello Mono ' . $databox_field->get_tag()->getTagname()];
if ($odd) {
$value = new \PHPExiftool\Driver\Value\Mono(current($data));
@@ -288,7 +288,7 @@ class ManagerTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
} else {
$tofetchField [$databox_field->get_name()] = $data;
$file->addAttribute(new MetaField($databox_field, array(current($data))));
$file->addAttribute(new MetaField($databox_field, [current($data)]));
}
}
@@ -308,7 +308,7 @@ class ManagerTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
$story_found = $status_found = false;
$foundMeta = $foundField = array();
$foundMeta = $foundField = [];
/* @var $lazaret \Alchemy\Phrasea\Model\Entities\LazaretFile */
foreach ($lazaret->getAttributes() as $attr) {
@@ -323,7 +323,7 @@ class ManagerTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
$tagname = $attribute->getValue()->getTag()->getTagname();
if (!isset($foundMeta[$tagname])) {
$foundMeta[$tagname] = array();
$foundMeta[$tagname] = [];
}
$foundMeta[$tagname] = array_merge($foundMeta[$tagname], $attribute->getValue()->getValue()->asArray());
@@ -332,7 +332,7 @@ class ManagerTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
$fieldname = $attribute->getField()->get_name();
if (!isset($foundField[$fieldname])) {
$foundField[$fieldname] = array();
$foundField[$fieldname] = [];
}
$foundField[$fieldname] = array_merge($foundField[$fieldname], (array) $attribute->getValue());
@@ -375,7 +375,7 @@ class ManagerTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
$monoData = new \PHPExiftool\Driver\Metadata\Metadata($objectNameTag, $monoValue);
$personInImageTag = new \PHPExiftool\Driver\Tag\XMPIptcExt\PersonInImage();
$multiValue = new \PHPExiftool\Driver\Value\Multi(array('Babar', 'Celeste'));
$multiValue = new \PHPExiftool\Driver\Value\Multi(['Babar', 'Celeste']);
$multiData = new \PHPExiftool\Driver\Metadata\Metadata($personInImageTag, $multiValue);
$file->addAttribute(new Metadata($monoData));
@@ -418,7 +418,7 @@ class ManagerTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
$file = File::buildFromPathfile(__DIR__ . '/../../../../files/HelloWorld.pdf', self::$DI['collection'], self::$DI['app']);
$manager->addMediaAttributesTester($file);
$toFound = array(
$toFound = [
'Phraseanet:tf-width',
'Phraseanet:tf-height',
'Phraseanet:tf-bits',
@@ -430,14 +430,14 @@ class ManagerTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
'Phraseanet:tf-basename',
'Phraseanet:tf-extension',
'Phraseanet:tf-size',
);
];
foreach ($file->getAttributes() as $attribute) {
if ($attribute->getName() == AttributeInterface::NAME_METADATA) {
$tagname = $attribute->getValue()->getTag()->getTagname();
if (in_array($tagname, $toFound)) {
$previousC = count($toFound);
$tmp = array();
$tmp = [];
foreach ($toFound as $val) {
if ($tagname != $val) {
$tmp[] = $val;
@@ -449,7 +449,7 @@ class ManagerTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
}
}
$this->assertEquals(array('Phraseanet:tf-duration'), $toFound);
$this->assertEquals(['Phraseanet:tf-duration'], $toFound);
}
/**
@@ -466,7 +466,7 @@ class ManagerTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
$count = count($file->getAttributes());
$toFound = array(
$toFound = [
'Phraseanet:tf-width',
'Phraseanet:tf-height',
'Phraseanet:tf-bits',
@@ -477,14 +477,14 @@ class ManagerTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
'Phraseanet:tf-basename',
'Phraseanet:tf-extension',
'Phraseanet:tf-size',
);
];
foreach ($file->getAttributes() as $attribute) {
if ($attribute->getName() == AttributeInterface::NAME_METADATA) {
$tagname = $attribute->getValue()->getTag()->getTagname();
if (in_array($tagname, $toFound)) {
$previousC = count($toFound);
$tmp = array();
$tmp = [];
foreach ($toFound as $val) {
if ($tagname != $val) {
$tmp[] = $val;
@@ -496,7 +496,7 @@ class ManagerTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
}
}
$this->assertEquals(array('Phraseanet:tf-width', 'Phraseanet:tf-height', 'Phraseanet:tf-bits', 'Phraseanet:tf-channels'), $toFound);
$this->assertEquals(['Phraseanet:tf-width', 'Phraseanet:tf-height', 'Phraseanet:tf-bits', 'Phraseanet:tf-channels'], $toFound);
}
/**
@@ -513,7 +513,7 @@ class ManagerTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
$count = count($file->getAttributes());
$toFound = array(
$toFound = [
'Phraseanet:tf-width',
'Phraseanet:tf-height',
'Phraseanet:tf-bits',
@@ -524,14 +524,14 @@ class ManagerTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
'Phraseanet:tf-basename',
'Phraseanet:tf-extension',
'Phraseanet:tf-size',
);
];
foreach ($file->getAttributes() as $attribute) {
if ($attribute->getName() == AttributeInterface::NAME_METADATA) {
$tagname = $attribute->getValue()->getTag()->getTagname();
if (in_array($tagname, $toFound)) {
$previousC = count($toFound);
$tmp = array();
$tmp = [];
foreach ($toFound as $val) {
if ($tagname != $val) {
$tmp[] = $val;
@@ -543,7 +543,7 @@ class ManagerTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
}
}
$this->assertEquals(array('Phraseanet:tf-duration'), $toFound);
$this->assertEquals(['Phraseanet:tf-duration'], $toFound);
}
/**
@@ -551,7 +551,7 @@ class ManagerTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
*/
public function testGetVisa()
{
$records = array();
$records = [];
$postProcessRecord = function ($record) use (&$records) {
$records[] = $record;
@@ -592,14 +592,14 @@ class ManagerTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
*/
public function testRegisterChecker()
{
$this->assertEquals(array(), $this->object->getCheckers());
$this->assertEquals([], $this->object->getCheckers());
$shaChecker = new Sha256(self::$DI['app']);
$this->object->registerChecker($shaChecker);
$uuidChecker = new UUID(self::$DI['app']);
$this->object->registerChecker($uuidChecker);
$this->assertEquals(array($shaChecker, $uuidChecker), $this->object->getCheckers());
$this->assertEquals([$shaChecker, $uuidChecker], $this->object->getCheckers());
}
/**
@@ -608,13 +608,13 @@ class ManagerTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
*/
public function testRegisterCheckers()
{
$this->assertEquals(array(), $this->object->getCheckers());
$this->assertEquals([], $this->object->getCheckers());
$shaChecker = new Sha256(self::$DI['app']);
$uuidChecker = new UUID(self::$DI['app']);
$this->object->registerCheckers(array($shaChecker, $uuidChecker));
$this->object->registerCheckers([$shaChecker, $uuidChecker]);
$this->assertEquals(array($shaChecker, $uuidChecker), $this->object->getCheckers());
$this->assertEquals([$shaChecker, $uuidChecker], $this->object->getCheckers());
}
/**
@@ -622,17 +622,17 @@ class ManagerTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
*/
public function testUnregisterChecker()
{
$this->assertEquals(array(), $this->object->getCheckers());
$this->assertEquals([], $this->object->getCheckers());
$shaChecker = new Sha256(self::$DI['app']);
$uuidChecker = new UUID(self::$DI['app']);
$filenameChecker = new Filename(self::$DI['app']);
$this->object->registerCheckers(array($shaChecker, $uuidChecker, $filenameChecker));
$this->object->registerCheckers([$shaChecker, $uuidChecker, $filenameChecker]);
$this->assertEquals(array($shaChecker, $uuidChecker, $filenameChecker), $this->object->getCheckers());
$this->assertEquals([$shaChecker, $uuidChecker, $filenameChecker], $this->object->getCheckers());
$this->object->unregisterChecker($uuidChecker);
$this->assertEquals(array($shaChecker, $filenameChecker), $this->object->getCheckers());
$this->assertEquals([$shaChecker, $filenameChecker], $this->object->getCheckers());
}
/**

View File

@@ -38,11 +38,11 @@ class MetaFieldsBagTest extends \PhraseanetPHPUnitAbstract
foreach ($structure as $databox_field) {
if (!$monoAdded) {
$this->object->set($databox_field->get_name(), new MetaField($databox_field, array('mono value')));
$this->object->set($databox_field->get_name(), new MetaField($databox_field, ['mono value']));
$monoAdded = $databox_field->get_id();
} elseif (!$multiAdded) {
if ($databox_field->is_multi()) {
$this->object->set($databox_field->get_name(), new MetaField($databox_field, array('multi', 'value')));
$this->object->set($databox_field->get_name(), new MetaField($databox_field, ['multi', 'value']));
$multiAdded = $databox_field->get_id();
}
} else {
@@ -54,22 +54,22 @@ class MetaFieldsBagTest extends \PhraseanetPHPUnitAbstract
$this->markTestSkipped('Unable to find multi value field');
}
$this->assertEquals(array(
array(
$this->assertEquals([
[
'meta_struct_id' => $monoAdded,
'value' => 'mono value',
'meta_id' => null
),
array(
],
[
'meta_struct_id' => $multiAdded,
'value' => 'multi',
'meta_id' => null
),
array(
],
[
'meta_struct_id' => $multiAdded,
'value' => 'value',
'meta_id' => null
),
), $this->object->toMetadataArray($structure));
],
], $this->object->toMetadataArray($structure));
}
}

View File

@@ -37,7 +37,7 @@ class MetadataBagTest extends \PhraseanetPHPUnitAbstract
$structure = self::$DI['collection']->get_databox()->get_meta_structure();
$valueMono = new Mono('mono value');
$valueMulti = new Multi(array('multi', 'value'));
$valueMulti = new Multi(['multi', 'value']);
$monoAdded = $multiAdded = false;
@@ -59,22 +59,22 @@ class MetadataBagTest extends \PhraseanetPHPUnitAbstract
$this->markTestSkipped('Unable to find multi value field');
}
$this->assertEquals(array(
array(
$this->assertEquals([
[
'meta_struct_id' => $monoAdded,
'value' => 'mono value',
'meta_id' => null
),
array(
],
[
'meta_struct_id' => $multiAdded,
'value' => 'multi',
'meta_id' => null
),
array(
],
[
'meta_struct_id' => $multiAdded,
'value' => 'value',
'meta_id' => null
),
), $this->object->toMetadataArray($structure));
],
], $this->object->toMetadataArray($structure));
}
}

View File

@@ -27,14 +27,14 @@ class VisaTest extends \PhraseanetPHPUnitAbstract
{
$visa = new Visa();
$this->assertEquals(array(), $visa->getResponses());
$this->assertEquals([], $visa->getResponses());
$response = new Response(true, new Filename(self::$DI['app']));
$visa->addResponse($response);
$response2 = new Response(false, new Filename(self::$DI['app']));
$visa->addResponse($response2);
$this->assertSame(array($response, $response2), $visa->getResponses());
$this->assertSame([$response, $response2], $visa->getResponses());
}
/**