Skip to content

Commit 862bc6d

Browse files
committed
allow php 8 and support phpunit 9
1 parent 9847773 commit 862bc6d

File tree

72 files changed

+319
-265
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

72 files changed

+319
-265
lines changed

Diff for: composer.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,9 @@
2727
}
2828
],
2929
"require": {
30-
"php": "^5.6|^7.0",
30+
"php": "^7.1 || ^8.0",
3131
"phpcr/phpcr-implementation": "2.1.*",
32-
"phpunit/phpunit": "^5.7 || ^6.4 || ^7.0"
32+
"phpunit/phpunit": "^7.0 || ^8.0 || ^9.0"
3333
},
3434
"autoload": {
3535
"psr-4": {

Diff for: inc/AbstractLoader.php

+3-2
Original file line numberDiff line numberDiff line change
@@ -255,10 +255,11 @@ public function doesSessionLastModified()
255255
*/
256256
public function getTestSupported($chapter, $case, $name)
257257
{
258-
return !(in_array($chapter, $this->unsupportedChapters)
258+
return !(
259+
in_array($chapter, $this->unsupportedChapters)
259260
|| in_array($case, $this->unsupportedCases)
260261
|| in_array($name, $this->unsupportedTests)
261-
);
262+
);
262263
}
263264

264265
/**

Diff for: inc/BaseCase.php

+6-5
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ abstract class BaseCase extends TestCase
9696
*
9797
* @see initProperties()
9898
*/
99-
public static function setupBeforeClass($fixtures = 'general/base')
99+
public static function setupBeforeClass($fixtures = 'general/base'): void
100100
{
101101
self::$loader = ImplementationLoader::getInstance();
102102

@@ -120,7 +120,7 @@ public static function setupBeforeClass($fixtures = 'general/base')
120120
self::$staticSharedFixture['additionalSession'] = self::$loader->getAdditionalSession();
121121
}
122122

123-
protected function setUp()
123+
protected function setUp(): void
124124
{
125125
$fqn = get_called_class();
126126
$parts = explode('\\', $fqn);
@@ -144,7 +144,7 @@ protected function setUp()
144144
$this->initProperties();
145145
}
146146

147-
public static function tearDownAfterClass()
147+
public static function tearDownAfterClass(): void
148148
{
149149
if (isset(self::$staticSharedFixture['session'])) {
150150
self::$staticSharedFixture['session']->logout();
@@ -278,7 +278,8 @@ protected function assertSimilarDateTime($expected, $data)
278278
{
279279
$this->assertInstanceOf(DateTime::class, $expected);
280280
$this->assertInstanceOf(DateTime::class, $data);
281-
$this->assertTrue(abs($expected->getTimestamp() - $data->getTimestamp()) <= 3,
281+
$this->assertTrue(
282+
abs($expected->getTimestamp() - $data->getTimestamp()) <= 3,
282283
$data->format('c').' is not close to the expected '.$expected->format('c')
283284
);
284285
}
@@ -290,7 +291,7 @@ protected function assertSimilarDateTime($expected, $data)
290291
*
291292
* @return bool True if the test can be done. Otherwise the test is skipped.
292293
*/
293-
protected function skipIfNotSupported($descriptor)
294+
protected function skipIfNotSupported($descriptor): bool
294295
{
295296
if (false === $this->session->getRepository()->getDescriptor($descriptor)) {
296297
$this->markTestSkipped('Descriptor "'.$descriptor.'" not supported');

Diff for: tests/Connecting/RepositoryDescriptorsTest.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
class RepositoryDescriptorsTest extends BaseCase
1717
{
18-
public static function setupBeforeClass($fixtures = false)
18+
public static function setupBeforeClass($fixtures = false): void
1919
{
2020
// Don't care about fixtures
2121
parent::setupBeforeClass($fixtures);
@@ -41,7 +41,7 @@ public function testDescriptorKeys()
4141
{
4242
$rep = self::$loader->getRepository();
4343
$keys = $rep->getDescriptorKeys();
44-
$this->assertInternalType('array', $keys);
44+
$this->assertIsArray($keys);
4545
$this->assertNotEmpty($keys);
4646
foreach ($this->expectedDescriptors as $descriptor) {
4747
$this->assertContains($descriptor, $keys);

Diff for: tests/Connecting/RepositoryFactoryTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818
class RepositoryFactoryTest extends BaseCase
1919
{
20-
public static function setupBeforeClass($fixtures = false)
20+
public static function setupBeforeClass($fixtures = false): void
2121
{
2222
// Don't care about fixtures
2323
parent::setupBeforeClass($fixtures);

Diff for: tests/Connecting/RepositoryTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020

2121
class RepositoryTest extends BaseCase
2222
{
23-
public static function setupBeforeClass($fixtures = null)
23+
public static function setupBeforeClass($fixtures = null): void
2424
{
2525
// Don't care about fixtures
2626
parent::setupBeforeClass($fixtures);

Diff for: tests/Connecting/SessionReadMethodsTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ public function testGetAttributeNames()
5454
$cr->setAttribute('foo', 'bar');
5555
$session = $this->assertSession($cr);
5656
$attrs = $session->getAttributeNames();
57-
$this->assertInternalType('array', $attrs);
57+
$this->assertIsArray($attrs);
5858
$this->assertContains('foo', $attrs);
5959
}
6060

Diff for: tests/Connecting/SimpleCredentialsTest.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
*/
2121
class SimpleCredentialsTest extends BaseCase
2222
{
23-
public static function setupBeforeClass($fixtures = false)
23+
public static function setupBeforeClass($fixtures = false): void
2424
{
2525
// Don't care about fixtures
2626
parent::setupBeforeClass($fixtures);
@@ -67,7 +67,7 @@ public function testAttributes()
6767
$cr->setAttribute($attrName, $attrValue);
6868
$this->assertEquals($attrValue, $cr->getAttribute($attrName));
6969
$attrs = $cr->getAttributeNames();
70-
$this->assertInternalType('array', $attrs);
70+
$this->assertIsArray($attrs);
7171
$this->assertContains($attrName, $attrs);
7272
$cr->removeAttribute($attrName);
7373
$this->assertNull($cr->getAttribute($attrName));

Diff for: tests/Connecting/WorkspaceReadMethodsTest.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ class WorkspaceReadMethodsTest extends BaseCase
3535

3636
//4.5 Workspace Read Methods
3737

38-
public function setUp()
38+
public function setUp(): void
3939
{
4040
parent::setUp();
4141

@@ -98,7 +98,7 @@ public function testGetAccessibleWorkspaceNames()
9898
{
9999
$names = $this->workspace->getAccessibleWorkspaceNames();
100100

101-
$this->assertInternalType('array', $names);
101+
$this->assertIsArray($names);
102102
$this->assertContains(self::$loader->getWorkspaceName(), $names);
103103
}
104104

Diff for: tests/Export/ExportRepositoryContentTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
//7 Export Repository Content
2222
class ExportRepositoryContentTest extends BaseCase
2323
{
24-
public static function setupBeforeClass($fixtures = '07_Export/systemview')
24+
public static function setupBeforeClass($fixtures = '07_Export/systemview'): void
2525
{
2626
parent::setupBeforeClass($fixtures);
2727
}

Diff for: tests/Import/ImportRepositoryContentTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
//6.5 Import Repository Content
2626
class ImportRepositoryContentTest extends BaseCase
2727
{
28-
public static function setupBeforeClass($fixtures = null)
28+
public static function setupBeforeClass($fixtures = null): void
2929
{
3030
parent::setupBeforeClass($fixtures);
3131
}

Diff for: tests/Locking/LockManagerTest.php

+2-3
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ class LockManagerTest extends BaseCase
3232
/** @var LockManagerInterface */
3333
private $lm;
3434

35-
public function setUp()
35+
public function setUp(): void
3636
{
3737
parent::setUp();
3838
$this->lm = $this->session->getWorkspace()->getLockManager();
@@ -42,11 +42,10 @@ public function setUp()
4242

4343
/**
4444
* Try to lock a non-lockable node.
45-
*
46-
* @expectedException \PHPCR\Lock\LockException
4745
*/
4846
public function testCannotLockNonLockableNodes()
4947
{
48+
$this->expectException(LockException::class);
5049
$this->recreateTestNode('non-lockable', false);
5150
$this->lm->lock('/non-lockable', true, true, 3, '');
5251
}

Diff for: tests/NodeTypeDiscovery/NodeDefinitionTest.php

+8-8
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ class NodeDefinitionTest extends BaseCase
5656
*/
5757
private $hierarchyNodeDef;
5858

59-
public static function setupBeforeClass($fixtures = false)
59+
public static function setupBeforeClass($fixtures = false): void
6060
{
6161
parent::setupBeforeClass($fixtures);
6262
/** @var NodeTypeManagerInterface $ntm */
@@ -66,20 +66,20 @@ public static function setupBeforeClass($fixtures = false)
6666
self::$hierarchyNodeType = $ntm->getNodeType('nt:hierarchyNode');
6767
}
6868

69-
public function setUp()
69+
public function setUp(): void
7070
{
7171
parent::setUp();
7272

7373
try {
7474
$defs = self::$file->getChildNodeDefinitions();
75-
$this->assertInternalType('array', $defs);
75+
$this->assertIsArray($defs);
7676
$this->assertCount(1, $defs);
7777
$this->content = current($defs);
7878
$this->assertInstanceOf(NodeDefinitionInterface::class, $this->content);
7979
$this->assertEquals('jcr:content', $this->content->getName());
8080

8181
$defs = self::$folder->getChildNodeDefinitions();
82-
$this->assertInternalType('array', $defs);
82+
$this->assertIsArray($defs);
8383
$this->assertCount(1, $defs);
8484
$this->hierarchyNodeDef = next($defs);
8585
$this->assertInstanceOf(NodeDefinitionInterface::class, $this->hierarchyNodeDef);
@@ -107,24 +107,24 @@ public function testDefaultPrimaryTypeName()
107107
public function getRequiredPrimaryTypeNames()
108108
{
109109
$names = $this->content->getRequiredPrimaryTypeNames();
110-
$this->assertInternalType('array', $names);
110+
$this->assertIsArray($names);
111111
$this->assertCount(1, $names);
112112
$this->assertEquals('nt:base', $names[0]);
113113

114114
$names = $this->hierarchyNodeDef->getRequiredPrimaryTypeNames();
115-
$this->assertInternalType('array', $names);
115+
$this->assertIsArray($names);
116116
$this->assertCount(1, $names);
117117
$this->assertEquals('nt:hierarchyNode', $names[0]);
118118
}
119119
public function getRequiredPrimaryTypes()
120120
{
121121
$types = $this->content->getRequiredPrimaryTypeNames();
122-
$this->assertInternalType('array', $types);
122+
$this->assertIsArray($types);
123123
$this->assertCount(1, $types);
124124
$this->assertEquals(self::$base, $types[0]);
125125

126126
$types = $this->hierarchyNodeDef->getRequiredPrimaryTypeNames();
127-
$this->assertInternalType('array', $types);
127+
$this->assertIsArray($types);
128128
$this->assertCount(1, $types);
129129
$this->assertEquals(self::$hierarchyNodeType, $types[0]);
130130
}

Diff for: tests/NodeTypeDiscovery/NodeNodeTypeReadMethodsTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ class NodeNodeTypeReadMethodsTest extends BaseCase
3434
*/
3535
protected $deepnode;
3636

37-
public function setUp()
37+
public function setUp(): void
3838
{
3939
parent::setUp();
4040

Diff for: tests/NodeTypeDiscovery/NodeTypeDiscoveryTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ class NodeTypeDiscoveryTest extends BaseCase
5252
'mix:title',
5353
];
5454

55-
public function setUp()
55+
public function setUp(): void
5656
{
5757
parent::setUp(false);
5858

Diff for: tests/NodeTypeDiscovery/NodeTypeTest.php

+8-8
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ class NodeTypeTest extends BaseCase
5050
*/
5151
private static $created;
5252

53-
public static function setupBeforeClass($fixtures = false)
53+
public static function setupBeforeClass($fixtures = false): void
5454
{
5555
parent::setupBeforeClass($fixtures);
5656
$ntm = self::$staticSharedFixture['session']->getWorkspace()->getNodeTypeManager();
@@ -64,7 +64,7 @@ public static function setupBeforeClass($fixtures = false)
6464
public function testGetSupertypes()
6565
{
6666
$types = self::$file->getSupertypes();
67-
$this->assertInternalType('array', $types);
67+
$this->assertIsArray($types);
6868
$typenames = [];
6969

7070
foreach ($types as $type) {
@@ -77,14 +77,14 @@ public function testGetSupertypes()
7777
public function testGetSupertypesNone()
7878
{
7979
$types = self::$base->getSupertypes();
80-
$this->assertInternalType('array', $types);
80+
$this->assertIsArray($types);
8181
$this->assertCount(0, $types);
8282
}
8383

8484
public function testGetDeclaredSupertypes()
8585
{
8686
$types = self::$file->getDeclaredSupertypes();
87-
$this->assertInternalType('array', $types);
87+
$this->assertIsArray($types);
8888
$typenames = [];
8989

9090
foreach ($types as $type) {
@@ -96,7 +96,7 @@ public function testGetDeclaredSupertypes()
9696
$this->assertNotContains('nt:base', $typenames);
9797

9898
$types = self::$resource->getDeclaredSupertypes();
99-
$this->assertInternalType('array', $types);
99+
$this->assertIsArray($types);
100100
$typenames = [];
101101

102102
foreach ($types as $type) {
@@ -112,7 +112,7 @@ public function testGetDeclaredSupertypes()
112112
public function testGetDeclaredSupertypesNone()
113113
{
114114
$types = self::$base->getDeclaredSupertypes();
115-
$this->assertInternalType('array', $types);
115+
$this->assertIsArray($types);
116116
$this->assertCount(0, $types);
117117
}
118118

@@ -155,7 +155,7 @@ public function testGetDeclaredSubtypes()
155155
public function testGetChildNodeDefinitions()
156156
{
157157
$children = self::$file->getChildNodeDefinitions();
158-
$this->assertInternalType('array', $children);
158+
$this->assertIsArray($children);
159159
$this->assertCount(1, $children);
160160
$child = current($children);
161161
$this->assertInstanceOf(NodeDefinitionInterface::class, $child);
@@ -166,7 +166,7 @@ public function testGetChildNodeDefinitions()
166166
public function testGetPropertyDefinitions()
167167
{
168168
$properties = self::$file->getPropertyDefinitions();
169-
$this->assertInternalType('array', $properties);
169+
$this->assertIsArray($properties);
170170
$this->assertCount(4, $properties);
171171
$names = [];
172172

0 commit comments

Comments
 (0)