Skip to content

Commit ecf25e6

Browse files
Allow installation with symfony 6, drop PHP 7.4 support and test against PHP 8.1 (#210)
1 parent b7c286e commit ecf25e6

File tree

10 files changed

+61
-49
lines changed

10 files changed

+61
-49
lines changed

.github/workflows/test-application.yaml

+10-21
Original file line numberDiff line numberDiff line change
@@ -14,45 +14,34 @@ jobs:
1414
env:
1515
SYMFONY_DEPRECATIONS_HELPER: ${{ matrix.symfony-deprecation-helper }}
1616
BEHAT_SUITE: ${{ matrix.behat-suite }}
17+
COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }}
1718

1819
strategy:
1920
fail-fast: false
2021

2122
matrix:
2223
include:
23-
- php-version: '7.2'
24+
- php-version: '8.0'
2425
dependencies: lowest
2526
behat-suite: standalone
2627

27-
- php-version: '7.2'
28+
- php-version: '8.0'
2829
dependencies: lowest
2930
behat-suite: embedded
3031

31-
- php-version: '7.2'
32+
- php-version: '8.0'
3233
dependencies: lowest
3334
behat-suite: cli
3435

35-
- php-version: '7.4'
36+
- php-version: '8.1'
3637
dependencies: highest
3738
behat-suite: standalone
3839

39-
- php-version: '7.4'
40+
- php-version: '8.1'
4041
dependencies: highest
4142
behat-suite: embedded
4243

43-
- php-version: '7.4'
44-
dependencies: highest
45-
behat-suite: cli
46-
47-
- php-version: '8.0'
48-
dependencies: highest
49-
behat-suite: standalone
50-
51-
- php-version: '8.0'
52-
dependencies: highest
53-
behat-suite: embedded
54-
55-
- php-version: '8.0'
44+
- php-version: '8.1'
5645
dependencies: highest
5746
behat-suite: cli
5847

@@ -67,17 +56,17 @@ jobs:
6756
tools: 'composer:v2'
6857

6958
- name: Install dependencies with Composer
70-
uses: ramsey/composer-install@v1
59+
uses: ramsey/composer-install@v2
7160
with:
7261
dependency-versions: ${{ matrix.dependencies }}
7362
composer-options: ${{ matrix.composer-options }}
7463

7564
- name: Start Jackrabbit
7665
run: |
77-
tests/bin/travis_jackrabbit.sh
66+
JACKRABBIT_VERSION=2.21.10 tests/bin/travis_jackrabbit.sh
7867
7968
- name: Execute test cases
8069
run: |
8170
vendor/bin/phpunit
8271
vendor/bin/phpspec run
83-
vendor/behat/behat/bin/behat --suite=${{ matrix.behat-suite }}
72+
vendor/bin/behat --suite=${{ matrix.behat-suite }}

composer.json

+12-12
Original file line numberDiff line numberDiff line change
@@ -2,25 +2,25 @@
22
"name": "phpcr/phpcr-shell",
33
"description": "Shell for PHPCR",
44
"require": {
5-
"php": "^7.2 || ^8.0",
6-
"symfony/console": "^5.0",
5+
"php": "^8.0",
6+
"symfony/console": "^5.0 || ^6.0",
77
"jackalope/jackalope": "^1.3.4",
88
"phpcr/phpcr": "^2.1",
99
"phpcr/phpcr-utils": "^1.2",
10-
"symfony/finder": "^5.0",
11-
"symfony/serializer": "^5.0",
12-
"symfony/yaml": "^5.0",
13-
"symfony/dependency-injection": "^5.0",
14-
"symfony/expression-language": "^5.0",
10+
"symfony/finder": "^5.0 || ^6.0",
11+
"symfony/serializer": "^5.0 || ^6.0",
12+
"symfony/yaml": "^5.0 || ^6.0",
13+
"symfony/dependency-injection": "^5.0 || ^6.0",
14+
"symfony/expression-language": "^5.0 || ^6.0",
1515
"dantleech/glob-finder": "^1.0"
1616
},
1717
"require-dev": {
18-
"phpunit/phpunit": "^8.5",
19-
"symfony/symfony": "^5.0",
20-
"behat/behat": "^3.6",
21-
"phpspec/phpspec": "^6.0",
18+
"phpunit/phpunit": "^9.5",
19+
"behat/behat": "^3.10",
20+
"phpspec/phpspec": "^7.2",
2221
"jackalope/jackalope-doctrine-dbal": "^1.3",
23-
"jackalope/jackalope-jackrabbit": "^1.3"
22+
"jackalope/jackalope-jackrabbit": "^1.4.4",
23+
"phpspec/prophecy-phpunit": "^2.0"
2424
},
2525
"suggest": {
2626
"jackalope/jackalope-doctrine-dbal": "To connect to jackalope doctrine-dbal",

spec/PHPCR/Shell/Config/ProfileLoaderSpec.php

+6-2
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,12 @@ public function it_is_initializable()
3333
$this->shouldHaveType('PHPCR\Shell\Config\ProfileLoader');
3434
}
3535

