Skip to content

Allow installation with symfony 6, drop PHP 7.4 support and test against PHP 8.1 #210

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 21 commits into from
May 2, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
b2f4a14
Allow installation with symfony 6
alexander-schranz Apr 20, 2022
a2a72af
Add ci test against php 8.1
alexander-schranz Apr 20, 2022
9b2c3d6
Remove symfony/symfony from dev dependencies
alexander-schranz Apr 20, 2022
2c8ef1d
Upgrade dev dependencies
alexander-schranz Apr 20, 2022
2e66132
Upgrade YamlEncoder for Symfony 6 compatibility
alexander-schranz Apr 20, 2022
4691615
Add PHP 8.1 compatibility to Config
alexander-schranz Apr 20, 2022
2f8358c
Fix compatibility to Symfony 6 in SessionApplication and Table and dr…
alexander-schranz Apr 20, 2022
e6533b5
Fix ProfileLoaderSpec test
alexander-schranz Apr 20, 2022
b211204
Use behat cli from vendor/bin
alexander-schranz Apr 20, 2022
9df9384
Fix styleci
alexander-schranz Apr 20, 2022
c3dc25e
Use ProphecyTrait to fix test warnings
alexander-schranz Apr 20, 2022
58b43e8
Fix false changed behat cli path
alexander-schranz Apr 20, 2022
4e7bcf0
Test against lowest dependencies
alexander-schranz Apr 20, 2022
9edb585
Replace assertContains with assertStringContainsString
alexander-schranz Apr 20, 2022
6d445e4
Increase dev dependencies lowest to avoid deprecation messages
alexander-schranz Apr 20, 2022
9a84bc1
Upgrade jackrabbit vesion in ci
alexander-schranz Apr 20, 2022
a06ebde
Update errors in context base script
alexander-schranz Apr 29, 2022
6c470b3
Test phpcr shell against forks
alexander-schranz May 2, 2022
a6b814c
Fix assertStringNotContainsString
alexander-schranz May 2, 2022
92b6a30
Test against forks
alexander-schranz May 2, 2022
5426129
Remove forks and uses released versions
alexander-schranz May 2, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 10 additions & 21 deletions .github/workflows/test-application.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,45 +14,34 @@ jobs:
env:
SYMFONY_DEPRECATIONS_HELPER: ${{ matrix.symfony-deprecation-helper }}
BEHAT_SUITE: ${{ matrix.behat-suite }}
COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }}

strategy:
fail-fast: false

matrix:
include:
- php-version: '7.2'
- php-version: '8.0'
dependencies: lowest
behat-suite: standalone

- php-version: '7.2'
- php-version: '8.0'
dependencies: lowest
behat-suite: embedded

- php-version: '7.2'
- php-version: '8.0'
dependencies: lowest
behat-suite: cli

- php-version: '7.4'
- php-version: '8.1'
dependencies: highest
behat-suite: standalone

- php-version: '7.4'
- php-version: '8.1'
dependencies: highest
behat-suite: embedded

- php-version: '7.4'
dependencies: highest
behat-suite: cli

- php-version: '8.0'
dependencies: highest
behat-suite: standalone

- php-version: '8.0'
dependencies: highest
behat-suite: embedded

- php-version: '8.0'
- php-version: '8.1'
dependencies: highest
behat-suite: cli

Expand All @@ -67,17 +56,17 @@ jobs:
tools: 'composer:v2'

- name: Install dependencies with Composer
uses: ramsey/composer-install@v1
uses: ramsey/composer-install@v2
with:
dependency-versions: ${{ matrix.dependencies }}
composer-options: ${{ matrix.composer-options }}

- name: Start Jackrabbit
run: |
tests/bin/travis_jackrabbit.sh
JACKRABBIT_VERSION=2.21.10 tests/bin/travis_jackrabbit.sh

