Skip to content

Commit c88208a

Browse files
authored
Merge pull request #190 from phpcr/php-8
php 8
2 parents 2166818 + b54210d commit c88208a

31 files changed

+183
-167
lines changed

.styleci.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,5 @@ preset: recommended
22

33
enabled:
44
- no_useless_else
5+
disabled:
6+
- align_double_arrow

.travis.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
language: php
22

33
php:
4-
- 5.6
5-
- 7.0
64
- 7.1
75
- 7.2
86
- 7.3
97
- 7.4
8+
- nightly
109

1110
env:
1211
- PACKAGE_VERSION=high
@@ -15,7 +14,7 @@ sudo: false
1514

1615
matrix:
1716
include:
18-
- php: 5.6
17+
- php: 7.1
1918
env: PACKAGE_VERSION=low
2019
- php: 7.4
2120
env:

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
Changelog
22
=========
33

4+
1.5.0
5+
-----
6+
7+
* Support PHP 8
8+
* Drop support for PHP 5.6 and 7.0
9+
410
1.4.1
511
-----
612

composer.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,13 @@
2727
}
2828
],
2929
"require": {
30-
"php": "^5.6 || ^7.0",
30+
"php": "^7.1 || ^8.0",
3131
"phpcr/phpcr": "~2.1.0",
32-
"symfony/console": "^2.3|^3.0|^4.0|^5.0"
32+
"symfony/console": "^2.3 || ^3.0 || ^4.0 || ^5.0"
3333
},
3434
"require-dev": {
3535
"ramsey/uuid": "^3.5",
36-
"phpunit/phpunit": "^5.7 || ^6.0 || ^7.0"
36+
"phpunit/phpunit": "^7.5 || ^8.0 || ^9.0"
3737
},
3838
"suggest": {
3939
"ramsey/uuid": "A library for generating RFC 4122 version 1, 3, 4, and 5 universally unique identifiers (UUID)."

tests/PHPCR/Tests/Util/CND/Reader/BufferReaderTest.php

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,21 @@
77

88
class BufferReaderTest extends TestCase
99
{
10-
public function test__construct()
10+
public function test__construct(): void
1111
{
1212
$buffer = "Some random\nor\r\nstring";
1313
$reader = new BufferReader($buffer);
1414

15-
$this->assertInstanceOf(BufferReader::class, $reader);
16-
$this->assertAttributeEquals(str_replace("\r\n", "\n", $buffer).$reader->getEofMarker(), 'buffer', $reader);
17-
$this->assertAttributeEquals(0, 'startPos', $reader);
18-
$this->assertAttributeEquals(0, 'forwardPos', $reader);
15+
$reflection = new \ReflectionClass($reader);
16+
$bufferProperty = $reflection->getProperty('buffer');
17+
$bufferProperty->setAccessible(true);
18+
$this->assertSame(str_replace("\r\n", "\n", $buffer).$reader->getEofMarker(), $bufferProperty->getValue($reader));
19+
$startPos = $reflection->getProperty('startPos');
20+
$startPos->setAccessible(true);
21+
$this->assertSame(0, $startPos->getValue($reader));
22+
$forwardPos = $reflection->getProperty('forwardPos');
23+
$forwardPos->setAccessible(true);
24+
$this->assertSame(0, $forwardPos->getValue($reader));
1925

2026
$this->assertEquals(1, $reader->getCurrentLine());
2127
$this->assertEquals(1, $reader->getCurrentColumn());
@@ -90,10 +96,16 @@ public function test__constructEmptyString()
9096
{
9197
$reader = new BufferReader('');
9298

93-
$this->assertInstanceOf(BufferReader::class, $reader);
94-
$this->assertAttributeEquals($reader->getEofMarker(), 'buffer', $reader);
95-
$this->assertAttributeEquals(0, 'startPos', $reader);
96-
$this->assertAttributeEquals(0, 'forwardPos', $reader);
99+
$reflection = new \ReflectionClass($reader);
100+
$buffer = $reflection->getProperty('buffer');
101+
$buffer->setAccessible(true);
102+
$this->assertSame($reader->getEofMarker(), $buffer->getValue($reader));
103+
$startPos = $reflection->getProperty('startPos');
104+
$startPos->setAccessible(true);
105+
$this->assertSame(0, $startPos->getValue($reader));
106+
$forwardPos = $reflection->getProperty('forwardPos');
107+
$forwardPos->setAccessible(true);
108+
$this->assertSame(0, $forwardPos->getValue($reader));
97109

98110
$this->assertEquals(1, $reader->getCurrentLine());
99111
$this->assertEquals(1, $reader->getCurrentColumn());

tests/PHPCR/Tests/Util/CND/Reader/FileReaderTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ class FileReaderTest extends TestCase
2323
*/
2424
private $lines;
2525

26-
public function setUp()
26+
public function setUp(): void
2727
{
2828
$this->filepath = __DIR__.'/../Fixtures/files/TestFile.txt';
2929
$this->reader = new FileReader($this->filepath);

tests/PHPCR/Tests/Util/CND/Scanner/GenericScannerTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ class GenericScannerTest extends TestCase
108108

109109
protected $expectedTokensNoEmptyToken;
110110

111-
public function setUp()
111+
public function setUp(): void
112112
{
113113
$this->expectedTokensNoEmptyToken = [];
114114
foreach ($this->expectedTokens as $token) {

tests/PHPCR/Tests/Util/CND/Scanner/TokenQueueTest.php

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ class TokenQueueTest extends TestCase
3333
*/
3434
private $queue;
3535

36-
public function setUp()
36+
public function setUp(): void
3737
{
3838
$this->token0 = new Token(0, 'token 0');
3939
$this->token1 = new Token(1, 'token 1');
@@ -50,13 +50,16 @@ public function setUp()
5050
public function testAdd()
5151
{
5252
$queue = new TokenQueue();
53-
$this->assertAttributeEquals([], 'tokens', $queue);
53+
$reflection = new \ReflectionClass($queue);
54+
$tokens = $reflection->getProperty('tokens');
55+
$tokens->setAccessible(true);
56+
$this->assertSame([], $tokens->getValue($queue));
5457

5558
$queue->add($this->token0);
56-
$this->assertAttributeEquals([$this->token0], 'tokens', $queue);
59+
$this->assertSame([$this->token0], $tokens->getValue($queue));
5760

5861
$queue->add($this->token1);
59-
$this->assertAttributeEquals([$this->token0, $this->token1], 'tokens', $queue);
62+
$this->assertSame([$this->token0, $this->token1], $tokens->getValue($queue));
6063
}
6164

6265
public function testResetAndPeek()

tests/PHPCR/Tests/Util/CND/Scanner/TokenTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,15 @@ class TokenTest extends TestCase
1212
*/
1313
private $token;
1414

15-
public function setUp()
15+
public function setUp(): void
1616
{
1717
$this->token = new Token(123, 'foobar');
1818
}
1919

2020
public function test__construct()
2121
{
22-
$this->assertAttributeEquals(123, 'type', $this->token);
23-
$this->assertAttributeEquals('foobar', 'data', $this->token);
22+
$this->assertSame(123, $this->token->type);
23+
$this->assertSame('foobar', $this->token->data);
2424
}
2525

2626
public function testGetData()

tests/PHPCR/Tests/Util/Console/Command/BaseCommandTest.php

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ abstract class BaseCommandTest extends TestCase
6969
*/
7070
public $application;
7171

72-
public function setUp()
72+
public function setUp(): void
7373
{
7474
$this->session = $this->createMock(SessionInterface::class);
7575
$this->workspace = $this->createMock(WorkspaceInterface::class);
@@ -88,21 +88,21 @@ public function setUp()
8888
'phpcr_console_dumper' => $this->dumperHelper,
8989
]);
9090

91-
$this->session->expects($this->any())
91+
$this->session
9292
->method('getWorkspace')
93-
->will($this->returnValue($this->workspace));
93+
->willReturn($this->workspace);
9494

95-
$this->workspace->expects($this->any())
95+
$this->workspace
9696
->method('getName')
97-
->will($this->returnValue('test'));
97+
->willReturn('test');
9898

99-
$this->workspace->expects($this->any())
99+
$this->workspace
100100
->method('getQueryManager')
101-
->will($this->returnValue($this->queryManager));
101+
->willReturn($this->queryManager);
102102

103-
$this->queryManager->expects($this->any())
103+
$this->queryManager
104104
->method('getSupportedQueryLanguages')
105-
->will($this->returnValue(['JCR-SQL2']));
105+
->willReturn(['JCR-SQL2']);
106106

107107
$this->application = new Application();
108108
$this->application->setHelperSet($this->helperSet);

0 commit comments

Comments
 (0)