diff --git a/.github/workflows/test-application.yaml b/.github/workflows/test-application.yaml index bbd00392..651d4230 100644 --- a/.github/workflows/test-application.yaml +++ b/.github/workflows/test-application.yaml @@ -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 @@ -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 }} diff --git a/composer.json b/composer.json index 2030e4f3..6ef57e69 100644 --- a/composer.json +++ b/composer.json @@ -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", diff --git a/spec/PHPCR/Shell/Config/ProfileLoaderSpec.php b/spec/PHPCR/Shell/Config/ProfileLoaderSpec.php index 9af91fc0..4f9ea3b9 100644 --- a/spec/PHPCR/Shell/Config/ProfileLoaderSpec.php +++ b/spec/PHPCR/Shell/Config/ProfileLoaderSpec.php @@ -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', ]); diff --git a/src/PHPCR/Shell/Config/Config.php b/src/PHPCR/Shell/Config/Config.php index a3f8952c..00679f62 100644 --- a/src/PHPCR/Shell/Config/Config.php +++ b/src/PHPCR/Shell/Config/Config.php @@ -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])) { @@ -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); diff --git a/src/PHPCR/Shell/Console/Application/SessionApplication.php b/src/PHPCR/Shell/Console/Application/SessionApplication.php index 1d713a86..ce9676c7 100644 --- a/src/PHPCR/Shell/Console/Application/SessionApplication.php +++ b/src/PHPCR/Shell/Console/Application/SessionApplication.php @@ -45,7 +45,7 @@ public function __construct() $this->add($command); } - public function getDefaultInputDefinition() + public function getDefaultInputDefinition(): InputDefinition { return new InputDefinition([]); } @@ -56,7 +56,7 @@ public function getDefaultInputDefinition() * * {@inheritdoc} */ - protected function getCommandName(InputInterface $input) + protected function getCommandName(InputInterface $input): string { return 'phpcr_shell'; } diff --git a/src/PHPCR/Shell/Console/Helper/Table.php b/src/PHPCR/Shell/Console/Helper/Table.php index 109d3023..c3a3a24a 100644 --- a/src/PHPCR/Shell/Console/Helper/Table.php +++ b/src/PHPCR/Shell/Console/Helper/Table.php @@ -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() diff --git a/src/PHPCR/Shell/Serializer/YamlEncoder.php b/src/PHPCR/Shell/Serializer/YamlEncoder.php index 2665978c..e63667da 100644 --- a/src/PHPCR/Shell/Serializer/YamlEncoder.php +++ b/src/PHPCR/Shell/Serializer/YamlEncoder.php @@ -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); } @@ -43,7 +43,7 @@ public function decode($data, $format, array $context = []) /** * {@inheritdoc} */ - public function supportsEncoding($format) + public function supportsEncoding($format): bool { return 'yaml' === $format; } @@ -51,7 +51,7 @@ public function supportsEncoding($format) /** * {@inheritdoc} */ - public function supportsDecoding($format) + public function supportsDecoding($format): bool { return 'yaml' === $format; } diff --git a/src/PHPCR/Shell/Test/ContextBase.php b/src/PHPCR/Shell/Test/ContextBase.php index 4558d2d9..13868dc3 100644 --- a/src/PHPCR/Shell/Test/ContextBase.php +++ b/src/PHPCR/Shell/Test/ContextBase.php @@ -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; } @@ -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); } /** @@ -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); } /** @@ -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()); } } @@ -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 )); } @@ -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 )); } diff --git a/tests/PHPCR/Shell/Helper/NodeHelperTest.php b/tests/PHPCR/Shell/Helper/NodeHelperTest.php index 7495cb7b..99bb8336 100644 --- a/tests/PHPCR/Shell/Helper/NodeHelperTest.php +++ b/tests/PHPCR/Shell/Helper/NodeHelperTest.php @@ -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 diff --git a/tests/PHPCR/Shell/Phpcr/PhpcrSessionTest.php b/tests/PHPCR/Shell/Phpcr/PhpcrSessionTest.php index e98bf54f..6e04ee86 100644 --- a/tests/PHPCR/Shell/Phpcr/PhpcrSessionTest.php +++ b/tests/PHPCR/Shell/Phpcr/PhpcrSessionTest.php @@ -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');