- name: Execute test cases
run: |
vendor/bin/phpunit
vendor/bin/phpspec run
vendor/behat/behat/bin/behat --suite=${{ matrix.behat-suite }}
vendor/bin/behat --suite=${{ matrix.behat-suite }}
24 changes: 12 additions & 12 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,25 @@
"name": "phpcr/phpcr-shell",
"description": "Shell for PHPCR",
"require": {
"php": "^7.2 || ^8.0",
"symfony/console": "^5.0",
"php": "^8.0",
"symfony/console": "^5.0 || ^6.0",
"jackalope/jackalope": "^1.3.4",
"phpcr/phpcr": "^2.1",
"phpcr/phpcr-utils": "^1.2",
"symfony/finder": "^5.0",
"symfony/serializer": "^5.0",
"symfony/yaml": "^5.0",
"symfony/dependency-injection": "^5.0",
"symfony/expression-language": "^5.0",
"symfony/finder": "^5.0 || ^6.0",
"symfony/serializer": "^5.0 || ^6.0",
"symfony/yaml": "^5.0 || ^6.0",
"symfony/dependency-injection": "^5.0 || ^6.0",
"symfony/expression-language": "^5.0 || ^6.0",
"dantleech/glob-finder": "^1.0"
},
"require-dev": {
"phpunit/phpunit": "^8.5",
"symfony/symfony": "^5.0",
"behat/behat": "^3.6",
"phpspec/phpspec": "^6.0",
"phpunit/phpunit": "^9.5",
"behat/behat": "^3.10",
"phpspec/phpspec": "^7.2",
"jackalope/jackalope-doctrine-dbal": "^1.3",
"jackalope/jackalope-jackrabbit": "^1.3"
"jackalope/jackalope-jackrabbit": "^1.4.4",
"phpspec/prophecy-phpunit": "^2.0"
},
"suggest": {
"jackalope/jackalope-doctrine-dbal": "To connect to jackalope doctrine-dbal",
Expand Down
8 changes: 6 additions & 2 deletions spec/PHPCR/Shell/Config/ProfileLoaderSpec.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,12 @@ public function it_is_initializable()
$this->shouldHaveType('PHPCR\Shell\Config\ProfileLoader');
}

public function it_should_list_profile_names()
{
public function it_should_list_profile_names(
Filesystem $filesystem
) {
$filesystem->exists(Argument::any())
->willReturn(true);

$this->getProfileNames()->shouldReturn([
'one', 'two',
]);
Expand Down
12 changes: 11 additions & 1 deletion src/PHPCR/Shell/Config/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,24 +24,29 @@ public function __construct($data)
$this->data = $data;
}

#[\ReturnTypeWillChange]
public function offsetSet($offset, $value)
{
throw new \InvalidArgumentException(sprintf(
'Setting values not permitted on configuration objects (trying to set "%s" to "%s"',
$offset, $value
$offset,
$value
));
}

#[\ReturnTypeWillChange]
public function offsetExists($offset)
{
return isset($this->data[$offset]);
}

#[\ReturnTypeWillChange]
public function offsetUnset($offset)
{
unset($this->data[$offset]);
}

#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
if (isset($this->data[$offset])) {
Expand All @@ -55,26 +60,31 @@ public function offsetGet($offset)
}
}

#[\ReturnTypeWillChange]
public function current()
{
return current($this->data);
}

#[\ReturnTypeWillChange]
public function key()
{
return key($this->data);
}

#[\ReturnTypeWillChange]
public function next()
{
return next($this->data);
}

#[\ReturnTypeWillChange]
public function rewind()
{
return reset($this->data);
}

#[\ReturnTypeWillChange]
public function valid()
{
return current($this->data);
Expand Down
4 changes: 2 additions & 2 deletions src/PHPCR/Shell/Console/Application/SessionApplication.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public function __construct()
$this->add($command);
}

