',
- ),
- );
+ ],
+ ];
}
/**
@@ -406,11 +407,11 @@ public function testEmbedRendering($xml, $expected)
$html5 = new Html5(
$this->getDefaultStylesheet(),
- array(),
- array(
+ [],
+ [
new Expanding(),
new EmbedLinking(),
- )
+ ]
);
$result = $html5->convert($dom);
@@ -427,13 +428,13 @@ public function testEmbedRendering($xml, $expected)
*/
public function providerForTestConvert()
{
- $map = array();
+ $map = [];
foreach (glob(__DIR__ . '/_fixtures/html5/input/*.xml') as $inputFilePath) {
$basename = basename($inputFilePath, '.xml');
$outputFilePath = __DIR__ . "/_fixtures/html5/output/{$basename}.xml";
- $map[] = array($inputFilePath, $outputFilePath);
+ $map[] = [$inputFilePath, $outputFilePath];
}
return $map;
@@ -473,11 +474,11 @@ public function testConvert($inputFilePath, $outputFilePath)
$html5 = new Html5(
$this->getDefaultStylesheet(),
- array(),
- array(
+ [],
+ [
new Expanding(),
new EmbedLinking(),
- )
+ ]
);
$result = $html5->convert($inputDocument);
diff --git a/tests/lib/FieldType/Converter/MethodCallCountConstraint.php b/tests/lib/FieldType/Converter/MethodCallCountConstraint.php
index 7d5ea53a..dd24af45 100644
--- a/tests/lib/FieldType/Converter/MethodCallCountConstraint.php
+++ b/tests/lib/FieldType/Converter/MethodCallCountConstraint.php
@@ -8,9 +8,9 @@
*/
namespace EzSystems\EzPlatformXmlTextFieldType\Tests\FieldType\Converter;
-use PHPUnit_Framework_MockObject_Invocation;
-use PHPUnit_Framework_MockObject_Matcher_InvokedRecorder;
-use PHPUnit_Framework_ExpectationFailedException;
+use PHPUnit\Framework\MockObject\Invocation;
+use PHPUnit\Framework\MockObject\Matcher\InvokedRecorder;
+use PHPUnit\Framework\ExpectationFailedException;
/**
* Class MethodCallCountConstraint.
@@ -24,7 +24,7 @@
*
* Based on workaround proposed on https://github.com/sebastianbergmann/phpunit-mock-objects/issues/65
*/
-class MethodCallCountConstraint extends PHPUnit_Framework_MockObject_Matcher_InvokedRecorder
+class MethodCallCountConstraint extends InvokedRecorder
{
/**
* @var int
@@ -44,7 +44,7 @@ public function __construct($expectedCount)
* @return mixed|void
* @throws PHPUnit_Framework_ExpectationFailedException
*/
- public function invoked(PHPUnit_Framework_MockObject_Invocation $invocation)
+ public function invoked(Invocation $invocation)
{
parent::invoked($invocation);
@@ -53,7 +53,7 @@ public function invoked(PHPUnit_Framework_MockObject_Invocation $invocation)
if ($count > $this->expectedCount) {
$message = 'Call to ' . $invocation->toString() . ' unexpected';
- throw new PHPUnit_Framework_ExpectationFailedException($message);
+ throw new ExpectationFailedException($message);
}
}
diff --git a/tests/lib/FieldType/Converter/RichTextTest.php b/tests/lib/FieldType/Converter/RichTextTest.php
index 313795e0..a66b52e5 100644
--- a/tests/lib/FieldType/Converter/RichTextTest.php
+++ b/tests/lib/FieldType/Converter/RichTextTest.php
@@ -197,7 +197,7 @@ private function createLoggerStub($logFilePath)
->with($logLevel, $this->callback(function ($actualLogMessage) use ($logMessage) {
$expectedLogMessage = substr($logMessage, 0, strpos($logMessage, '*'));
- $this->assertEquals($expectedLogMessage, substr($actualLogMessage, 0, strlen($expectedLogMessage)), 'Actual log message do not match the expected one');
+ $this->assertEquals($expectedLogMessage, substr($actualLogMessage, 0, \strlen($expectedLogMessage)), 'Actual log message do not match the expected one');
return true;
}));
@@ -257,10 +257,10 @@ public function testConvert($inputFilePath, $outputFilePath, $logFilePath)
public function getValidator()
{
return new Validator(
- array(
+ [
'./vendor/ezsystems/ezplatform-richtext/src/lib/eZ/RichText/Resources/schemas/docbook/ezpublish.rng',
'./vendor/ezsystems/ezplatform-richtext/src/lib/eZ/RichText/Resources/schemas/docbook/docbook.iso.sch.xsl',
- )
+ ]
);
}
@@ -277,7 +277,7 @@ public function testTagEmbeddedImages($inputFilePath, $outputFilePath)
$inputDocument = $this->createDocument($inputFilePath);
$richText = new RichText($apiRepositoryStub, null, $validator);
- $richText->setImageContentTypes(array(27));
+ $richText->setImageContentTypes([27]);
$richText->tagEmbeddedImages($inputDocument, null);
diff --git a/tests/lib/FieldType/Gateway/LegacyStorageTest.php b/tests/lib/FieldType/Gateway/LegacyStorageTest.php
index e3cb1813..f5387a40 100644
--- a/tests/lib/FieldType/Gateway/LegacyStorageTest.php
+++ b/tests/lib/FieldType/Gateway/LegacyStorageTest.php
@@ -47,143 +47,143 @@ public function providerForTestStoreFieldData()
* 6. Expected return value
* 7. Resulting XML
*/
- return array(
+ return [
// LINK
- array(
+ [
'
This is an object link.
',
- array(array('/test'), array('/test' => 55)),
- array(array(), array()),
- array(),
- array(55, null),
+ [['/test'], ['/test' => 55]],
+ [[], []],
+ [],
+ [55, null],
true,
'
This is an object link.
',
- ),
- array(
+ ],
+ [
'
This is an object linkobject link.
',
- array(array('/test'), array('/test' => 55)),
- array(array(), array()),
- array(),
- array(55, null),
+ [['/test'], ['/test' => 55]],
+ [[], []],
+ [],
+ [55, null],
true,
'
This is an object linkobject link.
',
- ),
- array(
+ ],
+ [
'
This is an object link.
',
- array(array(), array()),
- array(array('34oi5ne5tj5iojte8oj58otehj5tjheo8'), array('34oi5ne5tj5iojte8oj58otehj5tjheo8' => 55)),
- array(),
- array(),
+ [[], []],
+ [['34oi5ne5tj5iojte8oj58otehj5tjheo8'], ['34oi5ne5tj5iojte8oj58otehj5tjheo8' => 55]],
+ [],
+ [],
true,
'
This is an object link.
',
- ),
- array(
+ ],
+ [
'
This is an object link.
',
- array(array(), array()),
- array(array('34oi5ne5tj5iojte8oj58otehj5tjheo8'), array('34oi5ne5tj5iojte8oj58otehj5tjheo8' => 55)),
- array(),
- array(),
+ [[], []],
+ [['34oi5ne5tj5iojte8oj58otehj5tjheo8'], ['34oi5ne5tj5iojte8oj58otehj5tjheo8' => 55]],
+ [],
+ [],
true,
'
This is an object link.
',
- ),
- array(
+ ],
+ [
'
This is an object link.
',
- array(array('/newUrl'), array()),
- array(array(), array()),
- array('/newUrl', 66),
- array(66, null),
+ [['/newUrl'], []],
+ [[], []],
+ ['/newUrl', 66],
+ [66, null],
true,
'
This is an object link.
',
- ),
- array(
+ ],
+ [
'
This is an object link.
',
- array(),
- array(),
- array(),
- array(),
+ [],
+ [],
+ [],
+ [],
false,
'
This is an object link.
',
- ),
+ ],
// EMBED
- array(
+ [
'
This is an .
',
- array(array(), array()),
- array(array('34oi5ne5tj5iojte8oj58otehj5tjheo8'), array('34oi5ne5tj5iojte8oj58otehj5tjheo8' => 55)),
- array(),
- array(),
+ [[], []],
+ [['34oi5ne5tj5iojte8oj58otehj5tjheo8'], ['34oi5ne5tj5iojte8oj58otehj5tjheo8' => 55]],
+ [],
+ [],
true,
'
This is an .
',
- ),
- array(
+ ],
+ [
'
This is an .
',
- array(),
- array(),
- array(),
- array(),
+ [],
+ [],
+ [],
+ [],
false,
'
This is an .
',
- ),
+ ],
// EMBED-INLINE
- array(
+ [
'
This is an object embed.
',
- array(array(), array()),
- array(array('34oi5ne5tj5iojte8oj58otehj5tjheo8'), array('34oi5ne5tj5iojte8oj58otehj5tjheo8' => 55)),
- array(),
- array(),
+ [[], []],
+ [['34oi5ne5tj5iojte8oj58otehj5tjheo8'], ['34oi5ne5tj5iojte8oj58otehj5tjheo8' => 55]],
+ [],
+ [],
true,
'
This is an object embed.
',
- ),
- array(
+ ],
+ [
'
This is an object embed.
',
- array(),
- array(),
- array(),
- array(),
+ [],
+ [],
+ [],
+ [],
false,
'
This is an object embed.
',
- ),
- );
+ ],
+ ];
}
/**
@@ -199,15 +199,15 @@ public function testStoreFieldData(
$expectedResultXML
) {
$versionInfo = new VersionInfo();
- $field = new Field(array('value' => new FieldValue(array('data' => $inputXML))));
- $legacyStorage = $this->getPartlyMockedLegacyStorage(array('getUrlIdMap', 'getObjectId', 'insertUrl', 'linkUrl'));
+ $field = new Field(['value' => new FieldValue(['data' => $inputXML])]);
+ $legacyStorage = $this->getPartlyMockedLegacyStorage(['getUrlIdMap', 'getObjectId', 'insertUrl', 'linkUrl']);
- $methodMap = array(
+ $methodMap = [
'getUrlIdMap' => $getLinksIdData,
'getObjectId' => $getObjectIdData,
'insertUrl' => $insertLinkData,
'linkUrl' => $linkUrlData,
- );
+ ];
foreach ($methodMap as $method => $data) {
if (empty($data)) {
$legacyStorage->expects($this->never())
@@ -237,50 +237,49 @@ public function providerForTestStoreFieldDataException()
* 5. Expected return value
* 6. Resulting XML
*/
- return array(
+ return [
// LINK
- array(
+ [
'
This is an object link.
',
- array(array(), array()),
- array(array(), array()),
- array(),
- ),
- array(
+ [[], []],
+ [[], []],
+ [],
+ ],
+ [
'
This is an object link.
',
- array(array(), array()),
- array(array('34oi5ne5tj5iojte8oj58otehj5tjheo8'), array()),
- array(),
- ),
+ [[], []],
+ [['34oi5ne5tj5iojte8oj58otehj5tjheo8'], []],
+ [],
+ ],
// EMBED
- array(
+ [
'
This is an .
',
- array(array(), array()),
- array(array('34oi5ne5tj5iojte8oj58otehj5tjheo8'), array()),
- array(),
- ),
+ [[], []],
+ [['34oi5ne5tj5iojte8oj58otehj5tjheo8'], []],
+ [],
+ ],
// EMBED-INLINE
- array(
+ [
'
This is an object link.
',
- array(array(), array()),
- array(array('34oi5ne5tj5iojte8oj58otehj5tjheo8'), array()),
- array(),
- ),
- );
+ [[], []],
+ [['34oi5ne5tj5iojte8oj58otehj5tjheo8'], []],
+ [],
+ ],
+ ];
}
/**
* @dataProvider providerForTestStoreFieldDataException
- * @expectedException \eZ\Publish\Core\Base\Exceptions\NotFoundException
*/
public function testStoreFieldDataException(
$inputXML,
@@ -288,15 +287,17 @@ public function testStoreFieldDataException(
$getObjectIdData,
$insertLinkData
) {
+ $this->expectException(\eZ\Publish\Core\Base\Exceptions\NotFoundException::class);
+
$versionInfo = new VersionInfo();
- $field = new Field(array('value' => new FieldValue(array('data' => $inputXML))));
- $legacyStorage = $this->getPartlyMockedLegacyStorage(array('getUrlIdMap', 'getObjectId', 'insertUrl'));
+ $field = new Field(['value' => new FieldValue(['data' => $inputXML])]);
+ $legacyStorage = $this->getPartlyMockedLegacyStorage(['getUrlIdMap', 'getObjectId', 'insertUrl']);
- $methodMap = array(
+ $methodMap = [
'getUrlIdMap' => $getLinksIdData,
'getObjectId' => $getObjectIdData,
'insertUrl' => $insertLinkData,
- );
+ ];
foreach ($methodMap as $method => $data) {
if (empty($data)) {
$legacyStorage->expects($this->never())
@@ -322,36 +323,36 @@ public function providerForTestGetFieldData()
* 2. Use of getLinksUrl() in form of array( array $arguments, array $return ), empty means no call
* 6. Resulting XML
*/
- return array(
+ return [
// LINK
- array(
+ [
'
This is an object link.
',
- array(array(55), array(55 => '/test')),
+ [[55], [55 => '/test']],
'
This is an object link.
',
- ),
- array(
+ ],
+ [
'
This is an object linkobject link.
',
- array(array(55), array(55 => '/test')),
+ [[55], [55 => '/test']],
'
This is an object linkobject link.
',
- ),
- array(
+ ],
+ [
'
This is an object link.
',
- array(),
+ [],
'
This is an object link.
',
- ),
- );
+ ],
+ ];
}
/**
@@ -362,8 +363,8 @@ public function testGetFieldData(
$getLinksUrlData,
$expectedResultXML
) {
- $field = new Field(array('value' => new FieldValue(array('data' => $inputXML))));
- $legacyStorage = $this->getPartlyMockedLegacyStorage(array('getIdUrlMap'));
+ $field = new Field(['value' => new FieldValue(['data' => $inputXML])]);
+ $legacyStorage = $this->getPartlyMockedLegacyStorage(['getIdUrlMap']);
if (empty($getLinksUrlData)) {
$legacyStorage->expects($this->never())
diff --git a/tests/lib/FieldType/Input/EzXmlTest.php b/tests/lib/FieldType/Input/EzXmlTest.php
index 14998377..fc17f0a4 100644
--- a/tests/lib/FieldType/Input/EzXmlTest.php
+++ b/tests/lib/FieldType/Input/EzXmlTest.php
@@ -27,33 +27,33 @@ public function testConvertCorrect($xmlString)
public function providerForTestConvertCorrect()
{
- return array(
- array(
+ return [
+ [
'
<test>
',
- ),
- array(
+ ],
+ [
'
test
',
- ),
- array(
+ ],
+ [
'
Multiline
',
- ),
- array(
+ ],
+ [
'
Underline
',
- ),
- array(
+ ],
+ [
'
Multiline
',
- ),
- );
+ ],
+ ];
}
/**
@@ -74,12 +74,12 @@ public function testConvertIncorrect($xmlString, $exceptionMessage)
public function providerForTestConvertIncorrect()
{
- return array(
- array(
+ return [
+ [
'',
"Argument 'xmlString' is invalid: Validation of XML content failed: Element 'wrongTag': This element is not expected. Expected is one of ( section, paragraph, header ).",
- ),
- array(
+ ],
+ [
'Some content
@@ -90,19 +90,19 @@ public function providerForTestConvertIncorrect()
Element 'tr': Missing child element(s). Expected is one of ( th, td ).
Element 'link', attribute 'node_id': 'abc' is not a valid value of the atomic type 'xs:integer'.
Element 'link': This element is not expected. Expected is one of ( custom, strong, emphasize, embed, embed-inline ).",
- ),
- array(
+ ],
+ [
'With a literalliteral',
"Argument 'xmlString' is invalid: Validation of XML content failed: Element 'literal': This element is not expected. Expected is one of ( custom, strong, emphasize, link, anchor, line ).",
- ),
- array(
+ ],
+ [
'With a embed ',
"Argument 'xmlString' is invalid: Validation of XML content failed: Element 'embed': This element is not expected. Expected is one of ( custom, strong, emphasize, link, anchor, line ).",
- ),
- array(
+ ],
+ [
'With a embed ',
"Argument 'xmlString' is invalid: Validation of XML content failed: Element 'embed-inline': This element is not expected. Expected is one of ( custom, strong, emphasize, link, anchor, line ).",
- ),
- );
+ ],
+ ];
}
}
diff --git a/tests/lib/FieldType/Persistence/Legacy/BaseTest.php b/tests/lib/FieldType/Persistence/Legacy/BaseTest.php
index 8655cfd8..0d3ed96f 100644
--- a/tests/lib/FieldType/Persistence/Legacy/BaseTest.php
+++ b/tests/lib/FieldType/Persistence/Legacy/BaseTest.php
@@ -32,7 +32,7 @@ protected function insertDatabaseFixture($file)
$q->insertInto($db->quoteIdentifier($table));
// Contains the bound parameters
- $values = array();
+ $values = [];
// Binding the parameters
foreach ($rows[0] as $col => $val) {
diff --git a/tests/lib/FieldType/Persistence/Legacy/ContentModelGatewayTest.php b/tests/lib/FieldType/Persistence/Legacy/ContentModelGatewayTest.php
index e82df1eb..3eb52721 100644
--- a/tests/lib/FieldType/Persistence/Legacy/ContentModelGatewayTest.php
+++ b/tests/lib/FieldType/Persistence/Legacy/ContentModelGatewayTest.php
@@ -388,11 +388,11 @@ public function testGetFieldRows($datatypeString, $contentId, $offset, $limit, $
$statement = $gatewayService->getFieldRows($datatypeString, $contentId, $offset, $limit);
$index = 0;
while ($row = $statement->fetch(PDO::FETCH_ASSOC)) {
- $this->assertLessThan(count($expectedRows), $index, 'Too many rows returned by getFieldRows');
+ $this->assertLessThan(\count($expectedRows), $index, 'Too many rows returned by getFieldRows');
$this->assertEquals($expectedRows[$index], $row, 'Result from getFieldRows() did not return expected result');
++$index;
}
- $this->assertEquals(count($expectedRows), $index, 'Too few rows returned by getFieldRows');
+ $this->assertEquals(\count($expectedRows), $index, 'Too few rows returned by getFieldRows');
}
protected function getFieldRows($contentId)
diff --git a/tests/lib/FieldType/Persistence/Legacy/_fixtures/contentclass.php b/tests/lib/FieldType/Persistence/Legacy/_fixtures/contentclass.php
index 82e2ed7a..37f187ac 100644
--- a/tests/lib/FieldType/Persistence/Legacy/_fixtures/contentclass.php
+++ b/tests/lib/FieldType/Persistence/Legacy/_fixtures/contentclass.php
@@ -1,8 +1,8 @@
array(
- 0 => array(
+return [
+ 'ezcontentclass' => [
+ 0 => [
'always_available' => 0,
'contentobject_name' => '',
'created' => 1024392098,
@@ -21,8 +21,8 @@
'sort_order' => 1,
'url_alias_name' => '',
'version' => 0,
- ),
- 1 => array(
+ ],
+ 1 => [
'always_available' => 0,
'contentobject_name' => '',
'created' => 1024392098,
@@ -41,8 +41,8 @@
'sort_order' => 1,
'url_alias_name' => '',
'version' => 0,
- ),
- 2 => array(
+ ],
+ 2 => [
'always_available' => 0,
'contentobject_name' => '',
'created' => 1024392098,
@@ -61,6 +61,6 @@
'sort_order' => 1,
'url_alias_name' => '',
'version' => 0,
- ),
- ),
-);
+ ],
+ ],
+];
diff --git a/tests/lib/FieldType/XmlTextTest.php b/tests/lib/FieldType/XmlTextTest.php
index 93e3f1b2..5f828fcc 100644
--- a/tests/lib/FieldType/XmlTextTest.php
+++ b/tests/lib/FieldType/XmlTextTest.php
@@ -53,7 +53,7 @@ protected function getTransformationProcessorMock()
{
return $this->getMockForAbstractClass(
TransformationProcessor::class,
- array(),
+ [],
'',
false,
true,
@@ -80,16 +80,16 @@ public function testSettingsSchema()
{
$ft = $this->getFieldType();
self::assertSame(
- array(
- 'numRows' => array(
+ [
+ 'numRows' => [
'type' => 'int',
'default' => 10,
- ),
- 'tagPreset' => array(
+ ],
+ 'tagPreset' => [
'type' => 'choice',
'default' => XmlTextType::TAG_PRESET_DEFAULT,
- ),
- ),
+ ],
+ ],
$ft->getSettingsSchema(),
'The settings schema does not match what is expected.'
);
@@ -109,7 +109,7 @@ public function testValidateFieldSettingsValid($settings)
'The method validateFieldSettings() must return an array.'
);
$this->assertEquals(
- array(),
+ [],
$validationResult,
'validateFieldSettings() considered the input settings invalid, while they should be valid: '
);
@@ -130,7 +130,7 @@ public function testValidateFieldSettingsInvalid($settings)
);
$this->assertNotEquals(
- array(),
+ [],
$validationResult,
'validateFieldSettings() considered the input settings valid, while they should be invalid.'
);
@@ -146,10 +146,11 @@ public function testValidateFieldSettingsInvalid($settings)
/**
* @covers \eZ\Publish\Core\FieldType\XmlText\Type::acceptValue
- * @expectedException \eZ\Publish\API\Repository\Exceptions\InvalidArgumentException
*/
public function testAcceptValueInvalidType()
{
+ $this->expectException(\eZ\Publish\API\Repository\Exceptions\InvalidArgumentException::class);
+
$this->getFieldType()->acceptValue($this->createMock(Value::class));
}
@@ -177,7 +178,7 @@ public function testAcceptValueInvalidFormat($input, $errorMessage)
$this->assertEquals($errorMessage, $e->getMessage());
} catch (Exception $e) {
$this->fail(
- 'An InvalidArgumentException was expected! ' . get_class($e) . ' thrown with message: ' . $e->getMessage()
+ 'An InvalidArgumentException was expected! ' . \get_class($e) . ' thrown with message: ' . $e->getMessage()
);
}
}
@@ -204,86 +205,86 @@ public function testToPersistenceValue()
public static function providerForTestValidateFieldSettingsValid()
{
- return array(
- array(
- array(
+ return [
+ [
+ [
'numRows' => 10,
'tagPreset' => '',
- ),
- ),
- array(
- array(
+ ],
+ ],
+ [
+ [
'numRows' => 10,
'tagPreset' => 0,
- ),
- ),
- );
+ ],
+ ],
+ ];
}
public static function providerForTestValidateFieldSettingsInvalid()
{
- return array(
- array(
- array(
+ return [
+ [
+ [
'numRows' => '',
'tagPreset' => '',
- ),
- ),
- array(
- array(
+ ],
+ ],
+ [
+ [
'numRows' => 10,
'tagPreset' => 'a',
- ),
- ),
- array(
- array(
+ ],
+ ],
+ [
+ [
'numRows' => 'a',
'tagPreset' => 0,
- ),
- ),
- );
+ ],
+ ],
+ ];
}
public static function providerForTestAcceptValueValidFormat()
{
- return array(
- array(
+ return [
+ [
$xml = '
This is a piece of text',
- ),
- array(new EzXml($xml)),
+ ],
+ [new EzXml($xml)],
- array(
+ [
$xml = '
',
- ),
- array(new EzXml($xml)),
- );
+ ],
+ [new EzXml($xml)],
+ ];
}
public static function providerForTestAcceptValueInvalidFormat()
{
- return array(
- array(
+ return [
+ [
'
This is a piece of text
',
"Argument 'xmlString' is invalid: Validation of XML content failed: Element 'h1': This element is not expected. Expected is one of ( section, paragraph, header ).",
- ),
+ ],
- array(
+ [
'This is not XML at all!',
"Argument 'xmlString' is invalid: Validation of XML content failed: Start tag expected, '<' not found\nThe document has no document element.",
- ),
+ ],
- array(
+ [
'',
"Argument 'xmlString' is invalid: Validation of XML content failed: Element 'unknown': No matching global declaration available for the validation root.",
- ),
- );
+ ],
+ ];
}
/**
@@ -316,87 +317,87 @@ public function testGetNamePassingXML($xml, $value)
public static function providerForTestGetName()
{
- return array(
- array(
+ return [
+ [
'
This is a piece of text',
'This is a piece of text',
- ),
+ ],
- array(
+ [
'
This is a piece of text',
/* @todo FIXME: should probably be "This is a piece of text" */
'This is a piece of',
- ),
+ ],
- array(
+ [
'
This is a piece of text',
/* @todo FIXME: should probably be "This is a piece of text" */
'This is a piece',
- ),
+ ],
- array(
+ [
'
This is a piece of text',
/* @todo FIXME: should probably be "This is a piece of text" */
'This is',
- ),
+ ],
- array(
+ [
'
First cell
Second cell
Third cell
Fourth cell
Text after table',
/* @todo FIXME: should probably be "First cell" */
'First cellSecond cell',
- ),
+ ],
- array(
+ [
'
List item
',
'List item',
- ),
+ ],
- array(
+ [
'
List item
',
'List item',
- ),
+ ],
- array(
+ [
'
',
'',
- ),
+ ],
- array(
+ [
'
A simple paragraph!',
'A simple',
- ),
+ ],
- array('test', 'test'),
+ ['test', 'test'],
- array('testtest', 'test'),
- );
+ ['testtest', 'test'],
+ ];
}
/**
@@ -428,16 +429,16 @@ public function testGetRelations()
$ft = $this->getFieldType();
$this->assertEquals(
- array(
- Relation::LINK => array(
- 'locationIds' => array(72, 61),
- 'contentIds' => array(70, 75),
- ),
- Relation::EMBED => array(
- 'locationIds' => array(52, 42),
- 'contentIds' => array(72, 74),
- ),
- ),
+ [
+ Relation::LINK => [
+ 'locationIds' => [72, 61],
+ 'contentIds' => [70, 75],
+ ],
+ Relation::EMBED => [
+ 'locationIds' => [52, 42],
+ 'contentIds' => [72, 74],
+ ],
+ ],
$ft->getRelations($ft->acceptValue($xml))
);
}
@@ -449,6 +450,6 @@ protected function provideFieldTypeIdentifier()
public function provideDataForGetName()
{
- return array();
+ return [];
}
}
diff --git a/tests/lib/REST/Common/FieldTypeProcessor/XmlTextProcessorTest.php b/tests/lib/REST/Common/FieldTypeProcessor/XmlTextProcessorTest.php
index a1bc768b..44aec40d 100644
--- a/tests/lib/REST/Common/FieldTypeProcessor/XmlTextProcessorTest.php
+++ b/tests/lib/REST/Common/FieldTypeProcessor/XmlTextProcessorTest.php
@@ -20,12 +20,12 @@ public function fieldSettingsHashes()
{
return [
[
- array('tagPreset' => 'TAG_PRESET_DEFAULT'),
- array('tagPreset' => Type::TAG_PRESET_DEFAULT),
+ ['tagPreset' => 'TAG_PRESET_DEFAULT'],
+ ['tagPreset' => Type::TAG_PRESET_DEFAULT],
],
[
- array('tagPreset' => 'TAG_PRESET_SIMPLE_FORMATTING'),
- array('tagPreset' => Type::TAG_PRESET_SIMPLE_FORMATTING),
+ ['tagPreset' => 'TAG_PRESET_SIMPLE_FORMATTING'],
+ ['tagPreset' => Type::TAG_PRESET_SIMPLE_FORMATTING],
],
];
}
diff --git a/tests/lib/XmlTextAPIIntegrationTest.php b/tests/lib/XmlTextAPIIntegrationTest.php
index 68933c8a..533d7c42 100644
--- a/tests/lib/XmlTextAPIIntegrationTest.php
+++ b/tests/lib/XmlTextAPIIntegrationTest.php
@@ -79,36 +79,36 @@ public function getCreateExpectedRelations(Content $content)
{
$contentService = $this->getRepository()->getContentService();
- return array(
+ return [
new Relation(
- array(
+ [
'type' => Relation::LINK,
'sourceContentInfo' => $content->contentInfo,
'destinationContentInfo' => $contentService->loadContentInfo(56),
- )
+ ]
),
new Relation(
- array(
+ [
'type' => Relation::LINK,
'sourceContentInfo' => $content->contentInfo,
'destinationContentInfo' => $contentService->loadContentInfo(54),
- )
+ ]
),
new Relation(
- array(
+ [
'type' => Relation::EMBED,
'sourceContentInfo' => $content->contentInfo,
'destinationContentInfo' => $contentService->loadContentInfo(58),
- )
+ ]
),
new Relation(
- array(
+ [
'type' => Relation::EMBED,
'sourceContentInfo' => $content->contentInfo,
'destinationContentInfo' => $contentService->loadContentInfo(56),
- )
+ ]
),
- );
+ ];
}
/**
@@ -120,22 +120,22 @@ public function getUpdateExpectedRelations(Content $content)
{
$contentService = $this->getRepository()->getContentService();
- return array(
+ return [
new Relation(
- array(
+ [
'type' => Relation::LINK,
'sourceContentInfo' => $content->contentInfo,
'destinationContentInfo' => $contentService->loadContentInfo(58),
- )
+ ]
),
new Relation(
- array(
+ [
'type' => Relation::EMBED,
'sourceContentInfo' => $content->contentInfo,
'destinationContentInfo' => $contentService->loadContentInfo(56),
- )
+ ]
),
- );
+ ];
}
/**
@@ -155,16 +155,16 @@ public function getTypeName()
*/
public function getSettingsSchema()
{
- return array(
- 'numRows' => array(
+ return [
+ 'numRows' => [
'type' => 'int',
'default' => 10,
- ),
- 'tagPreset' => array(
+ ],
+ 'tagPreset' => [
'type' => 'choice',
'default' => XmlTextType::TAG_PRESET_DEFAULT,
- ),
- );
+ ],
+ ];
}
/**
@@ -174,10 +174,10 @@ public function getSettingsSchema()
*/
public function getValidFieldSettings()
{
- return array(
+ return [
'numRows' => 0,
'tagPreset' => XmlTextType::TAG_PRESET_DEFAULT,
- );
+ ];
}
/**
@@ -187,9 +187,9 @@ public function getValidFieldSettings()
*/
public function getInvalidFieldSettings()
{
- return array(
+ return [
'somethingUnknown' => 0,
- );
+ ];
}
/**
@@ -199,7 +199,7 @@ public function getInvalidFieldSettings()
*/
public function getValidatorSchema()
{
- return array();
+ return [];
}
/**
@@ -209,7 +209,7 @@ public function getValidatorSchema()
*/
public function getValidValidatorConfiguration()
{
- return array();
+ return [];
}
/**
@@ -219,9 +219,9 @@ public function getValidValidatorConfiguration()
*/
public function getInvalidValidatorConfiguration()
{
- return array(
- 'unknown' => array('value' => 23),
- );
+ return [
+ 'unknown' => ['value' => 23],
+ ];
}
/**
@@ -275,9 +275,9 @@ public function assertFieldDataLoadedCorrect(Field $field)
);
$this->assertPropertiesCorrect(
- array(
+ [
'xml' => $this->createdDOMValue,
- ),
+ ],
$field->value
);
}
@@ -305,12 +305,12 @@ public function assertFieldDataLoadedCorrect(Field $field)
*/
public function provideInvalidCreationFieldData()
{
- return array(
- array(
+ return [
+ [
new \stdClass(),
InvalidArgumentType::class,
- ),
- );
+ ],
+ ];
}
/**
@@ -338,9 +338,9 @@ public function assertUpdatedFieldDataLoadedCorrect(Field $field)
);
$this->assertPropertiesCorrect(
- array(
+ [
'xml' => $this->updatedDOMValue,
- ),
+ ],
$field->value
);
}
@@ -387,9 +387,9 @@ public function assertCopiedFieldDataLoadedCorrectly(Field $field)
);
$this->assertPropertiesCorrect(
- array(
+ [
'xml' => $this->createdDOMValue,
- ),
+ ],
$field->value
);
}
@@ -425,12 +425,12 @@ public function provideToHashData()
EOT
);
- return array(
- array(
+ return [
+ [
new XmlTextValue($xml),
- array('xml' => $xml->saveXML()),
- ),
- );
+ ['xml' => $xml->saveXML()],
+ ],
+ ];
}
/**
@@ -442,17 +442,17 @@ public function provideToHashData()
*/
public function provideFromHashData()
{
- return array(
- array(
- array(
+ return [
+ [
+ [
'xml' => '
Foobar
',
- ),
- ),
- );
+ ],
+ ],
+ ];
}
/**
@@ -481,10 +481,10 @@ public function providerForTestIsEmptyValue()
$doc = new DOMDocument();
$doc->loadXML('');
- return array(
- array(new XmlTextValue()),
- array(new XmlTextValue($doc)),
- );
+ return [
+ [new XmlTextValue()],
+ [new XmlTextValue($doc)],
+ ];
}
public function providerForTestIsNotEmptyValue()
@@ -494,13 +494,13 @@ public function providerForTestIsNotEmptyValue()
$doc2 = new DOMDocument();
$doc2->loadXML('');
- return array(
- array(
+ return [
+ [
$this->getValidCreationFieldData(),
- ),
- array(new XmlTextValue($doc)),
- array(new XmlTextValue($doc2)),
- );
+ ],
+ [new XmlTextValue($doc)],
+ [new XmlTextValue($doc2)],
+ ];
}
/**
@@ -515,8 +515,8 @@ public function providerForTestConvertRemoteObjectIdToObjectId()
$remote_id = '[RemoteId]';
$object_id = '[ObjectId]';
- return array(
- array(
+ return [
+ [
// test link
'
@@ -528,8 +528,8 @@ public function providerForTestConvertRemoteObjectIdToObjectId()
link
',
- ),
- array(
+ ],
+ [
// test embed
'
@@ -541,8 +541,8 @@ public function providerForTestConvertRemoteObjectIdToObjectId()
',
- ),
- array(
+ ],
+ [
// test embed-inline
'
@@ -554,8 +554,8 @@ public function providerForTestConvertRemoteObjectIdToObjectId()
',
- ),
- );
+ ],
+ ];
}
/**
@@ -580,7 +580,7 @@ public function testConvertRemoteObjectIdToObjectId($test, $expected)
$createStruct->setField('name', 'Folder Link');
$draft = $contentService->createContent(
$createStruct,
- array($locationService->newLocationCreateStruct(2))
+ [$locationService->newLocationCreateStruct(2)]
);
$target = $contentService->publishVersion(
@@ -604,7 +604,7 @@ public function testConvertRemoteObjectIdToObjectId($test, $expected)
);
$test = $contentService->createContent(
$testStruct,
- array($locationService->newLocationCreateStruct($node_id))
+ [$locationService->newLocationCreateStruct($node_id)]
);
$this->assertEquals(
@@ -615,7 +615,7 @@ public function testConvertRemoteObjectIdToObjectId($test, $expected)
protected function checkSearchEngineSupport()
{
- if (ltrim(get_class($this->getSetupFactory()), '\\') === LegacySetupFactory::class) {
+ if (ltrim(\get_class($this->getSetupFactory()), '\\') === LegacySetupFactory::class) {
$this->markTestSkipped(
"'ezxmltext' field type is not searchable with Legacy Search Engine"
);
@@ -656,8 +656,8 @@ protected function getSearchTargetValueTwo()
protected function getFullTextIndexedFieldData()
{
- return array(
- array('mediocrity', 'analysis'),
- );
+ return [
+ ['mediocrity', 'analysis'],
+ ];
}
}
diff --git a/tests/lib/XmlTextSPIIntegrationTest.php b/tests/lib/XmlTextSPIIntegrationTest.php
index cc04fc70..3b7a52bb 100644
--- a/tests/lib/XmlTextSPIIntegrationTest.php
+++ b/tests/lib/XmlTextSPIIntegrationTest.php
@@ -96,24 +96,24 @@ public function getTypeConstraints()
*/
public function getFieldDefinitionData()
{
- return array(
+ return [
// The ezxmltext field type does not have any special field definition
// properties
- array('fieldType', 'ezxmltext'),
- array(
+ ['fieldType', 'ezxmltext'],
+ [
'fieldTypeConstraints',
new FieldTypeConstraints(
- array(
+ [
'fieldSettings' => new FieldSettings(
- array(
+ [
'numRows' => 0,
'tagPreset' => null,
- )
+ ]
),
- )
+ ]
),
- ),
- );
+ ],
+ ];
}
/**
@@ -126,11 +126,11 @@ public function getInitialValue()
$xml = 'Paragraph content…';
return new FieldValue(
- array(
+ [
'data' => $xml,
'externalData' => null,
'sortKey' => null,
- )
+ ]
);
}
@@ -146,11 +146,11 @@ public function getUpdatedValue()
$xml = 'Some different content…';
return new FieldValue(
- array(
+ [
'data' => $xml,
'externalData' => null,
'sortKey' => null,
- )
+ ]
);
}
}