36-
public function it_should_list_profile_names()
37-
{
36+
public function it_should_list_profile_names(
37+
Filesystem $filesystem
38+
) {
39+
$filesystem->exists(Argument::any())
40+
->willReturn(true);
41+
3842
$this->getProfileNames()->shouldReturn([
3943
'one', 'two',
4044
]);

src/PHPCR/Shell/Config/Config.php

+11-1
Original file line numberDiff line numberDiff line change
@@ -24,24 +24,29 @@ public function __construct($data)
2424
$this->data = $data;
2525
}
2626

27+
#[\ReturnTypeWillChange]
2728
public function offsetSet($offset, $value)
2829
{
2930
throw new \InvalidArgumentException(sprintf(
3031
'Setting values not permitted on configuration objects (trying to set "%s" to "%s"',
31-
$offset, $value
32+
$offset,
33+
$value
3234
));
3335
}
3436

37+
#[\ReturnTypeWillChange]
3538
public function offsetExists($offset)
3639
{
3740
return isset($this->data[$offset]);
3841
}
3942

43+
#[\ReturnTypeWillChange]
4044
public function offsetUnset($offset)
4145
{
4246
unset($this->data[$offset]);
4347
}
4448

49+
#[\ReturnTypeWillChange]
4550
public function offsetGet($offset)
4651
{
4752
if (isset($this->data[$offset])) {
@@ -55,26 +60,31 @@ public function offsetGet($offset)
5560
}
5661
}
5762

63+
#[\ReturnTypeWillChange]
5864
public function current()
5965
{
6066
return current($this->data);
6167
}
6268

69+
#[\ReturnTypeWillChange]
6370
public function key()
6471
{
6572
return key($this->data);
6673
}
6774

75+
#[\ReturnTypeWillChange]
6876
public function next()
6977
{
7078
return next($this->data);
7179
}
7280

81+
#[\ReturnTypeWillChange]
7382
public function rewind()
7483
{
7584
return reset($this->data);
7685
}
7786

87+
#[\ReturnTypeWillChange]
7888
public function valid()
7989
{
8090
return current($this->data);

src/PHPCR/Shell/Console/Application/SessionApplication.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ public function __construct()
4545
$this->add($command);
4646
}
4747

48-
public function getDefaultInputDefinition()
48+
public function getDefaultInputDefinition(): InputDefinition
4949
{
5050
return new InputDefinition([]);
5151
}
@@ -56,7 +56,7 @@ public function getDefaultInputDefinition()
5656
*
5757
* {@inheritdoc}
5858
*/
59-
protected function getCommandName(InputInterface $input)
59+
protected function getCommandName(InputInterface $input): string
6060
{
6161
return 'phpcr_shell';
6262
}

src/PHPCR/Shell/Console/Helper/Table.php

+3-2
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,11 @@ class Table extends OriginalTable
1818
{
1919
private $nbRows = 0;
2020

21-
public function addRow($row)
21+
public function addRow($row): static
2222
{
2323
$this->nbRows++;
24-
parent::addRow($row);
24+
25+
return parent::addRow($row);
2526
}
2627

2728
public function getNumberOfRows()

src/PHPCR/Shell/Serializer/YamlEncoder.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ class YamlEncoder implements EncoderInterface, DecoderInterface
2828
*
2929
* {@inheritdoc}
3030
*/
31-
public function encode($data, $format, array $context = [])
31+
public function encode($data, $format, array $context = []): string
3232
{
3333
return Yaml::dump($data);
3434
}
@@ -43,15 +43,15 @@ public function decode($data, $format, array $context = [])
4343
/**
4444
* {@inheritdoc}
4545
*/
46-
public function supportsEncoding($format)
46+
public function supportsEncoding($format): bool
4747
{
4848
return 'yaml' === $format;
4949
}
5050

5151
/**
5252
* {@inheritdoc}
5353
*/
54-
public function supportsDecoding($format)
54+
public function supportsDecoding($format): bool
5555
{
5656
return 'yaml' === $format;
5757
}

src/PHPCR/Shell/Test/ContextBase.php

+8-6
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ private function getXPathForFile($filename)
113113
{
114114
$dom = new \DOMDocument(1.0);
115115
$dom->load($this->getWorkingFilePath($filename));
116-
$xpath = new \DOMXpath($dom);
116+
$xpath = new \DOMXPath($dom);
117117

118118
return $xpath;
119119
}
@@ -209,7 +209,7 @@ public function iShouldSeeATableContainingTheFollowingRows(TableNode $table)
209209
public function iShouldSeeTheFollowing(PyStringNode $string)
210210
{
211211
$output = $this->getOutput();
212-
Assert::assertContains($string->getRaw(), $output);
212+
Assert::assertStringContainsString($string->getRaw(), $output);
213213
}
214214

215215
/**
@@ -218,7 +218,7 @@ public function iShouldSeeTheFollowing(PyStringNode $string)
218218
public function iShouldNotSeeTheFollowing(PyStringNode $string)
219219
{
220220
$output = $this->getOutput();
221-
Assert::assertNotContains($string->getRaw(), $output);
221+
Assert::assertStringNotContainsString($string->getRaw(), $output);
222222
}
223223

224224
/**
@@ -305,7 +305,7 @@ public function theFileExists($arg1)
305305
public function theOutputShouldContain(PyStringNode $string)
306306
{
307307
foreach ($string->getStrings() as $line) {
308-
Assert::assertContains($line, $this->getOutput());
308+
Assert::assertStringContainsString($line, $this->getOutput());
309309
}
310310
}
311311

@@ -774,7 +774,8 @@ public function thePropertyShouldHaveType($arg1, $arg2)
774774
$property = $session->getItem($arg1);
775775
if (!$property instanceof PropertyInterface) {
776776
throw new \InvalidArgumentException(sprintf(
777-
'Item at "%s" is not a property', $arg1
777+
'Item at "%s" is not a property',
778+
$arg1
778779
));
779780
}
780781

@@ -790,7 +791,8 @@ public function thePropertyShouldHaveTypeAndValue($arg1, $arg2, $arg3)
790791
$property = $session->getItem($arg1);
791792
if (!$property instanceof PropertyInterface) {
792793
throw new \InvalidArgumentException(sprintf(
793-
'Item at "%s" is not a property', $arg1
794+
'Item at "%s" is not a property',
795+
$arg1
794796
));
795797
}
796798

tests/PHPCR/Shell/Helper/NodeHelperTest.php

+3
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,12 @@
1414

1515
use PHPCR\NodeInterface;
1616
use PHPUnit\Framework\TestCase;
17+
use Prophecy\PhpUnit\ProphecyTrait;
1718

1819
class NodeHelperTest extends TestCase
1920
{
21+
use ProphecyTrait;
22+
2023
protected $nodeHelper;
2124

2225
public function setUp(): void

tests/PHPCR/Shell/Phpcr/PhpcrSessionTest.php

+3
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,12 @@
1414

1515
use PHPCR\PathNotFoundException;
1616
use PHPUnit\Framework\TestCase;
17+
use Prophecy\PhpUnit\ProphecyTrait;
1718

1819
class PhpcrSessionTest extends TestCase
1920
{
21+
use ProphecyTrait;
22+
2023
public function setUp(): void
2124
{
2225
$this->phpcr = $this->prophesize('PHPCR\SessionInterface');

0 commit comments

Comments
 (0)