public function getDefaultInputDefinition()
public function getDefaultInputDefinition(): InputDefinition
{
return new InputDefinition([]);
}
Expand All @@ -56,7 +56,7 @@ public function getDefaultInputDefinition()
*
* {@inheritdoc}
*/
protected function getCommandName(InputInterface $input)
protected function getCommandName(InputInterface $input): string
{
return 'phpcr_shell';
}
Expand Down
5 changes: 3 additions & 2 deletions src/PHPCR/Shell/Console/Helper/Table.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,11 @@ class Table extends OriginalTable
{
private $nbRows = 0;

public function addRow($row)
public function addRow($row): static
{
$this->nbRows++;
parent::addRow($row);

return parent::addRow($row);
}

public function getNumberOfRows()
Expand Down
6 changes: 3 additions & 3 deletions src/PHPCR/Shell/Serializer/YamlEncoder.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class YamlEncoder implements EncoderInterface, DecoderInterface
*
* {@inheritdoc}
*/
public function encode($data, $format, array $context = [])
public function encode($data, $format, array $context = []): string
{
return Yaml::dump($data);
}
Expand All @@ -43,15 +43,15 @@ public function decode($data, $format, array $context = [])
/**
* {@inheritdoc}
*/
public function supportsEncoding($format)
public function supportsEncoding($format): bool
{
return 'yaml' === $format;
}

/**
* {@inheritdoc}
*/
public function supportsDecoding($format)
public function supportsDecoding($format): bool
{
return 'yaml' === $format;
}
Expand Down
14 changes: 8 additions & 6 deletions src/PHPCR/Shell/Test/ContextBase.php
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ private function getXPathForFile($filename)
{
$dom = new \DOMDocument(1.0);
$dom->load($this->getWorkingFilePath($filename));
$xpath = new \DOMXpath($dom);
$xpath = new \DOMXPath($dom);

return $xpath;
}
Expand Down Expand Up @@ -209,7 +209,7 @@ public function iShouldSeeATableContainingTheFollowingRows(TableNode $table)
public function iShouldSeeTheFollowing(PyStringNode $string)
{
$output = $this->getOutput();
Assert::assertContains($string->getRaw(), $output);
Assert::assertStringContainsString($string->getRaw(), $output);
}

/**
Expand All @@ -218,7 +218,7 @@ public function iShouldSeeTheFollowing(PyStringNode $string)
public function iShouldNotSeeTheFollowing(PyStringNode $string)
{
$output = $this->getOutput();
Assert::assertNotContains($string->getRaw(), $output);
Assert::assertStringNotContainsString($string->getRaw(), $output);
}

/**
Expand Down Expand Up @@ -305,7 +305,7 @@ public function theFileExists($arg1)
public function theOutputShouldContain(PyStringNode $string)
{
foreach ($string->getStrings() as $line) {
Assert::assertContains($line, $this->getOutput());
Assert::assertStringContainsString($line, $this->getOutput());
}
}

Expand Down Expand Up @@ -774,7 +774,8 @@ public function thePropertyShouldHaveType($arg1, $arg2)
$property = $session->getItem($arg1);
if (!$property instanceof PropertyInterface) {
throw new \InvalidArgumentException(sprintf(
'Item at "%s" is not a property', $arg1
'Item at "%s" is not a property',
$arg1
));
}

Expand All @@ -790,7 +791,8 @@ public function thePropertyShouldHaveTypeAndValue($arg1, $arg2, $arg3)
$property = $session->getItem($arg1);
if (!$property instanceof PropertyInterface) {
throw new \InvalidArgumentException(sprintf(
'Item at "%s" is not a property', $arg1
'Item at "%s" is not a property',
$arg1
));
}

Expand Down
3 changes: 3 additions & 0 deletions tests/PHPCR/Shell/Helper/NodeHelperTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,12 @@

use PHPCR\NodeInterface;
use PHPUnit\Framework\TestCase;
use Prophecy\PhpUnit\ProphecyTrait;

class NodeHelperTest extends TestCase
{
use ProphecyTrait;

protected $nodeHelper;

public function setUp(): void
Expand Down
3 changes: 3 additions & 0 deletions tests/PHPCR/Shell/Phpcr/PhpcrSessionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,12 @@

use PHPCR\PathNotFoundException;
use PHPUnit\Framework\TestCase;
use Prophecy\PhpUnit\ProphecyTrait;

class PhpcrSessionTest extends TestCase
{
use ProphecyTrait;

public function setUp(): void
{
$this->phpcr = $this->prophesize('PHPCR\SessionInterface');
Expand Down