Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
12 changes: 11 additions & 1 deletion .github/workflows/test-application.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,17 @@ jobs:
include:
- php-version: '8.0'
dependencies: 'lowest'
symfony-version: '*'
- php-version: '8.1'
symfony-version: '6.*'
- php-version: '8.2'
symfony-version: '7.*'
- php-version: '8.3'
symfony-version: '7.*'
- php-version: '8.4'
symfony-version: '8.*'
- php-version: '8.5'
symfony-version: '8.*'

steps:
- name: Checkout project
Expand All @@ -33,7 +39,11 @@ jobs:
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}
tools: 'composer:v2'
tools: 'composer:v2, flex'

- name: Symfony version
if: matrix.symfony-version != '*'
run: composer config extra.symfony.require ${{ matrix.symfony-version }}

- name: Allow unstable dependencies
if: matrix.dev-dependencies == true
Expand Down
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@ Changelog
2.x
---

2.0.3
-----

* Allow installation with Symfony Console 8.x.
* Test with PHP 8.5.

2.0.2
-----

Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"require": {
"php": "^8.0",
"phpcr/phpcr": "~2.1.0",
"symfony/console": "^3.0 || ^4.0 || ^5.0 || ^6.0 || ^7.0"
"symfony/console": "^3.0 || ^4.0 || ^5.0 || ^6.0 || ^7.0 || ^8.0"
},
"require-dev": {
"ramsey/uuid": "^3.5",
Expand Down
17 changes: 17 additions & 0 deletions tests/PHPCR/Tests/Util/Console/Command/BaseCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
use PHPUnit\Framework\MockObject\MockObject;
use PHPUnit\Framework\TestCase;
use Symfony\Component\Console\Application;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Helper\HelperSet;
use Symfony\Component\Console\Tester\CommandTester;

Expand Down Expand Up @@ -110,6 +111,22 @@ public function setUp(): void
$this->application->setHelperSet($this->helperSet);
}

protected function addCommand(callable|Command $command): void
{
/* @phpstan-ignore function.alreadyNarrowedType */
if (method_exists($this->application, 'addCommand')) {
$this->application->addCommand($command);

return;
}

if (!$command instanceof Command) {
throw new \InvalidArgumentException('Until we remove support for symfony console < 7.4, all commands must extend the base class');
}

$this->application->add($command);
}

/**
* Build and execute the command tester.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public function setUp(): void
->getMock();

$ndCommand = new NodeDumpCommand();
$this->application->add($ndCommand);
$this->addCommand($ndCommand);
}

public function testCommand(): void
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public function testCommand(array $args): void
$this->session->expects($this->once())
->method('save');

$this->application->add(new NodeMoveCommand());
$this->addCommand(new NodeMoveCommand());
$this->executeCommand('phpcr:node:move', $args);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public function setUp(): void
{
parent::setUp();

$this->application->add(new NodeRemoveCommand());
$this->addCommand(new NodeRemoveCommand());
}

public function testRemove(): void
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public function setUp(): void
parent::setUp();

$command = new NodeTouchCommand();
$this->application->add($command);
$this->addCommand($command);

// Override default concrete instance with mock
$this->phpcrHelper = $this->getMockBuilder(PhpcrHelper::class)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public function setUp(): void
{
parent::setUp();

$this->application->add(new NodeTypeListCommand());
$this->addCommand(new NodeTypeListCommand());
$this->nodeTypeManager = $this->getMockBuilder(MockNodeTypeManager::class)
->disableOriginalConstructor()
->getMock();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public function setUp(): void
{
parent::setUp();

$this->application->add(new NodeTypeRegisterCommand());
$this->addCommand(new NodeTypeRegisterCommand());
$this->nodeTypeManager = $this->getMockBuilder(MockNodeTypeManager::class)
->disableOriginalConstructor()
->getMock();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public function setUp(): void
{
parent::setUp();

$this->application->add(new NodesUpdateCommand());
$this->addCommand(new NodesUpdateCommand());
$this->query = $this->createMock(QueryInterface::class);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public function setUp(): void
{
parent::setUp();

$this->application->add(new WorkspaceCreateCommand());
$this->addCommand(new WorkspaceCreateCommand());
}

public function testCreate(): void
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public function setUp(): void
{
parent::setUp();

$this->application->add(new WorkspaceDeleteCommand());
$this->addCommand(new WorkspaceDeleteCommand());
}

public function testDelete(): void
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public function setUp(): void
{
parent::setUp();

$this->application->add(new WorkspaceExportCommand());
$this->addCommand(new WorkspaceExportCommand());
}

public function tearDown(): void
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public function setUp(): void
{
parent::setUp();

$this->application->add(new WorkspaceImportCommand());
$this->addCommand(new WorkspaceImportCommand());
}

public function testImport(): void
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public function setUp(): void
{
parent::setUp();

$this->application->add(new WorkspaceListCommand());
$this->addCommand(new WorkspaceListCommand());
}

public function testNodeTypeList(): void
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public function setUp(): void
{
parent::setUp();

$this->application->add(new WorkspacePurgeCommand());
$this->addCommand(new WorkspacePurgeCommand());
}

public function testNodeTypePurge(): void
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public function setUp(): void
{
parent::setUp();

$this->application->add(new WorkspaceQueryCommand());
$this->addCommand(new WorkspaceQueryCommand());
$this->query = $this->createMock(QueryInterface::class);
}

Expand Down