From 862bc6de8e3ede747661fb169a75e8cdd99de9d9 Mon Sep 17 00:00:00 2001 From: David Buchmann Date: Wed, 7 Oct 2020 16:41:10 +0200 Subject: [PATCH] allow php 8 and support phpunit 9 --- composer.json | 4 +- inc/AbstractLoader.php | 5 +- inc/BaseCase.php | 11 ++-- .../Connecting/RepositoryDescriptorsTest.php | 4 +- tests/Connecting/RepositoryFactoryTest.php | 2 +- tests/Connecting/RepositoryTest.php | 2 +- tests/Connecting/SessionReadMethodsTest.php | 2 +- tests/Connecting/SimpleCredentialsTest.php | 4 +- tests/Connecting/WorkspaceReadMethodsTest.php | 4 +- tests/Export/ExportRepositoryContentTest.php | 2 +- tests/Import/ImportRepositoryContentTest.php | 2 +- tests/Locking/LockManagerTest.php | 5 +- .../NodeTypeDiscovery/NodeDefinitionTest.php | 16 ++--- .../NodeNodeTypeReadMethodsTest.php | 2 +- .../NodeTypeDiscoveryTest.php | 2 +- tests/NodeTypeDiscovery/NodeTypeTest.php | 16 ++--- .../PropertyDefinitionTest.php | 24 +++---- tests/NodeTypeManagement/NodeTypeBaseCase.php | 2 +- tests/Observation/ObservationManagerTest.php | 10 +-- tests/OrderableChildNodes/OrderBeforeTest.php | 4 +- tests/PhpcrUtils/CndParserTest.php | 2 +- tests/PhpcrUtils/NodeHelperTest.php | 2 +- tests/PhpcrUtils/PurgeTest.php | 4 +- tests/Query/CharacterTest.php | 20 +++--- tests/Query/NodeViewTest.php | 2 +- .../QOM/ConvertQueriesBackAndForthTest.php | 2 +- tests/Query/QOM/QomTestQueries.php | 63 ++++++++++++------- tests/Query/QOM/QomToSql2ConverterTest.php | 2 +- tests/Query/QOM/Sql2ScannerTest.php | 11 +++- tests/Query/QOM/Sql2ToQomConverterTest.php | 4 +- tests/Query/QueryBaseCase.php | 7 ++- tests/Query/QueryManagerTest.php | 4 +- tests/Query/QueryObjectQOMTest.php | 2 +- tests/Query/QueryResultsTest.php | 15 +++-- tests/Query/QuerySql2OperationsTest.php | 57 +++++++++++------ tests/Query/RowIteratorTest.php | 2 +- tests/Query/RowTest.php | 6 +- tests/Query/Sql1/QueryBaseCase.php | 2 +- tests/Query/Sql1/QueryOperationsTest.php | 5 +- tests/Query/XPath/QueryBaseCase.php | 2 +- tests/Reading/BinaryReadMethodsTest.php | 34 +++++----- tests/Reading/EncodingTest.php | 4 +- tests/Reading/JackalopeFetchDepthTest.php | 4 +- tests/Reading/NodeReadMethodsTest.php | 16 ++--- tests/Reading/PropertyReadMethodsTest.php | 46 +++++++------- .../Reading/SessionNamespaceRemappingTest.php | 6 +- tests/SameNameSiblings/DeleteMethodsTest.php | 4 +- tests/Transactions/TransactionMethodsTest.php | 4 +- .../Versioning/CreateVersionableNodeTest.php | 4 +- tests/Versioning/NodeTypeReadTest.php | 4 +- tests/Versioning/SimpleVersionTest.php | 6 +- tests/Versioning/VersionHistoryTest.php | 8 +-- tests/Versioning/VersionManagerTest.php | 4 +- tests/Versioning/VersionTest.php | 6 +- tests/Writing/AddMethodsTest.php | 4 +- tests/Writing/CloneMethodsTest.php | 9 +-- tests/Writing/CombinedManipulationsTest.php | 4 +- tests/Writing/CopyMethodsTest.php | 20 +++--- tests/Writing/DeleteMethodsTest.php | 4 +- tests/Writing/EncodingTest.php | 4 +- tests/Writing/ItemStateTest.php | 2 +- tests/Writing/LastModifiedTest.php | 4 +- tests/Writing/LastModifiedUpdateTest.php | 2 +- tests/Writing/MixinCreatedTest.php | 2 +- tests/Writing/MixinReferenceableTest.php | 4 +- tests/Writing/MoveMethodsTest.php | 8 +-- tests/Writing/NamespaceRegistryTest.php | 10 +-- tests/Writing/NodeTypeAssignementTest.php | 4 +- .../NodeTypePreemptiveValidationTest.php | 2 +- .../SetPropertyDynamicRebindingTest.php | 8 +-- tests/Writing/SetPropertyMethodsTest.php | 4 +- tests/Writing/SetPropertyTypesTest.php | 2 +- 72 files changed, 319 insertions(+), 265 deletions(-) diff --git a/composer.json b/composer.json index cbd64f36..339e4209 100644 --- a/composer.json +++ b/composer.json @@ -27,9 +27,9 @@ } ], "require": { - "php": "^5.6|^7.0", + "php": "^7.1 || ^8.0", "phpcr/phpcr-implementation": "2.1.*", - "phpunit/phpunit": "^5.7 || ^6.4 || ^7.0" + "phpunit/phpunit": "^7.0 || ^8.0 || ^9.0" }, "autoload": { "psr-4": { diff --git a/inc/AbstractLoader.php b/inc/AbstractLoader.php index 34487e89..e4638012 100644 --- a/inc/AbstractLoader.php +++ b/inc/AbstractLoader.php @@ -255,10 +255,11 @@ public function doesSessionLastModified() */ public function getTestSupported($chapter, $case, $name) { - return !(in_array($chapter, $this->unsupportedChapters) + return !( + in_array($chapter, $this->unsupportedChapters) || in_array($case, $this->unsupportedCases) || in_array($name, $this->unsupportedTests) - ); + ); } /** diff --git a/inc/BaseCase.php b/inc/BaseCase.php index 75b3bd2f..9340f0b2 100644 --- a/inc/BaseCase.php +++ b/inc/BaseCase.php @@ -96,7 +96,7 @@ abstract class BaseCase extends TestCase * * @see initProperties() */ - public static function setupBeforeClass($fixtures = 'general/base') + public static function setupBeforeClass($fixtures = 'general/base'): void { self::$loader = ImplementationLoader::getInstance(); @@ -120,7 +120,7 @@ public static function setupBeforeClass($fixtures = 'general/base') self::$staticSharedFixture['additionalSession'] = self::$loader->getAdditionalSession(); } - protected function setUp() + protected function setUp(): void { $fqn = get_called_class(); $parts = explode('\\', $fqn); @@ -144,7 +144,7 @@ protected function setUp() $this->initProperties(); } - public static function tearDownAfterClass() + public static function tearDownAfterClass(): void { if (isset(self::$staticSharedFixture['session'])) { self::$staticSharedFixture['session']->logout(); @@ -278,7 +278,8 @@ protected function assertSimilarDateTime($expected, $data) { $this->assertInstanceOf(DateTime::class, $expected); $this->assertInstanceOf(DateTime::class, $data); - $this->assertTrue(abs($expected->getTimestamp() - $data->getTimestamp()) <= 3, + $this->assertTrue( + abs($expected->getTimestamp() - $data->getTimestamp()) <= 3, $data->format('c').' is not close to the expected '.$expected->format('c') ); } @@ -290,7 +291,7 @@ protected function assertSimilarDateTime($expected, $data) * * @return bool True if the test can be done. Otherwise the test is skipped. */ - protected function skipIfNotSupported($descriptor) + protected function skipIfNotSupported($descriptor): bool { if (false === $this->session->getRepository()->getDescriptor($descriptor)) { $this->markTestSkipped('Descriptor "'.$descriptor.'" not supported'); diff --git a/tests/Connecting/RepositoryDescriptorsTest.php b/tests/Connecting/RepositoryDescriptorsTest.php index 65c42905..41e1a247 100644 --- a/tests/Connecting/RepositoryDescriptorsTest.php +++ b/tests/Connecting/RepositoryDescriptorsTest.php @@ -15,7 +15,7 @@ class RepositoryDescriptorsTest extends BaseCase { - public static function setupBeforeClass($fixtures = false) + public static function setupBeforeClass($fixtures = false): void { // Don't care about fixtures parent::setupBeforeClass($fixtures); @@ -41,7 +41,7 @@ public function testDescriptorKeys() { $rep = self::$loader->getRepository(); $keys = $rep->getDescriptorKeys(); - $this->assertInternalType('array', $keys); + $this->assertIsArray($keys); $this->assertNotEmpty($keys); foreach ($this->expectedDescriptors as $descriptor) { $this->assertContains($descriptor, $keys); diff --git a/tests/Connecting/RepositoryFactoryTest.php b/tests/Connecting/RepositoryFactoryTest.php index ed316d77..74416e98 100644 --- a/tests/Connecting/RepositoryFactoryTest.php +++ b/tests/Connecting/RepositoryFactoryTest.php @@ -17,7 +17,7 @@ class RepositoryFactoryTest extends BaseCase { - public static function setupBeforeClass($fixtures = false) + public static function setupBeforeClass($fixtures = false): void { // Don't care about fixtures parent::setupBeforeClass($fixtures); diff --git a/tests/Connecting/RepositoryTest.php b/tests/Connecting/RepositoryTest.php index 8bd2bb5d..c1cb0692 100644 --- a/tests/Connecting/RepositoryTest.php +++ b/tests/Connecting/RepositoryTest.php @@ -20,7 +20,7 @@ class RepositoryTest extends BaseCase { - public static function setupBeforeClass($fixtures = null) + public static function setupBeforeClass($fixtures = null): void { // Don't care about fixtures parent::setupBeforeClass($fixtures); diff --git a/tests/Connecting/SessionReadMethodsTest.php b/tests/Connecting/SessionReadMethodsTest.php index 1facde22..7ee1b85c 100644 --- a/tests/Connecting/SessionReadMethodsTest.php +++ b/tests/Connecting/SessionReadMethodsTest.php @@ -54,7 +54,7 @@ public function testGetAttributeNames() $cr->setAttribute('foo', 'bar'); $session = $this->assertSession($cr); $attrs = $session->getAttributeNames(); - $this->assertInternalType('array', $attrs); + $this->assertIsArray($attrs); $this->assertContains('foo', $attrs); } diff --git a/tests/Connecting/SimpleCredentialsTest.php b/tests/Connecting/SimpleCredentialsTest.php index 88a3d931..3599a66c 100644 --- a/tests/Connecting/SimpleCredentialsTest.php +++ b/tests/Connecting/SimpleCredentialsTest.php @@ -20,7 +20,7 @@ */ class SimpleCredentialsTest extends BaseCase { - public static function setupBeforeClass($fixtures = false) + public static function setupBeforeClass($fixtures = false): void { // Don't care about fixtures parent::setupBeforeClass($fixtures); @@ -67,7 +67,7 @@ public function testAttributes() $cr->setAttribute($attrName, $attrValue); $this->assertEquals($attrValue, $cr->getAttribute($attrName)); $attrs = $cr->getAttributeNames(); - $this->assertInternalType('array', $attrs); + $this->assertIsArray($attrs); $this->assertContains($attrName, $attrs); $cr->removeAttribute($attrName); $this->assertNull($cr->getAttribute($attrName)); diff --git a/tests/Connecting/WorkspaceReadMethodsTest.php b/tests/Connecting/WorkspaceReadMethodsTest.php index a321c3e5..20de6376 100644 --- a/tests/Connecting/WorkspaceReadMethodsTest.php +++ b/tests/Connecting/WorkspaceReadMethodsTest.php @@ -35,7 +35,7 @@ class WorkspaceReadMethodsTest extends BaseCase //4.5 Workspace Read Methods - public function setUp() + public function setUp(): void { parent::setUp(); @@ -98,7 +98,7 @@ public function testGetAccessibleWorkspaceNames() { $names = $this->workspace->getAccessibleWorkspaceNames(); - $this->assertInternalType('array', $names); + $this->assertIsArray($names); $this->assertContains(self::$loader->getWorkspaceName(), $names); } diff --git a/tests/Export/ExportRepositoryContentTest.php b/tests/Export/ExportRepositoryContentTest.php index 95dde14f..7791873d 100644 --- a/tests/Export/ExportRepositoryContentTest.php +++ b/tests/Export/ExportRepositoryContentTest.php @@ -21,7 +21,7 @@ //7 Export Repository Content class ExportRepositoryContentTest extends BaseCase { - public static function setupBeforeClass($fixtures = '07_Export/systemview') + public static function setupBeforeClass($fixtures = '07_Export/systemview'): void { parent::setupBeforeClass($fixtures); } diff --git a/tests/Import/ImportRepositoryContentTest.php b/tests/Import/ImportRepositoryContentTest.php index 85c97244..2fd1ecd8 100644 --- a/tests/Import/ImportRepositoryContentTest.php +++ b/tests/Import/ImportRepositoryContentTest.php @@ -25,7 +25,7 @@ //6.5 Import Repository Content class ImportRepositoryContentTest extends BaseCase { - public static function setupBeforeClass($fixtures = null) + public static function setupBeforeClass($fixtures = null): void { parent::setupBeforeClass($fixtures); } diff --git a/tests/Locking/LockManagerTest.php b/tests/Locking/LockManagerTest.php index 28b19ed4..3acc8840 100644 --- a/tests/Locking/LockManagerTest.php +++ b/tests/Locking/LockManagerTest.php @@ -32,7 +32,7 @@ class LockManagerTest extends BaseCase /** @var LockManagerInterface */ private $lm; - public function setUp() + public function setUp(): void { parent::setUp(); $this->lm = $this->session->getWorkspace()->getLockManager(); @@ -42,11 +42,10 @@ public function setUp() /** * Try to lock a non-lockable node. - * - * @expectedException \PHPCR\Lock\LockException */ public function testCannotLockNonLockableNodes() { + $this->expectException(LockException::class); $this->recreateTestNode('non-lockable', false); $this->lm->lock('/non-lockable', true, true, 3, ''); } diff --git a/tests/NodeTypeDiscovery/NodeDefinitionTest.php b/tests/NodeTypeDiscovery/NodeDefinitionTest.php index 63a01d3f..150f5c58 100644 --- a/tests/NodeTypeDiscovery/NodeDefinitionTest.php +++ b/tests/NodeTypeDiscovery/NodeDefinitionTest.php @@ -56,7 +56,7 @@ class NodeDefinitionTest extends BaseCase */ private $hierarchyNodeDef; - public static function setupBeforeClass($fixtures = false) + public static function setupBeforeClass($fixtures = false): void { parent::setupBeforeClass($fixtures); /** @var NodeTypeManagerInterface $ntm */ @@ -66,20 +66,20 @@ public static function setupBeforeClass($fixtures = false) self::$hierarchyNodeType = $ntm->getNodeType('nt:hierarchyNode'); } - public function setUp() + public function setUp(): void { parent::setUp(); try { $defs = self::$file->getChildNodeDefinitions(); - $this->assertInternalType('array', $defs); + $this->assertIsArray($defs); $this->assertCount(1, $defs); $this->content = current($defs); $this->assertInstanceOf(NodeDefinitionInterface::class, $this->content); $this->assertEquals('jcr:content', $this->content->getName()); $defs = self::$folder->getChildNodeDefinitions(); - $this->assertInternalType('array', $defs); + $this->assertIsArray($defs); $this->assertCount(1, $defs); $this->hierarchyNodeDef = next($defs); $this->assertInstanceOf(NodeDefinitionInterface::class, $this->hierarchyNodeDef); @@ -107,24 +107,24 @@ public function testDefaultPrimaryTypeName() public function getRequiredPrimaryTypeNames() { $names = $this->content->getRequiredPrimaryTypeNames(); - $this->assertInternalType('array', $names); + $this->assertIsArray($names); $this->assertCount(1, $names); $this->assertEquals('nt:base', $names[0]); $names = $this->hierarchyNodeDef->getRequiredPrimaryTypeNames(); - $this->assertInternalType('array', $names); + $this->assertIsArray($names); $this->assertCount(1, $names); $this->assertEquals('nt:hierarchyNode', $names[0]); } public function getRequiredPrimaryTypes() { $types = $this->content->getRequiredPrimaryTypeNames(); - $this->assertInternalType('array', $types); + $this->assertIsArray($types); $this->assertCount(1, $types); $this->assertEquals(self::$base, $types[0]); $types = $this->hierarchyNodeDef->getRequiredPrimaryTypeNames(); - $this->assertInternalType('array', $types); + $this->assertIsArray($types); $this->assertCount(1, $types); $this->assertEquals(self::$hierarchyNodeType, $types[0]); } diff --git a/tests/NodeTypeDiscovery/NodeNodeTypeReadMethodsTest.php b/tests/NodeTypeDiscovery/NodeNodeTypeReadMethodsTest.php index da2022ce..909cbac0 100644 --- a/tests/NodeTypeDiscovery/NodeNodeTypeReadMethodsTest.php +++ b/tests/NodeTypeDiscovery/NodeNodeTypeReadMethodsTest.php @@ -34,7 +34,7 @@ class NodeNodeTypeReadMethodsTest extends BaseCase */ protected $deepnode; - public function setUp() + public function setUp(): void { parent::setUp(); diff --git a/tests/NodeTypeDiscovery/NodeTypeDiscoveryTest.php b/tests/NodeTypeDiscovery/NodeTypeDiscoveryTest.php index b2fafc23..d67525de 100644 --- a/tests/NodeTypeDiscovery/NodeTypeDiscoveryTest.php +++ b/tests/NodeTypeDiscovery/NodeTypeDiscoveryTest.php @@ -52,7 +52,7 @@ class NodeTypeDiscoveryTest extends BaseCase 'mix:title', ]; - public function setUp() + public function setUp(): void { parent::setUp(false); diff --git a/tests/NodeTypeDiscovery/NodeTypeTest.php b/tests/NodeTypeDiscovery/NodeTypeTest.php index c03148a8..47bc8a86 100644 --- a/tests/NodeTypeDiscovery/NodeTypeTest.php +++ b/tests/NodeTypeDiscovery/NodeTypeTest.php @@ -50,7 +50,7 @@ class NodeTypeTest extends BaseCase */ private static $created; - public static function setupBeforeClass($fixtures = false) + public static function setupBeforeClass($fixtures = false): void { parent::setupBeforeClass($fixtures); $ntm = self::$staticSharedFixture['session']->getWorkspace()->getNodeTypeManager(); @@ -64,7 +64,7 @@ public static function setupBeforeClass($fixtures = false) public function testGetSupertypes() { $types = self::$file->getSupertypes(); - $this->assertInternalType('array', $types); + $this->assertIsArray($types); $typenames = []; foreach ($types as $type) { @@ -77,14 +77,14 @@ public function testGetSupertypes() public function testGetSupertypesNone() { $types = self::$base->getSupertypes(); - $this->assertInternalType('array', $types); + $this->assertIsArray($types); $this->assertCount(0, $types); } public function testGetDeclaredSupertypes() { $types = self::$file->getDeclaredSupertypes(); - $this->assertInternalType('array', $types); + $this->assertIsArray($types); $typenames = []; foreach ($types as $type) { @@ -96,7 +96,7 @@ public function testGetDeclaredSupertypes() $this->assertNotContains('nt:base', $typenames); $types = self::$resource->getDeclaredSupertypes(); - $this->assertInternalType('array', $types); + $this->assertIsArray($types); $typenames = []; foreach ($types as $type) { @@ -112,7 +112,7 @@ public function testGetDeclaredSupertypes() public function testGetDeclaredSupertypesNone() { $types = self::$base->getDeclaredSupertypes(); - $this->assertInternalType('array', $types); + $this->assertIsArray($types); $this->assertCount(0, $types); } @@ -155,7 +155,7 @@ public function testGetDeclaredSubtypes() public function testGetChildNodeDefinitions() { $children = self::$file->getChildNodeDefinitions(); - $this->assertInternalType('array', $children); + $this->assertIsArray($children); $this->assertCount(1, $children); $child = current($children); $this->assertInstanceOf(NodeDefinitionInterface::class, $child); @@ -166,7 +166,7 @@ public function testGetChildNodeDefinitions() public function testGetPropertyDefinitions() { $properties = self::$file->getPropertyDefinitions(); - $this->assertInternalType('array', $properties); + $this->assertIsArray($properties); $this->assertCount(4, $properties); $names = []; diff --git a/tests/NodeTypeDiscovery/PropertyDefinitionTest.php b/tests/NodeTypeDiscovery/PropertyDefinitionTest.php index f3e71f8c..b3437f5f 100644 --- a/tests/NodeTypeDiscovery/PropertyDefinitionTest.php +++ b/tests/NodeTypeDiscovery/PropertyDefinitionTest.php @@ -94,7 +94,7 @@ class PropertyDefinitionTest extends BaseCase */ private $data; // - public static function setupBeforeClass($fixtures = false) + public static function setupBeforeClass($fixtures = false): void { parent::setupBeforeClass(); // load default fixtures /** @var NodeTypeManagerInterface $ntm */ @@ -105,12 +105,12 @@ public static function setupBeforeClass($fixtures = false) self::$resource = $ntm->getNodeType('nt:resource'); } - public function setUp() + public function setUp(): void { parent::setUp(); try { $defs = self::$base->getPropertyDefinitions(); - $this->assertInternalType('array', $defs); + $this->assertIsArray($defs); foreach ($defs as $def) { $this->assertInstanceOf(PropertyDefinitionInterface::class, $def); switch ($def->getName()) { @@ -126,7 +126,7 @@ public function setUp() $this->assertNotNull($this->mixinTypes); $defs = self::$address->getPropertyDefinitions(); - $this->assertInternalType('array', $defs); + $this->assertIsArray($defs); foreach ($defs as $def) { $this->assertInstanceOf(PropertyDefinitionInterface::class, $def); switch ($def->getName()) { @@ -147,7 +147,7 @@ public function setUp() $this->assertNotNull($this->id); $defs = self::$mix_created->getPropertyDefinitions(); - $this->assertInternalType('array', $defs); + $this->assertIsArray($defs); foreach ($defs as $def) { $this->assertInstanceOf(PropertyDefinitionInterface::class, $def); @@ -159,7 +159,7 @@ public function setUp() $this->assertNotNull($this->created); $defs = self::$resource->getPropertyDefinitions(); - $this->assertInternalType('array', $defs); + $this->assertIsArray($defs); foreach ($defs as $def) { $this->assertInstanceOf(PropertyDefinitionInterface::class, $def); if ('jcr:data' === $def->getName()) { @@ -196,7 +196,7 @@ public function testGetAvailableQueryOperators() public function testGetDefaultValues() { $def = $this->primaryType->getDefaultValues(); - $this->assertInternalType('array', $def); + $this->assertIsArray($def); $this->assertCount(0, $def); // no built-in types with default value } @@ -220,7 +220,7 @@ public function testGetRequiredType() public function testGetValueConstraints() { $constraint = $this->primaryType->getValueConstraints(); - $this->assertInternalType('array', $constraint); + $this->assertIsArray($constraint); $this->assertCount(0, $constraint); // no built-in type with constraints } @@ -228,24 +228,24 @@ public function testGetValueConstraints() public function testIsFullTextSearchable() { $b = $this->primaryType->isFullTextSearchable(); - $this->assertInternalType('boolean', $b); + $this->assertIsBool($b); $this->assertTrue($b); } public function testIsMultiple() { $b = $this->primaryType->isMultiple(); - $this->assertInternalType('boolean', $b); + $this->assertIsBool($b); $this->assertFalse($b); $b = $this->mixinTypes->isMultiple(); - $this->assertInternalType('boolean', $b); + $this->assertIsBool($b); $this->assertTrue($b); } public function testIsQueryOrderable() { $b = $this->primaryType->isQueryOrderable(); - $this->assertInternalType('boolean', $b); + $this->assertIsBool($b); $this->assertTrue($b); } diff --git a/tests/NodeTypeManagement/NodeTypeBaseCase.php b/tests/NodeTypeManagement/NodeTypeBaseCase.php index 1b81260e..ad1ea3dd 100644 --- a/tests/NodeTypeManagement/NodeTypeBaseCase.php +++ b/tests/NodeTypeManagement/NodeTypeBaseCase.php @@ -36,7 +36,7 @@ abstract class NodeTypeBaseCase extends BaseCase */ protected $session; - protected function setUp() + protected function setUp(): void { $this->renewSession(); // reset session diff --git a/tests/Observation/ObservationManagerTest.php b/tests/Observation/ObservationManagerTest.php index a9460cc1..0ba4cb67 100644 --- a/tests/Observation/ObservationManagerTest.php +++ b/tests/Observation/ObservationManagerTest.php @@ -45,13 +45,13 @@ class ObservationManagerTest extends BaseCase */ private $nodePath; - public static function setupBeforeClass($fixtures = '12_Observation/manager') + public static function setupBeforeClass($fixtures = '12_Observation/manager'): void { parent::setupBeforeClass($fixtures); sleep(1); // To avoid having the same date as the journal entries generated by the fixtures loading } - public function setUp() + public function setUp(): void { parent::setUp(); //all tests in this suite rely on the trick to have the node populated from the fixtures @@ -410,7 +410,8 @@ protected function expectEvents(EventJournalInterface $journal, $startDate) // Adding a node will cause a NODE_ADDED + PROPERTY_ADDED (for the primary node type) // The order is implementation specific (Jackrabbit will trigger the prop added before the node added event) - $this->expectEventsInAnyOrder($journal, + $this->expectEventsInAnyOrder( + $journal, [ [EventInterface::NODE_ADDED, $this->nodePath.'/child'], [EventInterface::PROPERTY_ADDED, $this->nodePath.'/child/jcr%3aprimaryType'], @@ -454,7 +455,8 @@ protected function expectEvents(EventJournalInterface $journal, $startDate) // Same problem as before. Moving a node will cause a NODE_REMOVED + NODE_ADDED + NODE_MOVED // The order of the events is implementation specific. - $events = $this->expectEventsInAnyOrder($journal, + $events = $this->expectEventsInAnyOrder( + $journal, [ [EventInterface::NODE_REMOVED, $this->nodePath.'/child'], [EventInterface::NODE_ADDED, $this->nodePath.'/moved'], diff --git a/tests/OrderableChildNodes/OrderBeforeTest.php b/tests/OrderableChildNodes/OrderBeforeTest.php index a6e53220..21c33b17 100644 --- a/tests/OrderableChildNodes/OrderBeforeTest.php +++ b/tests/OrderableChildNodes/OrderBeforeTest.php @@ -20,12 +20,12 @@ */ class OrderBeforeTest extends BaseCase { - public static function setupBeforeClass($fixtures = '23_OrderableChildNodes/orderable') + public static function setupBeforeClass($fixtures = '23_OrderableChildNodes/orderable'): void { parent::setupBeforeClass($fixtures); } - protected function setUp() + protected function setUp(): void { $this->renewSession(); parent::setUp(); diff --git a/tests/PhpcrUtils/CndParserTest.php b/tests/PhpcrUtils/CndParserTest.php index 6981a521..95e52ab1 100644 --- a/tests/PhpcrUtils/CndParserTest.php +++ b/tests/PhpcrUtils/CndParserTest.php @@ -27,7 +27,7 @@ class CndParserTest extends BaseCase /** @var CndParser */ private $cndParser; - public function setUp() + public function setUp(): void { parent::setUp(); $this->cndParser = new CndParser($this->session->getWorkspace()->getNodeTypeManager()); diff --git a/tests/PhpcrUtils/NodeHelperTest.php b/tests/PhpcrUtils/NodeHelperTest.php index 51a2c3e1..49bf7eed 100644 --- a/tests/PhpcrUtils/NodeHelperTest.php +++ b/tests/PhpcrUtils/NodeHelperTest.php @@ -20,7 +20,7 @@ */ class NodeHelperTest extends BaseCase { - protected function setUp() + protected function setUp(): void { if (!class_exists(NodeHelper::class)) { $this->markTestSkipped('This testbed does not have phpcr-utils available'); diff --git a/tests/PhpcrUtils/PurgeTest.php b/tests/PhpcrUtils/PurgeTest.php index ad47f2d5..8e78cb35 100644 --- a/tests/PhpcrUtils/PurgeTest.php +++ b/tests/PhpcrUtils/PurgeTest.php @@ -17,12 +17,12 @@ class PurgeTest extends BaseCase { - public static function setupBeforeClass($fixtures = '11_Import/empty') + public static function setupBeforeClass($fixtures = '11_Import/empty'): void { parent::setupBeforeClass($fixtures); } - protected function setUp() + protected function setUp(): void { if (!class_exists(NodeHelper::class)) { $this->markTestSkipped('This testbed does not have phpcr-utils available'); diff --git a/tests/Query/CharacterTest.php b/tests/Query/CharacterTest.php index 1a7f4539..c9f3767b 100644 --- a/tests/Query/CharacterTest.php +++ b/tests/Query/CharacterTest.php @@ -17,7 +17,7 @@ class CharacterTest extends BaseCase { - public static function setupBeforeClass($fixtures = '06_Query/characters') + public static function setupBeforeClass($fixtures = '06_Query/characters'): void { parent::setupBeforeClass($fixtures); self::$staticSharedFixture['qm'] = self::$staticSharedFixture['session']->getWorkspace()->getQueryManager(); @@ -30,7 +30,8 @@ public function testPropertyWithBackslash() { /** @var QueryManagerInterface $queryManager */ $queryManager = $this->sharedFixture['qm']; - $query = $queryManager->createQuery(' + $query = $queryManager->createQuery( + ' SELECT data.class FROM [nt:unstructured] AS data WHERE data.class = "PHPCR\Query\QueryInterface"', @@ -51,7 +52,8 @@ public function testPropertyWithDoubleBackslash() { /** @var QueryManagerInterface $queryManager */ $queryManager = $this->sharedFixture['qm']; - $query = $queryManager->createQuery(' + $query = $queryManager->createQuery( + ' SELECT data.doublebackslash FROM [nt:unstructured] AS data WHERE data.doublebackslash = "PHPCR\\\\Query\\\\QueryInterface"', @@ -72,7 +74,8 @@ public function testPropertyWithQuotes() { /** @var QueryManagerInterface $queryManager */ $queryManager = $this->sharedFixture['qm']; - $query = $queryManager->createQuery(sprintf(' + $query = $queryManager->createQuery( + sprintf(' SELECT data.quotes FROM [nt:unstructured] AS data WHERE data.quotes = "%s" @@ -94,7 +97,8 @@ public function testPropertyWithQuotesAndBackslash() { /** @var QueryManagerInterface $queryManager */ $queryManager = $this->sharedFixture['qm']; - $query = $queryManager->createQuery(sprintf(' + $query = $queryManager->createQuery( + sprintf(' SELECT data.quoteandbackslash FROM [nt:unstructured] AS data WHERE data.quoteandbackslash = "%s" @@ -113,7 +117,8 @@ public function testQueryWithColon() { /** @var QueryManagerInterface $queryManager */ $queryManager = $this->sharedFixture['qm']; - $query = $queryManager->createQuery(' + $query = $queryManager->createQuery( + ' SELECT data.property FROM [nt:unstructured] AS data WHERE data.property = "foo:bar" @@ -128,7 +133,8 @@ public function testQueryWithAmpersand() { /** @var QueryManagerInterface $queryManager */ $queryManager = $this->sharedFixture['qm']; - $query = $queryManager->createQuery(' + $query = $queryManager->createQuery( + ' SELECT data.ampersand FROM [nt:unstructured] AS data WHERE data.ampersand = "foo & bar&baz" diff --git a/tests/Query/NodeViewTest.php b/tests/Query/NodeViewTest.php index e3df18c9..f385aeb0 100644 --- a/tests/Query/NodeViewTest.php +++ b/tests/Query/NodeViewTest.php @@ -21,7 +21,7 @@ class NodeViewTest extends QueryBaseCase { public $nodeIterator; - public function setUp() + public function setUp(): void { parent::setUp(); diff --git a/tests/Query/QOM/ConvertQueriesBackAndForthTest.php b/tests/Query/QOM/ConvertQueriesBackAndForthTest.php index 14d40372..35f947c5 100644 --- a/tests/Query/QOM/ConvertQueriesBackAndForthTest.php +++ b/tests/Query/QOM/ConvertQueriesBackAndForthTest.php @@ -41,7 +41,7 @@ class ConvertQueriesBackAndForthTest extends BaseCase */ protected $qomParser; - public function setUp() + public function setUp(): void { parent::setUp(); diff --git a/tests/Query/QOM/QomTestQueries.php b/tests/Query/QOM/QomTestQueries.php index e3cef18d..8aa214b9 100644 --- a/tests/Query/QOM/QomTestQueries.php +++ b/tests/Query/QOM/QomTestQueries.php @@ -51,7 +51,8 @@ public static function getQueries(QueryObjectModelFactoryInterface $factory) $factory->selector('file', 'nt:file'), $factory->selector('folder', 'nt:folder'), Constants::JCR_JOIN_TYPE_INNER, - $factory->equiJoinCondition('file', 'prop1', 'folder', 'prop2')), + $factory->equiJoinCondition('file', 'prop1', 'folder', 'prop2') + ), null, [], [] @@ -65,7 +66,8 @@ public static function getQueries(QueryObjectModelFactoryInterface $factory) $factory->selector('file', 'nt:file'), $factory->selector('folder', 'nt:folder'), Constants::JCR_JOIN_TYPE_LEFT_OUTER, - $factory->equiJoinCondition('file', 'prop1', 'folder', 'prop2')), + $factory->equiJoinCondition('file', 'prop1', 'folder', 'prop2') + ), null, [], [] @@ -79,7 +81,8 @@ public static function getQueries(QueryObjectModelFactoryInterface $factory) $factory->selector('file', 'nt:file'), $factory->selector('folder', 'nt:folder'), Constants::JCR_JOIN_TYPE_RIGHT_OUTER, - $factory->equiJoinCondition('file', 'prop1', 'folder', 'prop2')), + $factory->equiJoinCondition('file', 'prop1', 'folder', 'prop2') + ), null, [], [] @@ -98,7 +101,8 @@ public static function getQueries(QueryObjectModelFactoryInterface $factory) ), $factory->selector('folder2', 'nt:folder'), Constants::JCR_JOIN_TYPE_INNER, - $factory->equiJoinCondition('file', 'prop1', 'folder', 'prop2')), + $factory->equiJoinCondition('file', 'prop1', 'folder', 'prop2') + ), null, [], [] @@ -116,7 +120,8 @@ public static function getQueries(QueryObjectModelFactoryInterface $factory) $factory->selector('file', 'nt:file'), $factory->selector('folder', 'nt:folder'), Constants::JCR_JOIN_TYPE_INNER, - $factory->sameNodeJoinCondition('file', 'folder')), + $factory->sameNodeJoinCondition('file', 'folder') + ), null, [], [] @@ -130,7 +135,8 @@ public static function getQueries(QueryObjectModelFactoryInterface $factory) $factory->selector('file', 'nt:file'), $factory->selector('folder', 'nt:folder'), Constants::JCR_JOIN_TYPE_INNER, - $factory->sameNodeJoinCondition('file', 'folder', '/home')), + $factory->sameNodeJoinCondition('file', 'folder', '/home') + ), null, [], [] @@ -148,7 +154,8 @@ public static function getQueries(QueryObjectModelFactoryInterface $factory) $factory->selector('child', 'nt:file'), $factory->selector('parent', 'nt:folder'), Constants::JCR_JOIN_TYPE_INNER, - $factory->childNodeJoinCondition('child', 'parent')), + $factory->childNodeJoinCondition('child', 'parent') + ), null, [], [] @@ -166,7 +173,8 @@ public static function getQueries(QueryObjectModelFactoryInterface $factory) $factory->selector('descendant', 'nt:file'), $factory->selector('ancestor', 'nt:folder'), Constants::JCR_JOIN_TYPE_INNER, - $factory->descendantNodeJoinCondition('descendant', 'ancestor')), + $factory->descendantNodeJoinCondition('descendant', 'ancestor') + ), null, [], [] @@ -322,7 +330,8 @@ public static function getQueries(QueryObjectModelFactoryInterface $factory) $factory->selector('file', 'nt:file'), $factory->andConstraint( $factory->propertyExistence('file', 'prop1'), - $factory->propertyExistence('file', 'prop2')), + $factory->propertyExistence('file', 'prop2') + ), [], [] ) @@ -338,7 +347,8 @@ public static function getQueries(QueryObjectModelFactoryInterface $factory) $factory->selector('file', 'nt:file'), $factory->orConstraint( $factory->propertyExistence('file', 'prop1'), - $factory->propertyExistence('file', 'prop2')), + $factory->propertyExistence('file', 'prop2') + ), [], [] ) @@ -353,7 +363,8 @@ public static function getQueries(QueryObjectModelFactoryInterface $factory) $factory->createQuery( $factory->selector('file', 'nt:file'), $factory->notConstraint( - $factory->propertyExistence('file', 'prop1')), + $factory->propertyExistence('file', 'prop1') + ), [], [] ) @@ -370,7 +381,8 @@ public static function getQueries(QueryObjectModelFactoryInterface $factory) $factory->comparison( $factory->nodeName('file'), Constants::JCR_OPERATOR_LIKE, - $factory->literal('literal2')), + $factory->literal('literal2') + ), [], [] ) @@ -472,7 +484,8 @@ public static function getQueries(QueryObjectModelFactoryInterface $factory) $factory->comparison( $factory->propertyValue('file', 'prop'), Constants::JCR_OPERATOR_LIKE, - $factory->literal('literal')), + $factory->literal('literal') + ), [], [] ) @@ -485,7 +498,8 @@ public static function getQueries(QueryObjectModelFactoryInterface $factory) $factory->comparison( $factory->propertyValue('sel', 'prop'), Constants::JCR_OPERATOR_GREATER_THAN, - $factory->literal(new \DateTime('2013-04-15 +02:00'))), + $factory->literal(new \DateTime('2013-04-15 +02:00')) + ), [], [] ) @@ -502,7 +516,8 @@ public static function getQueries(QueryObjectModelFactoryInterface $factory) $factory->comparison( $factory->length($factory->propertyValue('file', 'prop')), Constants::JCR_OPERATOR_LIKE, - $factory->literal('literal')), + $factory->literal('literal') + ), [], [] ) @@ -519,7 +534,8 @@ public static function getQueries(QueryObjectModelFactoryInterface $factory) $factory->comparison( $factory->nodeName('file'), Constants::JCR_OPERATOR_LIKE, - $factory->literal('literal')), + $factory->literal('literal') + ), [], [] ) @@ -536,7 +552,8 @@ public static function getQueries(QueryObjectModelFactoryInterface $factory) $factory->comparison( $factory->nodeLocalName('file'), Constants::JCR_OPERATOR_LIKE, - $factory->literal('literal')), + $factory->literal('literal') + ), [], [] ) @@ -553,7 +570,8 @@ public static function getQueries(QueryObjectModelFactoryInterface $factory) $factory->comparison( $factory->fullTextSearchScore('file'), Constants::JCR_OPERATOR_LIKE, - $factory->literal('literal')), + $factory->literal('literal') + ), [], [] ) @@ -570,7 +588,8 @@ public static function getQueries(QueryObjectModelFactoryInterface $factory) $factory->comparison( $factory->lowerCase($factory->nodeName('file')), Constants::JCR_OPERATOR_LIKE, - $factory->literal('literal')), + $factory->literal('literal') + ), [], [] ) @@ -587,7 +606,8 @@ public static function getQueries(QueryObjectModelFactoryInterface $factory) $factory->comparison( $factory->upperCase($factory->nodeName('file')), Constants::JCR_OPERATOR_LIKE, - $factory->literal('literal')), + $factory->literal('literal') + ), [], [] ) @@ -604,7 +624,8 @@ public static function getQueries(QueryObjectModelFactoryInterface $factory) $factory->comparison( $factory->upperCase($factory->nodeName('file')), Constants::JCR_OPERATOR_LIKE, - $factory->bindVariable('var')), + $factory->bindVariable('var') + ), [], [] ) diff --git a/tests/Query/QOM/QomToSql2ConverterTest.php b/tests/Query/QOM/QomToSql2ConverterTest.php index 1f77061b..c5d790c1 100644 --- a/tests/Query/QOM/QomToSql2ConverterTest.php +++ b/tests/Query/QOM/QomToSql2ConverterTest.php @@ -42,7 +42,7 @@ class QomToSql2ConverterTest extends BaseCase protected $queries; - public function setUp() + public function setUp(): void { parent::setUp(); diff --git a/tests/Query/QOM/Sql2ScannerTest.php b/tests/Query/QOM/Sql2ScannerTest.php index 7d3d553d..f58811ba 100644 --- a/tests/Query/QOM/Sql2ScannerTest.php +++ b/tests/Query/QOM/Sql2ScannerTest.php @@ -21,7 +21,7 @@ class Sql2ScannerTest extends \PHPCR\Test\BaseCase protected $sql2; protected $tokens; - public function setUp() + public function setUp(): void { parent::setUp(); @@ -38,8 +38,13 @@ public function setUp() public function testConstructor() { $scanner = new Sql2Scanner($this->sql2); - $this->assertAttributeEquals($this->sql2, 'sql2', $scanner); - $this->assertAttributeEquals($this->tokens, 'tokens', $scanner); + $refl = new \ReflectionClass($scanner); + $sql2Property = $refl->getProperty('sql2'); + $sql2Property->setAccessible(true); + $this->assertSame($this->sql2, $sql2Property->getValue($scanner)); + $tokensProperty = $refl->getProperty('tokens'); + $tokensProperty->setAccessible(true); + $this->assertSame($this->tokens, $tokensProperty->getValue($scanner)); } public function testLookupAndFetch() diff --git a/tests/Query/QOM/Sql2ToQomConverterTest.php b/tests/Query/QOM/Sql2ToQomConverterTest.php index b97f097d..662231c2 100644 --- a/tests/Query/QOM/Sql2ToQomConverterTest.php +++ b/tests/Query/QOM/Sql2ToQomConverterTest.php @@ -28,7 +28,7 @@ class Sql2ToQomConverterTest extends \PHPCR\Test\BaseCase /** @var Sql2ToQomQueryConverter */ protected $parser; - public function setUp() + public function setUp(): void { parent::setUp(); @@ -55,7 +55,7 @@ public function testColumnsAndSelector() $this->assertEquals('nt:unstructured', $query->getSource()->getNodeTypeName()); $cols = $query->getColumns(); - $this->assertInternalType('array', $cols); + $this->assertIsArray($cols); $this->assertCount(2, $cols); $this->assertEquals('u', $cols[0]->getselectorName()); diff --git a/tests/Query/QueryBaseCase.php b/tests/Query/QueryBaseCase.php index 5ec8df7d..368ede9e 100644 --- a/tests/Query/QueryBaseCase.php +++ b/tests/Query/QueryBaseCase.php @@ -36,7 +36,7 @@ abstract class QueryBaseCase extends BaseCase * * @param string $fixture name of the fixture to load, defaults to general/base */ - public static function setupBeforeClass($fixture = 'general/base') + public static function setupBeforeClass($fixture = 'general/base'): void { parent::setupBeforeClass($fixture); self::$staticSharedFixture['qm'] = self::$staticSharedFixture['session']->getWorkspace()->getQueryManager(); @@ -45,11 +45,12 @@ public static function setupBeforeClass($fixture = 'general/base') /** * in addition to base stuff, prepare $this->query with a simple select query. */ - public function setUp() + public function setUp(): void { parent::setUp(); - $this->query = $this->sharedFixture['qm']->createQuery(' + $this->query = $this->sharedFixture['qm']->createQuery( + ' SELECT * FROM [nt:folder] WHERE ISDESCENDANTNODE([/tests_general_base]) diff --git a/tests/Query/QueryManagerTest.php b/tests/Query/QueryManagerTest.php index 54c2d5dd..c0023de6 100644 --- a/tests/Query/QueryManagerTest.php +++ b/tests/Query/QueryManagerTest.php @@ -23,7 +23,7 @@ */ class QueryManagerTest extends QueryBaseCase { - public static function setupBeforeClass($fixture = 'general/query') + public static function setupBeforeClass($fixture = 'general/query'): void { parent::setupBeforeClass($fixture); } @@ -66,7 +66,7 @@ public function testGetQOMFactory() public function testGetSupportedQueryLanguages() { $ret = $this->sharedFixture['qm']->getSupportedQueryLanguages(); - $this->assertInternalType('array', $ret); + $this->assertIsArray($ret); $this->assertContains('JCR-SQL2', $ret); $this->assertContains('JCR-JQOM', $ret); } diff --git a/tests/Query/QueryObjectQOMTest.php b/tests/Query/QueryObjectQOMTest.php index 43093de3..4b9a880e 100644 --- a/tests/Query/QueryObjectQOMTest.php +++ b/tests/Query/QueryObjectQOMTest.php @@ -37,7 +37,7 @@ class QueryObjectQOMTest extends QueryBaseCase */ protected $query; - public function setUp() + public function setUp(): void { parent::setUp(); diff --git a/tests/Query/QueryResultsTest.php b/tests/Query/QueryResultsTest.php index 88e71ed7..0c30289f 100644 --- a/tests/Query/QueryResultsTest.php +++ b/tests/Query/QueryResultsTest.php @@ -33,7 +33,7 @@ class QueryResultsTest extends QueryBaseCase 'jcr:score' ]; - public function setUp() + public function setUp(): void { parent::setUp(); @@ -68,7 +68,8 @@ public function testGetColumnNames() public function testGetAliasColumnNames() { - $query = $this->sharedFixture['qm']->createQuery(' + $query = $this->sharedFixture['qm']->createQuery( + ' SELECT [jcr:mimeType] AS bar, stringToCompare as foo, [nt:unstructured].longNumberToCompare, ding FROM [nt:unstructured] WHERE stringToCompare IS NOT NULL @@ -163,7 +164,8 @@ public function testReadPropertyContentFromResults() public function testCompareNumberFields() { - $query = $this->sharedFixture['qm']->createQuery(' + $query = $this->sharedFixture['qm']->createQuery( + ' SELECT data.longNumberToCompare FROM [nt:unstructured] AS data WHERE data.longNumberToCompare > 2 @@ -185,7 +187,8 @@ public function testCompareNumberFields() public function testCompareNumberFieldsMulti() { - $query = $this->sharedFixture['qm']->createQuery(' + $query = $this->sharedFixture['qm']->createQuery( + ' SELECT data.longNumberToCompareMulti FROM [nt:unstructured] AS data WHERE data.longNumberToCompareMulti = 2 @@ -230,7 +233,7 @@ public function testBooleanField() { $query = $this->sharedFixture['qm']->createQuery( 'SELECT data.thisIsNo FROM [nt:unstructured] as data WHERE data.thisIsNo = false', - QueryInterface::JCR_SQL2 + QueryInterface::JCR_SQL2 ); $result = $query->execute(); @@ -245,7 +248,7 @@ public function testBooleanField() $query = $this->sharedFixture['qm']->createQuery( 'SELECT data.thisIsYes FROM [nt:unstructured] as data WHERE data.thisIsYes = true', - QueryInterface::JCR_SQL2 + QueryInterface::JCR_SQL2 ); $result = $query->execute(); diff --git a/tests/Query/QuerySql2OperationsTest.php b/tests/Query/QuerySql2OperationsTest.php index 1cf89c74..968c7fbd 100644 --- a/tests/Query/QuerySql2OperationsTest.php +++ b/tests/Query/QuerySql2OperationsTest.php @@ -23,7 +23,8 @@ class QuerySql2OperationsTest extends QueryBaseCase public function testQueryField() { /** @var $query QueryInterface */ - $query = $this->sharedFixture['qm']->createQuery(' + $query = $this->sharedFixture['qm']->createQuery( + ' SELECT foo FROM [nt:unstructured] WHERE foo = "bar" @@ -53,7 +54,8 @@ public function testQueryField() public function testQueryFieldDate() { /** @var $query QueryInterface */ - $query = $this->sharedFixture['qm']->createQuery(" + $query = $this->sharedFixture['qm']->createQuery( + " SELECT * FROM [nt:base] WHERE [mydateprop] <= CAST('2011-04-27T13:01:07.472+02:00' AS DATE) @@ -73,7 +75,8 @@ public function testQueryFieldDate() public function testQueryFieldSomeNull() { /** @var $query QueryInterface */ - $query = $this->sharedFixture['qm']->createQuery(' + $query = $this->sharedFixture['qm']->createQuery( + ' SELECT foo FROM [nt:unstructured] WHERE ISDESCENDANTNODE([/tests_general_base]) @@ -106,7 +109,8 @@ public function testQueryFieldSomeNull() public function testQueryFieldSelector() { /** @var $query QueryInterface */ - $query = $this->sharedFixture['qm']->createQuery(' + $query = $this->sharedFixture['qm']->createQuery( + ' SELECT [nt:unstructured].foo FROM [nt:unstructured] WHERE [nt:unstructured].foo = "bar" @@ -130,7 +134,8 @@ public function testQueryFieldSelector() public function testQueryFieldSelectorWithAlias() { /** @var $query QueryInterface */ - $query = $this->sharedFixture['qm']->createQuery(' + $query = $this->sharedFixture['qm']->createQuery( + ' SELECT data.foo FROM [nt:unstructured] AS data WHERE data.foo = "bar" @@ -153,7 +158,8 @@ public function testQueryFieldSelectorWithAlias() public function testQueryJoin() { /** @var $query QueryInterface */ - $query = $this->sharedFixture['qm']->createQuery(' + $query = $this->sharedFixture['qm']->createQuery( + ' SELECT [nt:unstructured].longNumber FROM [nt:file] INNER JOIN [nt:unstructured] @@ -178,7 +184,8 @@ public function testQueryJoin() public function testQueryJoinWithAlias() { /** @var $query QueryInterface */ - $query = $this->sharedFixture['qm']->createQuery(' + $query = $this->sharedFixture['qm']->createQuery( + ' SELECT content.longNumber FROM [nt:file] AS file INNER JOIN [nt:unstructured] AS content @@ -203,7 +210,8 @@ public function testQueryJoinWithAlias() public function testQueryJoinNested() { /** @var $query QueryInterface */ - $query = $this->sharedFixture['qm']->createQuery(' + $query = $this->sharedFixture['qm']->createQuery( + ' SELECT content.longNumber FROM [nt:folder] AS folder INNER JOIN [nt:file] AS file @@ -343,7 +351,8 @@ public function testQueryJoinReference() public function testQueryJoinChildnode() { /** @var $query QueryInterface */ - $query = $this->sharedFixture['qm']->createQuery(' + $query = $this->sharedFixture['qm']->createQuery( + ' SELECT [nt:unstructured].longNumber FROM [nt:file] INNER JOIN [nt:unstructured] @@ -369,7 +378,8 @@ public function testQueryJoinChildnode() public function testQueryOrder() { /** @var $query QueryInterface */ - $query = $this->sharedFixture['qm']->createQuery(' + $query = $this->sharedFixture['qm']->createQuery( + ' SELECT data.foo FROM [nt:unstructured] AS data WHERE ISDESCENDANTNODE([/tests_general_base]) AND data.foo IS NOT NULL @@ -393,7 +403,8 @@ public function testQueryOrder() public function testQueryOrderWithMissingProperty() { /** @var $query QueryInterface */ - $query = $this->sharedFixture['qm']->createQuery(' + $query = $this->sharedFixture['qm']->createQuery( + ' SELECT data.zeronumber FROM [nt:unstructured] AS data WHERE ISDESCENDANTNODE([/tests_general_base]) @@ -416,7 +427,8 @@ public function testQueryOrderWithMissingProperty() public function testQueryMultiValuedProperty() { /** @var $query QueryInterface */ - $query = $this->sharedFixture['qm']->createQuery(' + $query = $this->sharedFixture['qm']->createQuery( + ' SELECT data.tags FROM [nt:unstructured] AS data WHERE data.tags = "foo" @@ -439,7 +451,8 @@ public function testQueryMultiValuedProperty() public function testLengthOperandOnStringProperty() { /** @var $query QueryInterface */ - $query = $this->sharedFixture['qm']->createQuery(' + $query = $this->sharedFixture['qm']->createQuery( + ' SELECT data.* FROM [nt:unstructured] AS data WHERE @@ -459,7 +472,8 @@ public function testLengthOperandOnStringProperty() $this->assertCount(1, $rows, 'Expected 1 node with property "foo" with a value with 3 characters (bar)'); /** @var $query QueryInterface */ - $query = $this->sharedFixture['qm']->createQuery(' + $query = $this->sharedFixture['qm']->createQuery( + ' SELECT data.* FROM [nt:unstructured] AS data WHERE @@ -479,7 +493,8 @@ public function testLengthOperandOnStringProperty() $this->assertCount(1, $rows, 'Expected 1 node with property "foo" with a value with 4 characters (bar2)'); /** @var $query QueryInterface */ - $query = $this->sharedFixture['qm']->createQuery(' + $query = $this->sharedFixture['qm']->createQuery( + ' SELECT data.* FROM [nt:unstructured] AS data WHERE @@ -502,7 +517,8 @@ public function testLengthOperandOnStringProperty() public function testLengthOperandOnEmptyProperty() { /** @var $query QueryInterface */ - $query = $this->sharedFixture['qm']->createQuery(' + $query = $this->sharedFixture['qm']->createQuery( + ' SELECT data.* FROM [nt:unstructured] AS data WHERE @@ -522,7 +538,8 @@ public function testLengthOperandOnEmptyProperty() $this->assertCount(1, $rows, 'Expected 1 node with property "empty-value" with a length smaller then 1'); /** @var $query QueryInterface */ - $query = $this->sharedFixture['qm']->createQuery(' + $query = $this->sharedFixture['qm']->createQuery( + ' SELECT data.* FROM [nt:unstructured] AS data WHERE @@ -542,7 +559,8 @@ public function testLengthOperandOnEmptyProperty() $this->assertCount(1, $rows, 'Expected 1 node with property "empty-value" with a length equal to 0'); /** @var $query QueryInterface */ - $query = $this->sharedFixture['qm']->createQuery(' + $query = $this->sharedFixture['qm']->createQuery( + ' SELECT data.* FROM [nt:unstructured] AS data WHERE @@ -565,7 +583,8 @@ public function testLengthOperandOnEmptyProperty() public function testLengthOperandOnBinaryProperty() { /** @var $query QueryInterface */ - $query = $this->sharedFixture['qm']->createQuery(' + $query = $this->sharedFixture['qm']->createQuery( + ' SELECT data.* FROM [nt:unstructured] AS data WHERE LENGTH(data.[jcr:data]) = 121 diff --git a/tests/Query/RowIteratorTest.php b/tests/Query/RowIteratorTest.php index 8a9973ff..3ded84d0 100644 --- a/tests/Query/RowIteratorTest.php +++ b/tests/Query/RowIteratorTest.php @@ -22,7 +22,7 @@ class RowIteratorTest extends QueryBaseCase { public $rowIterator; - public function setUp() + public function setUp(): void { parent::setUp(); diff --git a/tests/Query/RowTest.php b/tests/Query/RowTest.php index 213ffc96..88d5936b 100644 --- a/tests/Query/RowTest.php +++ b/tests/Query/RowTest.php @@ -22,7 +22,7 @@ class RowTest extends QueryBaseCase { private $row; - public function setUp() + public function setUp(): void { parent::setUp(); @@ -67,7 +67,7 @@ public function testGetValues() public function testGetValue() { $path = $this->row->getValue('jcr:createdBy'); - $this->assertInternalType('string', $path); + $this->assertIsString($path); $this->assertEquals('admin', $path); } @@ -92,6 +92,6 @@ public function testGetPath() public function testGetScore() { - $this->assertInternalType('float', $this->row->getScore()); + $this->assertIsFloat($this->row->getScore()); } } diff --git a/tests/Query/Sql1/QueryBaseCase.php b/tests/Query/Sql1/QueryBaseCase.php index edfbc27b..7808a6cc 100644 --- a/tests/Query/Sql1/QueryBaseCase.php +++ b/tests/Query/Sql1/QueryBaseCase.php @@ -21,7 +21,7 @@ abstract class QueryBaseCase extends \PHPCR\Tests\Query\QueryBaseCase /** * in addition to base stuff, prepare $this->query with a simple select query. */ - public function setUp() + public function setUp(): void { parent::setUp(); diff --git a/tests/Query/Sql1/QueryOperationsTest.php b/tests/Query/Sql1/QueryOperationsTest.php index 18544dfe..32673394 100644 --- a/tests/Query/Sql1/QueryOperationsTest.php +++ b/tests/Query/Sql1/QueryOperationsTest.php @@ -23,7 +23,7 @@ public function testQueryField() { /** @var $query QueryInterface */ $query = $this->sharedFixture['qm']->createQuery( - "SELECT foo FROM nt:unstructured WHERE foo = 'bar'", + "SELECT foo FROM nt:unstructured WHERE foo = 'bar'", QueryInterface::SQL ); @@ -50,7 +50,8 @@ public function testQueryField() public function testQueryFieldSomenull() { /** @var $query QueryInterface */ - $query = $this->sharedFixture['qm']->createQuery(' + $query = $this->sharedFixture['qm']->createQuery( + ' SELECT foo FROM nt:unstructured WHERE jcr:path LIKE \'/tests_general_base/%\' diff --git a/tests/Query/XPath/QueryBaseCase.php b/tests/Query/XPath/QueryBaseCase.php index f382e0dc..401dcb01 100644 --- a/tests/Query/XPath/QueryBaseCase.php +++ b/tests/Query/XPath/QueryBaseCase.php @@ -21,7 +21,7 @@ abstract class QueryBaseCase extends \PHPCR\Tests\Query\QueryBaseCase /** * in addition to base stuff, prepare $this->query with a simple select query. */ - public function setUp() + public function setUp(): void { parent::setUp(); diff --git a/tests/Reading/BinaryReadMethodsTest.php b/tests/Reading/BinaryReadMethodsTest.php index 26dacc08..141cb0f3 100644 --- a/tests/Reading/BinaryReadMethodsTest.php +++ b/tests/Reading/BinaryReadMethodsTest.php @@ -42,7 +42,7 @@ class BinaryReadMethodsTest extends BaseCase # foo '; - public function setUp() + public function setUp(): void { parent::setUp(); @@ -55,18 +55,18 @@ public function setUp() public function testReadBinaryValue() { $binary = $this->binaryProperty->getBinary(); - $this->assertInternalType('resource', $binary); + $this->assertIsResource($binary); $this->assertEquals($this->decodedstring, stream_get_contents($binary)); // stream must start when getting again $binary = $this->binaryProperty->getBinary(); - $this->assertInternalType('resource', $binary); + $this->assertIsResource($binary); $this->assertEquals($this->decodedstring, stream_get_contents($binary), 'Stream must begin at start again on second read'); // stream must not be the same fclose($binary); $binary = $this->binaryProperty->getBinary(); - $this->assertInternalType('resource', $binary); + $this->assertIsResource($binary); $this->assertEquals($this->decodedstring, stream_get_contents($binary), 'Stream must be different for each call, fclose should not matter'); } @@ -80,14 +80,14 @@ public function testIterateBinaryValue() public function testReadBinaryValueAsString() { $s = $this->binaryProperty->getString(); - $this->assertInternalType('string', $s); + $this->assertIsString($s); $this->assertEquals($this->decodedstring, $s); } public function testGetLength() { $size = $this->binaryProperty->getLength(); - $this->assertInternalType('integer', $size); + $this->assertIsInt($size); $this->assertEquals(strlen($this->decodedstring), $size); } @@ -98,9 +98,9 @@ public function testReadBinaryValues() $this->assertTrue($binaryMulti->isMultiple()); $this->assertEquals(PropertyType::BINARY, $binaryMulti->getType()); $vals = $binaryMulti->getValue(); - $this->assertInternalType('array', $vals); + $this->assertIsArray($vals); foreach ($vals as $value) { - $this->assertInternalType('resource', $value); + $this->assertIsResource($value); $this->assertEquals($this->decodedstring, stream_get_contents($value)); } } @@ -112,9 +112,9 @@ public function testReadBinaryValuesAsString() $this->assertTrue($binaryMulti->isMultiple()); $this->assertEquals(PropertyType::BINARY, $binaryMulti->getType()); $vals = $binaryMulti->getString(); - $this->assertInternalType('array', $vals); + $this->assertIsArray($vals); foreach ($vals as $value) { - $this->assertInternalType('string', $value); + $this->assertIsString($value); $this->assertEquals($this->decodedstring, $value); } } @@ -124,9 +124,9 @@ public function testGetLengthMultivalue() $node = $this->session->getRootNode()->getNode('tests_general_base/index.txt/jcr:content'); $binaryMulti = $node->getProperty('multidata'); $sizes = $binaryMulti->getLength(); - $this->assertInternalType('array', $sizes); + $this->assertIsArray($sizes); foreach ($sizes as $size) { - $this->assertInternalType('integer', $size); + $this->assertIsInt($size); $this->assertEquals(strlen($this->decodedstring), $size); } } @@ -137,7 +137,7 @@ public function testReadBinaryPathEncoding() $binary = $node->getProperty('encoding?%$-test'); $this->assertEquals(PropertyType::BINARY, $binary->getType()); $value = $binary->getString(); - $this->assertInternalType('string', $value); + $this->assertIsString($value); $this->assertEquals($this->decodedstring, $value); } @@ -147,7 +147,7 @@ public function testReadBinaryPathTrailingQuestionmark() $binary = $node->getProperty('encoding?'); $this->assertEquals(PropertyType::BINARY, $binary->getType()); $value = $binary->getString(); - $this->assertInternalType('string', $value); + $this->assertIsString($value); $this->assertEquals($this->decodedstring, $value); } @@ -161,7 +161,7 @@ public function testReadEmptyBinaryMultivalue() $empty = $node->getProperty('empty_multidata'); $this->assertEquals(PropertyType::BINARY, $empty->getType()); $emptyValue = $empty->getBinary(); - $this->assertInternalType('array', $emptyValue); + $this->assertIsArray($emptyValue); $this->assertCount(0, $emptyValue); } @@ -174,8 +174,8 @@ public function testReadSingleBinaryMultivalue() $single = $node->getProperty('single_multidata'); $this->assertEquals(PropertyType::BINARY, $single->getType()); $singleValue = $single->getBinary(); - $this->assertInternalType('array', $singleValue); - $this->assertInternalType('resource', $singleValue[0]); + $this->assertIsArray($singleValue); + $this->assertIsResource($singleValue[0]); $contents = stream_get_contents($singleValue[0]); $this->assertEquals($this->decodedstring, $contents); } diff --git a/tests/Reading/EncodingTest.php b/tests/Reading/EncodingTest.php index cb372008..b3acda82 100644 --- a/tests/Reading/EncodingTest.php +++ b/tests/Reading/EncodingTest.php @@ -20,12 +20,12 @@ */ class EncodingTest extends BaseCase { - public static function setupBeforeClass($fixtures = '05_Reading/encoding') + public static function setupBeforeClass($fixtures = '05_Reading/encoding'): void { parent::setupBeforeClass($fixtures); } - public function setUp() + public function setUp(): void { parent::setUp(); diff --git a/tests/Reading/JackalopeFetchDepthTest.php b/tests/Reading/JackalopeFetchDepthTest.php index 05c95974..74404e15 100644 --- a/tests/Reading/JackalopeFetchDepthTest.php +++ b/tests/Reading/JackalopeFetchDepthTest.php @@ -19,12 +19,12 @@ */ class JackalopeFetchDepthTest extends BaseCase { - public static function setupBeforeClass($fixtures = '05_Reading/jackalopeFetchDepth') + public static function setupBeforeClass($fixtures = '05_Reading/jackalopeFetchDepth'): void { parent::setupBeforeClass($fixtures); } - public function setUp() + public function setUp(): void { parent::setUp(); diff --git a/tests/Reading/NodeReadMethodsTest.php b/tests/Reading/NodeReadMethodsTest.php index 3f085fa1..7d12c0b5 100644 --- a/tests/Reading/NodeReadMethodsTest.php +++ b/tests/Reading/NodeReadMethodsTest.php @@ -37,7 +37,7 @@ class NodeReadMethodsTest extends BaseCase /** @var NodeInterface */ protected $deepnode; - public function setUp() + public function setUp(): void { parent::setUp(); @@ -395,7 +395,7 @@ public function testGetPropertiesValuesAll() { $node = $this->session->getNode('/tests_general_base/idExample/jcr:content/weakreference_source1'); $props = $node->getPropertiesValues(); - $this->assertInternalType('array', $props); + $this->assertIsArray($props); $this->assertArrayHasKey('ref1', $props); $this->assertInstanceOf(NodeInterface::class, $props['ref1']); } @@ -404,7 +404,7 @@ public function testGetPropertiesValuesAllNoDereference() { $node = $this->session->getNode('/tests_general_base/idExample/jcr:content/weakreference_source1'); $props = $node->getPropertiesValues(null, false); - $this->assertInternalType('array', $props); + $this->assertIsArray($props); $this->assertArrayHasKey('ref1', $props); $this->assertEquals('13543fc6-1abf-4708-bfcc-e49511754b40', $props['ref1']); } @@ -413,7 +413,7 @@ public function testGetPropertiesValuesGlob() { $node = $this->session->getNode('/tests_general_base/idExample/jcr:content/weakreference_source1'); $props = $node->getPropertiesValues('jcr:*'); - $this->assertInternalType('array', $props); + $this->assertIsArray($props); /* * jcr:mixinTypes is a protected multi-value NAME property * it is optional if there are no mixin types declared on this node, @@ -434,7 +434,7 @@ public function testGetReferencePropertyRepeated() { $node = $this->session->getNode('/tests_general_base/idExample/jcr:content/weakreference_repeated'); $refs = $node->getPropertyValue('other_ref'); - $this->assertInternalType('array', (array) $refs); + $this->assertIsArray((array) $refs); $this->assertCount(2, $refs); foreach ($refs as $node) { $this->assertInstanceOf(NodeInterface::class, $node); @@ -487,7 +487,7 @@ public function testGetIdentifier() public function testGetIdentifierNonReferenceable() { $id = $this->node->getNode('index.txt')->getIdentifier(); - $this->assertInternalType('string', $id); + $this->assertIsString($id); } /** @@ -496,7 +496,7 @@ public function testGetIdentifierNonReferenceable() public function testGetIndex() { $index = $this->node->getIndex(); - $this->assertInternalType('numeric', $index); + $this->assertIsNumeric($index); $this->assertEquals(1, $index); } @@ -729,7 +729,7 @@ public function testIterator() foreach ($this->node as $name => $child) { $results = true; - $this->assertInternalType('string', $name); + $this->assertIsString($name); $this->assertInstanceOf(NodeInterface::class, $child); $this->assertEquals($name, $child->getName()); } diff --git a/tests/Reading/PropertyReadMethodsTest.php b/tests/Reading/PropertyReadMethodsTest.php index d942b8b3..f9ef61d8 100644 --- a/tests/Reading/PropertyReadMethodsTest.php +++ b/tests/Reading/PropertyReadMethodsTest.php @@ -62,7 +62,7 @@ class PropertyReadMethodsTest extends BaseCase */ protected $multiValueProperty; - public function setUp() + public function setUp(): void { parent::setUp(); @@ -162,7 +162,7 @@ public function testGetValue() public function testGetValueMulti() { $vals = $this->multiValueProperty->getValue(); - $this->assertInternalType('array', $vals); + $this->assertIsArray($vals); foreach ($vals as $val) { $this->assertNotNull($val); } @@ -177,11 +177,11 @@ public function testGetString() { $expectedStr = '2011-04-21T14:34:20+01:00'; //date precision might not be down to milliseconds $str = $this->dateProperty->getString(); - $this->assertInternalType('string', $str); + $this->assertIsString($str); $this->assertEqualDateString($expectedStr, $str); $str = $this->valProperty->getString(); - $this->assertInternalType('string', $str); + $this->assertIsString($str); $this->assertEquals('bar', $str); } @@ -195,9 +195,9 @@ public function testJcrCreated() public function testGetStringMulti() { $arr = $this->multiValueProperty->getString(); - $this->assertInternalType('array', $arr); + $this->assertIsArray($arr); foreach ($arr as $v) { - $this->assertInternalType('string', $v); + $this->assertIsString($v); } } @@ -207,7 +207,7 @@ public function testGetStringMulti() public function testGetBinary() { $bin = $this->valProperty->getBinary(); - $this->assertInternalType('resource', $bin); + $this->assertIsResource($bin); $str = $this->valProperty->getString(); $this->assertEquals($str, stream_get_contents($bin)); $this->assertEquals($this->valProperty->getLength(), strlen($str)); @@ -215,7 +215,7 @@ public function testGetBinary() $prop = $this->node->getProperty('index.txt/jcr:content/jcr:data'); $this->assertEquals(PropertyType::BINARY, $prop->getType(), 'Expected binary type'); $bin = $prop->getValue(); - $this->assertInternalType('resource', $bin); + $this->assertIsResource($bin); $this->assertNotNull(stream_get_contents($bin)); fclose($bin); } @@ -225,9 +225,9 @@ public function testGetBinaryMulti() $prop = $this->node->getProperty('index.txt/jcr:content/multidata'); $this->assertEquals(PropertyType::BINARY, $prop->getType(), 'Expected binary type'); $arr = $prop->getValue(); - $this->assertInternalType('array', $arr); + $this->assertIsArray($arr); foreach ($arr as $bin) { - $this->assertInternalType('resource', $bin); + $this->assertIsResource($bin); $this->assertNotNull(stream_get_contents($bin)); } } @@ -236,15 +236,15 @@ public function testGetLong() { $prop = $this->node->getNode('numberPropertyNode/jcr:content')->getProperty('longNumber'); $num = $prop->getLong(); - $this->assertInternalType('integer', $num); + $this->assertIsInt($num); $this->assertEquals(999, $num); } public function testGetLongMulti() { $arr = $this->multiValueProperty->getLong(); - $this->assertInternalType('array', $arr); + $this->assertIsArray($arr); foreach ($arr as $v) { - $this->assertInternalType('integer', $v); + $this->assertIsInt($v); } } /** @@ -261,15 +261,15 @@ public function testGetDouble() { $nv = $this->node->getNode('numberPropertyNode/jcr:content')->getProperty('longNumber'); $number = $nv->getDouble(); - $this->assertInternalType('float', $number); + $this->assertIsFloat($number); $this->assertEquals(999, $number); } public function testGetDoubleMulti() { $arr = $this->multiValueProperty->getDouble(); - $this->assertInternalType('array', $arr); + $this->assertIsArray($arr); foreach ($arr as $v) { - $this->assertInternalType('float', $v); + $this->assertIsFloat($v); } } @@ -289,7 +289,7 @@ public function testGetDecimal() $num = $prop->getDecimal(); //we do not have an equivalent to java.math.BigDecimal. PHPCR uses strings suitable for BC Math - $this->assertInternalType('string', $num); + $this->assertIsString($num); $this->assertEquals(999, $num); } /** @@ -326,7 +326,7 @@ public function testGetDateMulti() $multidate = $this->node->getProperty('index.txt/jcr:content/multidate'); $this->assertEquals(PropertyType::DATE, $multidate->getType()); $arr = $multidate->getValue(); - $this->assertInternalType('array', $arr); + $this->assertIsArray($arr); foreach ($arr as $v) { $this->assertInstanceOf(DateTime::class, $v); @@ -375,9 +375,9 @@ public function testGetBooleanMulti() { $prop = $this->node->getNode('numberPropertyNode/jcr:content')->getProperty('multiBoolean'); $arr = $prop->getBoolean(); - $this->assertInternalType('array', $arr); + $this->assertIsArray($arr); foreach ($arr as $v) { - $this->assertInternalType('boolean', $v); + $this->assertIsBool($v); } $this->assertCount(2, $arr); $this->assertFalse($arr[0]); @@ -413,7 +413,7 @@ public function testGetNodeMulti() $multiref = $this->node->getNode('numberPropertyNode/jcr:content')->getProperty('multiref'); $arr = $multiref->getNode(); - $this->assertInternalType('array', $arr); + $this->assertIsArray($arr); foreach ($arr as $v) { $this->assertInstanceOf(NodeInterface::class, $v); } @@ -478,7 +478,7 @@ public function testGetPropertyMulti() $this->assertEquals('/tests_general_base/index.txt/jcr:content/mydateprop', $properties[1]->getPath()); $expected = [$this->valProperty, $this->dateProperty]; - $this->assertEquals($expected, $properties, '', 0, 3); + $this->assertEquals($expected, $properties); } public function testGetPropertyNoPath() @@ -583,7 +583,7 @@ public function testIterator() $results = 0; foreach ($this->valProperty as $value) { $results++; - $this->assertInternalType('string', $value); + $this->assertIsString($value); $this->assertEquals('bar', $value); } diff --git a/tests/Reading/SessionNamespaceRemappingTest.php b/tests/Reading/SessionNamespaceRemappingTest.php index f8730196..c5104650 100644 --- a/tests/Reading/SessionNamespaceRemappingTest.php +++ b/tests/Reading/SessionNamespaceRemappingTest.php @@ -17,7 +17,7 @@ // 6.3.3 Session Namespace Remapping class SessionNamespaceRemappingTest extends BaseCase { - public static function setupBeforeClass($fixtures = false) + public static function setupBeforeClass($fixtures = false): void { // Do not care about the fixtures parent::setupBeforeClass($fixtures); @@ -38,7 +38,7 @@ public function testSetNamespacePrefix() $session->setNamespacePrefix('notyetexisting', 'http://www.jcp.org/jcr/mix/1.0'); $ret = $session->getNamespacePrefixes(); - $this->assertInternalType('array', $ret); + $this->assertIsArray($ret); $this->assertContains('notyetexisting', $ret); $session->logout(); @@ -54,7 +54,7 @@ public function testSetNamespacePrefixXml() public function testGetNamespacePrefixes() { $ret = $this->session->getNamespacePrefixes(); - $this->assertInternalType('array', $ret); + $this->assertIsArray($ret); foreach ($this->nsBuiltIn as $prefix => $uri) { $this->assertContains($prefix, $ret); } diff --git a/tests/SameNameSiblings/DeleteMethodsTest.php b/tests/SameNameSiblings/DeleteMethodsTest.php index 64d460b6..7a714093 100644 --- a/tests/SameNameSiblings/DeleteMethodsTest.php +++ b/tests/SameNameSiblings/DeleteMethodsTest.php @@ -22,12 +22,12 @@ */ class DeleteMethodsTest extends BaseCase { - public static function setupBeforeClass($fixtures = '22_SameNameSiblings/delete') + public static function setupBeforeClass($fixtures = '22_SameNameSiblings/delete'): void { parent::setupBeforeClass($fixtures); } - public function setUp() + public function setUp(): void { $this->renewSession(); // get rid of cache from previous tests diff --git a/tests/Transactions/TransactionMethodsTest.php b/tests/Transactions/TransactionMethodsTest.php index a2a4c91a..f084457f 100644 --- a/tests/Transactions/TransactionMethodsTest.php +++ b/tests/Transactions/TransactionMethodsTest.php @@ -22,12 +22,12 @@ */ class TransactionMethodsTest extends BaseCase { - public static function setupBeforeClass($fixtures = '21_Transactions/transactions') + public static function setupBeforeClass($fixtures = '21_Transactions/transactions'): void { parent::setupBeforeClass($fixtures); } - public function setUp() + public function setUp(): void { $this->renewSession(); diff --git a/tests/Versioning/CreateVersionableNodeTest.php b/tests/Versioning/CreateVersionableNodeTest.php index 3724aaca..7bf455be 100644 --- a/tests/Versioning/CreateVersionableNodeTest.php +++ b/tests/Versioning/CreateVersionableNodeTest.php @@ -20,12 +20,12 @@ */ class CreateVersionableNodeTest extends BaseCase { - public static function setupBeforeClass($fixtures = '15_Versioning/base') + public static function setupBeforeClass($fixtures = '15_Versioning/base'): void { parent::setupBeforeClass($fixtures); } - public function setUp() + public function setUp(): void { parent::setUp(); diff --git a/tests/Versioning/NodeTypeReadTest.php b/tests/Versioning/NodeTypeReadTest.php index d6aec843..e168e388 100644 --- a/tests/Versioning/NodeTypeReadTest.php +++ b/tests/Versioning/NodeTypeReadTest.php @@ -32,12 +32,12 @@ class NodeTypeReadTest extends BaseCase */ protected $simpleVersioned; - public static function setupBeforeClass($fixtures = '15_Versioning/base') + public static function setupBeforeClass($fixtures = '15_Versioning/base'): void { parent::setupBeforeClass($fixtures); } - public function setUp() + public function setUp(): void { parent::setUp(); diff --git a/tests/Versioning/SimpleVersionTest.php b/tests/Versioning/SimpleVersionTest.php index f4308640..edcc841c 100644 --- a/tests/Versioning/SimpleVersionTest.php +++ b/tests/Versioning/SimpleVersionTest.php @@ -35,12 +35,12 @@ class SimpleVersionTest extends BaseCase */ private $simpleVersioned; - public static function setupBeforeClass($fixtures = '15_Versioning/base') + public static function setupBeforeClass($fixtures = '15_Versioning/base'): void { parent::setupBeforeClass($fixtures); } - public function setUp() + public function setUp(): void { parent::setUp(); @@ -70,7 +70,7 @@ public function testGetFrozenNode() $this->assertEquals('bar3', $frozen->getPropertyValue('foo')); $predecessors = $this->simpleVersioned->getPredecessors(); - $this->assertInternalType('array', $predecessors); + $this->assertIsArray($predecessors); $firstVersion = reset($predecessors); $this->assertInstanceOf(VersionInterface::class, $firstVersion); $frozen2 = $firstVersion->getFrozenNode(); diff --git a/tests/Versioning/VersionHistoryTest.php b/tests/Versioning/VersionHistoryTest.php index 4d3d2429..3680af65 100644 --- a/tests/Versioning/VersionHistoryTest.php +++ b/tests/Versioning/VersionHistoryTest.php @@ -39,7 +39,7 @@ class VersionHistoryTest extends BaseCase */ private $history; - public static function setupBeforeClass($fixtures = '15_Versioning/base') + public static function setupBeforeClass($fixtures = '15_Versioning/base'): void { parent::setupBeforeClass($fixtures); @@ -59,7 +59,7 @@ public static function setupBeforeClass($fixtures = '15_Versioning/base') self::$staticSharedFixture['session'] = self::$loader->getSession(); //reset the session, should not be needed if save would correctly invalidate and refresh $node } - public function setUp() + public function setUp(): void { parent::setUp(); $this->vm = $this->session->getWorkspace()->getVersionManager(); @@ -77,7 +77,7 @@ public function testGetAllLinearFrozenNodes() $lastNode = null; foreach ($frozenNodes as $name => $node) { $this->assertInstanceOf(NodeInterface::class, $node); - $this->assertInternalType('string', $name); + $this->assertIsString($name); $lastNode = $node; } @@ -97,7 +97,7 @@ public function testGetAllFrozenNodes() $lastNode = null; foreach ($frozenNodes as $name => $node) { $this->assertInstanceOf(NodeInterface::class, $node); - $this->assertInternalType('string', $name); + $this->assertIsString($name); $lastNode = $node; } diff --git a/tests/Versioning/VersionManagerTest.php b/tests/Versioning/VersionManagerTest.php index 46e6b4ab..7658e1a1 100644 --- a/tests/Versioning/VersionManagerTest.php +++ b/tests/Versioning/VersionManagerTest.php @@ -33,12 +33,12 @@ class VersionManagerTest extends BaseCase */ private $vm; - public static function setupBeforeClass($fixtures = '15_Versioning/base') + public static function setupBeforeClass($fixtures = '15_Versioning/base'): void { parent::setupBeforeClass($fixtures); } - public function setUp() + public function setUp(): void { parent::setUp(); diff --git a/tests/Versioning/VersionTest.php b/tests/Versioning/VersionTest.php index 974ca535..d48ccad0 100644 --- a/tests/Versioning/VersionTest.php +++ b/tests/Versioning/VersionTest.php @@ -35,7 +35,7 @@ class VersionTest extends BaseCase */ private $version; - public static function setupBeforeClass($fixtures = '15_Versioning/base') + public static function setupBeforeClass($fixtures = '15_Versioning/base'): void { parent::setupBeforeClass($fixtures); @@ -56,7 +56,7 @@ public static function setupBeforeClass($fixtures = '15_Versioning/base') self::$staticSharedFixture['session'] = self::$loader->getSession(); //reset the session } - public function setUp() + public function setUp(): void { parent::setUp(); @@ -86,7 +86,7 @@ public function testGetFrozenNode() $this->assertEquals('bar3', $frozen->getPropertyValue('foo')); $predecessors = $this->version->getPredecessors(); - $this->assertInternalType('array', $predecessors); + $this->assertIsArray($predecessors); $firstVersion = reset($predecessors); $this->assertInstanceOf(VersionInterface::class, $firstVersion); $frozen2 = $firstVersion->getFrozenNode(); diff --git a/tests/Writing/AddMethodsTest.php b/tests/Writing/AddMethodsTest.php index 45f05319..77bc7d1f 100644 --- a/tests/Writing/AddMethodsTest.php +++ b/tests/Writing/AddMethodsTest.php @@ -29,12 +29,12 @@ */ class AddMethodsTest extends BaseCase { - public static function setupBeforeClass($fixtures = '10_Writing/add') + public static function setupBeforeClass($fixtures = '10_Writing/add'): void { parent::setupBeforeClass($fixtures); } - public function setUp() + public function setUp(): void { $this->renewSession(); parent::setUp(); diff --git a/tests/Writing/CloneMethodsTest.php b/tests/Writing/CloneMethodsTest.php index 06cdfbc9..06e75e0e 100644 --- a/tests/Writing/CloneMethodsTest.php +++ b/tests/Writing/CloneMethodsTest.php @@ -39,7 +39,7 @@ class CloneMethodsTest extends BaseCase /** @var string */ protected static $destWsName; - public static function setupBeforeClass($fixtures = '10_Writing/clone') + public static function setupBeforeClass($fixtures = '10_Writing/clone'): void { parent::setupBeforeClass($fixtures); @@ -57,7 +57,7 @@ public static function setupBeforeClass($fixtures = '10_Writing/clone') $destSession->save(); } - protected function setUp() + protected function setUp(): void { $this->renewSession(); // get rid of cache from previous tests @@ -67,7 +67,7 @@ protected function setUp() $this->srcWsName = $this->session->getWorkspace()->getName(); } - public static function tearDownAfterClass() + public static function tearDownAfterClass(): void { self::$destWs = null; parent::tearDownAfterClass(); @@ -304,9 +304,6 @@ public function testCloneInvalidDstPath() self::$destWs->cloneFrom($this->srcWsName, $srcNode, $dstNode, true); } - /** - * @expectedException \PHPCR\PathNotFoundException - */ public function testCloneProperty() { $this->expectException(PathNotFoundException::class); diff --git a/tests/Writing/CombinedManipulationsTest.php b/tests/Writing/CombinedManipulationsTest.php index 001100d7..e4d0175a 100644 --- a/tests/Writing/CombinedManipulationsTest.php +++ b/tests/Writing/CombinedManipulationsTest.php @@ -22,12 +22,12 @@ */ class CombinedManipulationsTest extends BaseCase { - public static function setupBeforeClass($fixtures = '10_Writing/combinedmanipulations') + public static function setupBeforeClass($fixtures = '10_Writing/combinedmanipulations'): void { parent::setupBeforeClass($fixtures); } - public function setUp() + public function setUp(): void { $this->renewSession(); // kill cache between tests parent::setUp(); diff --git a/tests/Writing/CopyMethodsTest.php b/tests/Writing/CopyMethodsTest.php index a947eacb..622ac21c 100644 --- a/tests/Writing/CopyMethodsTest.php +++ b/tests/Writing/CopyMethodsTest.php @@ -27,12 +27,12 @@ class CopyMethodsTest extends BaseCase /** @var WorkspaceInterface */ protected $ws; - public static function setupBeforeClass($fixtures = '10_Writing/copy') + public static function setupBeforeClass($fixtures = '10_Writing/copy'): void { parent::setupBeforeClass($fixtures); } - protected function setUp() + protected function setUp(): void { $this->renewSession(); // get rid of cache from previous tests parent::setUp(); @@ -275,8 +275,8 @@ public function testCopyChildrenBinaryData() $srcVal = $srcProp->getBinary(); $dstVal = $dstProp->getBinary(); - $this->assertInternalType('resource', $srcVal, 'Failed to get src binary stream'); - $this->assertInternalType('resource', $dstVal, 'Failed to get dst binary stream'); + $this->assertIsResource($srcVal, 'Failed to get src binary stream'); + $this->assertIsResource($dstVal, 'Failed to get dst binary stream'); $this->assertEquals(stream_get_contents($srcVal), stream_get_contents($dstVal)); } @@ -303,13 +303,13 @@ public function testCopyChildrenBinaryDataMultivalue() $srcVal = $srcProp->getValue(); $dstVal = $dstProp->getValue(); - $this->assertInternalType('array', $srcVal, 'Failed to get src value'); - $this->assertInternalType('array', $dstVal, 'Failed to get dst value'); + $this->assertIsArray($srcVal, 'Failed to get src value'); + $this->assertIsArray($dstVal, 'Failed to get dst value'); - $this->assertInternalType('resource', $srcVal[0]); - $this->assertInternalType('resource', $srcVal[1]); - $this->assertInternalType('resource', $dstVal[0]); - $this->assertInternalType('resource', $dstVal[1]); + $this->assertIsResource($srcVal[0]); + $this->assertIsResource($srcVal[1]); + $this->assertIsResource($dstVal[0]); + $this->assertIsResource($dstVal[1]); $this->assertEquals(stream_get_contents($srcVal[0]), stream_get_contents($dstVal[0])); $this->assertEquals(stream_get_contents($srcVal[1]), stream_get_contents($dstVal[1])); diff --git a/tests/Writing/DeleteMethodsTest.php b/tests/Writing/DeleteMethodsTest.php index 71c6401a..034548d3 100644 --- a/tests/Writing/DeleteMethodsTest.php +++ b/tests/Writing/DeleteMethodsTest.php @@ -24,12 +24,12 @@ */ class DeleteMethodsTest extends BaseCase { - public static function setupBeforeClass($fixtures = '10_Writing/delete') + public static function setupBeforeClass($fixtures = '10_Writing/delete'): void { parent::setupBeforeClass($fixtures); } - public function setUp() + public function setUp(): void { $this->renewSession(); // get rid of cache from previous tests parent::setUp(); diff --git a/tests/Writing/EncodingTest.php b/tests/Writing/EncodingTest.php index 89e24f76..0c5464de 100644 --- a/tests/Writing/EncodingTest.php +++ b/tests/Writing/EncodingTest.php @@ -20,12 +20,12 @@ */ class EncodingTest extends BaseCase { - public static function setupBeforeClass($fixtures = '10_Writing/encoding') + public static function setupBeforeClass($fixtures = '10_Writing/encoding'): void { parent::setupBeforeClass($fixtures); } - public function setUp() + public function setUp(): void { parent::setUp(); diff --git a/tests/Writing/ItemStateTest.php b/tests/Writing/ItemStateTest.php index b4fa5f7c..83f41905 100644 --- a/tests/Writing/ItemStateTest.php +++ b/tests/Writing/ItemStateTest.php @@ -22,7 +22,7 @@ */ class ItemStateTest extends BaseCase { - public function setUp() + public function setUp(): void { parent::setUp(); diff --git a/tests/Writing/LastModifiedTest.php b/tests/Writing/LastModifiedTest.php index 3aefcd0b..4a953b44 100644 --- a/tests/Writing/LastModifiedTest.php +++ b/tests/Writing/LastModifiedTest.php @@ -21,12 +21,12 @@ */ class LastModifiedTest extends BaseCase { - public static function setupBeforeClass($fixtures = '10_Writing/lastmodified') + public static function setupBeforeClass($fixtures = '10_Writing/lastmodified'): void { parent::setupBeforeClass($fixtures); } - public function setUp() + public function setUp(): void { parent::setUp(); diff --git a/tests/Writing/LastModifiedUpdateTest.php b/tests/Writing/LastModifiedUpdateTest.php index d9172779..608cc30a 100644 --- a/tests/Writing/LastModifiedUpdateTest.php +++ b/tests/Writing/LastModifiedUpdateTest.php @@ -26,7 +26,7 @@ */ class LastModifiedUpdateTest extends BaseCase { - public static function setupBeforeClass($fixtures = '10_Writing/lastmodified') + public static function setupBeforeClass($fixtures = '10_Writing/lastmodified'): void { parent::setupBeforeClass($fixtures); diff --git a/tests/Writing/MixinCreatedTest.php b/tests/Writing/MixinCreatedTest.php index 0e2ce419..b1342c60 100644 --- a/tests/Writing/MixinCreatedTest.php +++ b/tests/Writing/MixinCreatedTest.php @@ -22,7 +22,7 @@ */ class MixinCreatedTest extends BaseCase { - public function setUp() + public function setUp(): void { $this->renewSession(); // discard changes } diff --git a/tests/Writing/MixinReferenceableTest.php b/tests/Writing/MixinReferenceableTest.php index 747e36e3..60820b01 100644 --- a/tests/Writing/MixinReferenceableTest.php +++ b/tests/Writing/MixinReferenceableTest.php @@ -24,12 +24,12 @@ */ class MixinReferenceableTest extends BaseCase { - public static function setupBeforeClass($fixtures = '10_Writing/mixinreferenceable') + public static function setupBeforeClass($fixtures = '10_Writing/mixinreferenceable'): void { parent::setupBeforeClass($fixtures); } - public function setUp() + public function setUp(): void { $this->renewSession(); // discard changes } diff --git a/tests/Writing/MoveMethodsTest.php b/tests/Writing/MoveMethodsTest.php index f9d4d762..b4331a0b 100644 --- a/tests/Writing/MoveMethodsTest.php +++ b/tests/Writing/MoveMethodsTest.php @@ -22,12 +22,12 @@ */ class MoveMethodsTest extends BaseCase { - public static function setupBeforeClass($fixtures = '10_Writing/move') + public static function setupBeforeClass($fixtures = '10_Writing/move'): void { parent::setupBeforeClass($fixtures); } - protected function setUp() + protected function setUp(): void { $this->renewSession(); parent::setUp(); @@ -443,11 +443,9 @@ public function testSessionMoveChildMoved() $this->assertTrue($session->nodeExists($dst2), 'Destination child node not found [B]'); } - /** - * @expectedException \PHPCR\RepositoryException - */ public function testSessionMoveProperty() { + $this->expectException(RepositoryException::class); $src = '/tests_write_manipulation_move/testSessionMoveProperty/srcNode/prop'; $dst = '/tests_write_manipulation_move/testSessionMoveProperty/dstNode/prop'; $this->session->move($src, $dst); diff --git a/tests/Writing/NamespaceRegistryTest.php b/tests/Writing/NamespaceRegistryTest.php index ac6944ef..87dcb645 100644 --- a/tests/Writing/NamespaceRegistryTest.php +++ b/tests/Writing/NamespaceRegistryTest.php @@ -32,7 +32,7 @@ class NamespaceRegistryTest extends BaseCase '' => '' ]; - public function setUp() + public function setUp(): void { parent::setUp(); $this->workspace = $this->session->getWorkspace(); @@ -42,14 +42,14 @@ public function setUp() public function testGetPrefixes() { $ret = $this->nr->getPrefixes(); - $this->assertInternalType('array', $ret); + $this->assertIsArray($ret); $this->assertGreaterThanOrEqual(count($this->nsBuiltIn), count($ret)); } public function testGetURIs() { $ret = $this->nr->getURIs(); - $this->assertInternalType('array', $ret); + $this->assertIsArray($ret); $this->assertGreaterThanOrEqual(count($this->nsBuiltIn), count($ret)); //we test in getURI / getPrefix if the names match } @@ -146,8 +146,8 @@ public function testIterator() $results = 0; foreach ($this->nr as $prefix => $url) { $results++; - $this->assertInternalType('string', $prefix); - $this->assertInternalType('string', $url); + $this->assertIsString($prefix); + $this->assertIsString($url); $this->assertEquals($url, $this->nr->getURI($prefix)); } $this->assertGreaterThan(3, $results, 'Not enough namespaces'); diff --git a/tests/Writing/NodeTypeAssignementTest.php b/tests/Writing/NodeTypeAssignementTest.php index d940d84f..29a2914e 100644 --- a/tests/Writing/NodeTypeAssignementTest.php +++ b/tests/Writing/NodeTypeAssignementTest.php @@ -20,12 +20,12 @@ */ class NodeTypeAssignementTest extends BaseCase { - public static function setupBeforeClass($fixtures = '10_Writing/nodetype') + public static function setupBeforeClass($fixtures = '10_Writing/nodetype'): void { parent::setupBeforeClass($fixtures); } - public function setUp() + public function setUp(): void { $this->renewSession(); parent::setUp(); diff --git a/tests/Writing/NodeTypePreemptiveValidationTest.php b/tests/Writing/NodeTypePreemptiveValidationTest.php index b7044fa9..ae848cd3 100644 --- a/tests/Writing/NodeTypePreemptiveValidationTest.php +++ b/tests/Writing/NodeTypePreemptiveValidationTest.php @@ -43,7 +43,7 @@ class NodeTypePreemptiveValidationTest extends BaseCase */ private $ntm; - public function setUp() + public function setUp(): void { parent::setUp(); $this->ntm = $this->session->getWorkspace()->getNodeTypeManager(); diff --git a/tests/Writing/SetPropertyDynamicRebindingTest.php b/tests/Writing/SetPropertyDynamicRebindingTest.php index a7fec819..71e08e43 100644 --- a/tests/Writing/SetPropertyDynamicRebindingTest.php +++ b/tests/Writing/SetPropertyDynamicRebindingTest.php @@ -35,12 +35,12 @@ class SetPropertyDynamicRebindingTest extends BaseCase protected static $created_nodes = []; - public static function setupBeforeClass($fixtures = '10_Writing/nodetype') + public static function setupBeforeClass($fixtures = '10_Writing/nodetype'): void { parent::setupBeforeClass($fixtures); } - public function setUp() + public function setUp(): void { parent::setUp(); $this->renewSession(); @@ -77,7 +77,7 @@ public function testDynamicRebinding($propName, $sourcePropType, $sourcePropValu $this->assertEquals($sourcePropValue, $prop->getValue(), 'Initial property value does not match before saving'); } else { // PHPUnit does not like to assertEquals on resources - $this->assertInternalType('resource', $prop->getValue()); + $this->assertIsResource($prop->getValue()); } // Read it from backend check it's still valid @@ -97,7 +97,7 @@ public function testDynamicRebinding($propName, $sourcePropType, $sourcePropValu $this->assertEquals($sourcePropValue, $prop->getValue(), 'Initial property value does not match after saving'); } else { // PHPUnit does not like to assertEquals on resources - $this->assertInternalType('resource', $prop->getValue()); + $this->assertIsResource($prop->getValue()); } try { diff --git a/tests/Writing/SetPropertyMethodsTest.php b/tests/Writing/SetPropertyMethodsTest.php index 7bfa9c0b..5e72b67e 100644 --- a/tests/Writing/SetPropertyMethodsTest.php +++ b/tests/Writing/SetPropertyMethodsTest.php @@ -37,7 +37,7 @@ class SetPropertyMethodsTest extends BaseCase */ private $property; - public function setUp() + public function setUp(): void { parent::setUp(); $this->node = $this->session->getNode($this->nodePath); @@ -242,7 +242,7 @@ public function testSetPropertyMultivalueRef() $this->assertTrue($prop->isMultiple()); $this->assertEquals($ids, $prop->getString()); $nodes = $prop->getValue(); - $this->assertInternalType('array', $nodes); + $this->assertIsArray($nodes); $this->assertCount(3, $nodes); $this->assertInstanceOf(NodeInterface::class, reset($nodes)); } diff --git a/tests/Writing/SetPropertyTypesTest.php b/tests/Writing/SetPropertyTypesTest.php index f22a6f8b..6225ddb3 100644 --- a/tests/Writing/SetPropertyTypesTest.php +++ b/tests/Writing/SetPropertyTypesTest.php @@ -31,7 +31,7 @@ class SetPropertyTypesTest extends BaseCase /** @var PropertyInterface */ private $property; - public function setUp() + public function setUp(): void { parent::setUp();