Skip to content

Add symfony 5 support #204

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
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
vendor
composer.lock
phpcr.phar
.phpunit.result.cache
54 changes: 9 additions & 45 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,75 +1,39 @@
language: php
dist: trusty

matrix:
include:
- php: 5.6
- php: 7.2
env:
- PREFER="--prefer-lowest"
- BEHAT_SUITE=standalone
- SYMFONY_VERSION=^2.8
- php: 5.6
- php: 7.2
env:
- PREFER="--prefer-lowest"
- BEHAT_SUITE=embedded
- SYMFONY_VERSION=^3.0
- php: 5.6
- php: 7.2
env:
- PREFER="--prefer-lowest"
- BEHAT_SUITE=cli
- SYMFONY_VERSION=^3.0
- php: 7.0
env:
- PREFER=""
- BEHAT_SUITE=standalone
- SYMFONY_VERSION=^2.8
- php: 7.0
env:
- PREFER=""
- BEHAT_SUITE=embedded
- SYMFONY_VERSION=^3.0
- php: 7.0
env:
- PREFER=""
- BEHAT_SUITE=cli
- SYMFONY_VERSION=^3.0
- php: 7.1
- php: 7.4
env:
- PREFER=""
- BEHAT_SUITE=standalone
- SYMFONY_VERSION=^2.8
- php: 7.1
- php: 7.4
env:
- PREFER=""
- BEHAT_SUITE=embedded
- SYMFONY_VERSION=^3.4
- php: 7.1
env:
- PREFER=""
- BEHAT_SUITE=cli
- SYMFONY_VERSION=^4.0
- php: 7.2
env:
- PREFER=""
- BEHAT_SUITE=standalone
- SYMFONY_VERSION=^2.8
- php: 7.2
env:
- PREFER=""
- BEHAT_SUITE=embedded
- SYMFONY_VERSION=^3.0
- php: 7.2
- php: 7.4
env:
- PREFER=""
- BEHAT_SUITE=cli
- SYMFONY_VERSION=^4.0

before_script:
- composer self-update
- composer require "symfony/symfony" "$SYMFONY_VERSION" --no-update
- composer update $PREFER
- bash tests/bin/travis_jackrabbit.sh

script:
- phpunit
script:
- vendor/bin/phpunit
- php vendor/bin/phpspec run
- php vendor/behat/behat/bin/behat --suite=$BEHAT_SUITE
34 changes: 17 additions & 17 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": "^5.6|^7.0",
"symfony/console": "~2.8|~3.0|~4.0",
"jackalope/jackalope": "~1.1",
"phpcr/phpcr": "~2.1",
"phpcr/phpcr-utils": "~1.2",
"symfony/finder": "~2.8|~3.0|~4.0",
"symfony/serializer": "~2.8|~3.0|~4.0",
"symfony/yaml": "~2.8|~3.0|~4.0",
"symfony/dependency-injection": "~2.8|~3.0|~4.0",
"symfony/expression-language": "~2.8|~3.0|~4.0",
"dantleech/glob-finder": "~1.0"
"php": "^7.2",
"symfony/console": "^5.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",
"dantleech/glob-finder": "^1.0"
},
"require-dev": {
"symfony/symfony": "~2.8|~3.0|~4.0",
"phpunit/phpunit": "~5.7",
"behat/behat": "~3.1",
"phpspec/phpspec": "~3.2|~4.0",
"jackalope/jackalope-doctrine-dbal": "~1.2",
"jackalope/jackalope-jackrabbit": "~1.2"
"phpunit/phpunit": "^8.5",
"symfony/symfony": "^5.0",
"behat/behat": "^3.6",
"phpspec/phpspec": "^6.0",
"jackalope/jackalope-doctrine-dbal": "^1.3",
"jackalope/jackalope-jackrabbit": "^1.3"
},
"suggest": {
"jackalope/jackalope-doctrine-dbal": "To connect to jackalope doctrine-dbal",
Expand Down
14 changes: 9 additions & 5 deletions src/PHPCR/Shell/Console/Application/ShellApplication.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@

namespace PHPCR\Shell\Console\Application;

use PHPCR\Shell\Config\Profile;
use PHPCR\Shell\Console\Command\Phpcr as CommandPhpcr;
use PHPCR\Shell\Console\Command\Phpcr\BasePhpcrCommand;
use PHPCR\Shell\Console\Command\Shell as CommandShell;
Expand Down Expand Up @@ -57,6 +56,11 @@ class ShellApplication extends Application
*/
protected $initialized = false;

/**
* @var EventDispatcher
*/
private $dispatcher;

/**
* Constructor - name and version inherited from SessionApplication.
*
Expand Down Expand Up @@ -95,7 +99,7 @@ public function init()
$this->registerShellCommands();

$event = new ApplicationInitEvent($this);
$this->dispatcher->dispatch(PhpcrShellEvents::APPLICATION_INIT, $event);
$this->dispatcher->dispatch($event, PhpcrShellEvents::APPLICATION_INIT);
$this->initialized = true;
}

Expand Down Expand Up @@ -242,7 +246,7 @@ public function doRun(InputInterface $input, OutputInterface $output)
$name = $this->getCommandName($input);

$event = new Event\CommandPreRunEvent($name, $input);
$this->dispatcher->dispatch(PhpcrShellEvents::COMMAND_PRE_RUN, $event);
$this->dispatcher->dispatch($event, PhpcrShellEvents::COMMAND_PRE_RUN);
$input = $event->getInput();

if (!$name) {
Expand All @@ -252,7 +256,7 @@ public function doRun(InputInterface $input, OutputInterface $output)
try {
$exitCode = parent::doRun($input, $output);
} catch (\Exception $e) {
$this->dispatcher->dispatch(PhpcrShellEvents::COMMAND_EXCEPTION, new Event\CommandExceptionEvent($e, $this, $output));
$this->dispatcher->dispatch(new Event\CommandExceptionEvent($e, $this, $output), PhpcrShellEvents::COMMAND_EXCEPTION);

return 1;
}
Expand Down Expand Up @@ -292,7 +296,7 @@ public function add(Command $command)
public function dispatchProfileInitEvent(InputInterface $sessionInput, OutputInterface $output)
{
$event = new Event\ProfileInitEvent($this->container->get('config.profile'), $sessionInput, $output);
$this->dispatcher->dispatch(PhpcrShellEvents::PROFILE_INIT, $event);
$this->dispatcher->dispatch($event, PhpcrShellEvents::PROFILE_INIT);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,5 +73,7 @@ public function execute(InputInterface $input, OutputInterface $output)
foreach ($privileges as $privilege) {
$table->addRow([$privilege->getName()]);
}

return 0;
}
}
2 changes: 2 additions & 0 deletions src/PHPCR/Shell/Console/Command/Phpcr/LockInfoCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,5 +64,7 @@ public function execute(InputInterface $input, OutputInterface $output)
}

$table->render($output);

return 0;
}
}
2 changes: 2 additions & 0 deletions src/PHPCR/Shell/Console/Command/Phpcr/LockLockCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,5 +79,7 @@ public function execute(InputInterface $input, OutputInterface $output)
$ownerInfo = $input->getOption('owner-info');

$lockManager->lock($path, $isDeep, $isSessionScoped, $timeout, $ownerInfo);

return 0;
}
}
3 changes: 2 additions & 1 deletion src/PHPCR/Shell/Console/Command/Phpcr/LockRefreshCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
namespace PHPCR\Shell\Console\Command\Phpcr;

use PHPCR\RepositoryInterface;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
Expand Down Expand Up @@ -50,5 +49,7 @@ public function execute(InputInterface $input, OutputInterface $output)
$lock = $lockManager->getLock($node->getPath());
$lock->refresh();
}

return 0;
}
}
2 changes: 2 additions & 0 deletions src/PHPCR/Shell/Console/Command/Phpcr/LockTokenAddCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,5 +43,7 @@ public function execute(InputInterface $input, OutputInterface $output)
$lockToken = $input->getArgument('lockToken');

$lockManager->addLockToken($lockToken);

return 0;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -51,5 +51,7 @@ public function execute(InputInterface $input, OutputInterface $output)
}

$table->render($output);

return 0;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -40,5 +40,7 @@ public function execute(InputInterface $input, OutputInterface $output)
$lockToken = $input->getArgument('lockToken');

$lockManager->removeLockToken($lockToken);

return 0;
}
}
2 changes: 2 additions & 0 deletions src/PHPCR/Shell/Console/Command/Phpcr/LockUnlockCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,5 +48,7 @@ public function execute(InputInterface $input, OutputInterface $output)
$path = $session->getAbsPath($input->getArgument('path'));

$lockManager->unlock($path);

return 0;
}
}
2 changes: 2 additions & 0 deletions src/PHPCR/Shell/Console/Command/Phpcr/NodeCloneCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,5 +73,7 @@ public function execute(InputInterface $input, OutputInterface $output)

$workspace = $session->getWorkspace();
$workspace->cloneFrom($srcWorkspace, $srcAbsPath, $destAbsPath, $removeExisting);

return 0;
}
}
2 changes: 2 additions & 0 deletions src/PHPCR/Shell/Console/Command/Phpcr/NodeCopyCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,5 +47,7 @@ public function execute(InputInterface $input, OutputInterface $output)

$workspace = $session->getWorkspace();
$workspace->copy($srcAbsPath, $destAbsPath, $srcWorkspace);

return 0;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -39,5 +39,7 @@ public function execute(InputInterface $input, OutputInterface $output)
$currentNode = $session->getNodeByPathOrIdentifier($path);
$correspondingPath = $currentNode->getCorrespondingNodePath($workspaceName);
$output->writeln($correspondingPath);

return 0;
}
}
2 changes: 2 additions & 0 deletions src/PHPCR/Shell/Console/Command/Phpcr/NodeCreateCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,5 +56,7 @@ public function execute(InputInterface $input, OutputInterface $output)
$nodeName = $pathHelper->getNodeName($path);
$parentNode = $session->getNode($parentPath);
$parentNode->addNode($nodeName, $primaryNodeTypeName);

return 0;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,8 @@ public function execute(InputInterface $input, OutputInterface $output)
} else {
$this->importToContainer($fhandle, $mimeType, $filePath, $filename, $parentNode, $force);
}

return 0;
}

private function importToProperty($fhandle, $filePath, $filename, $parentNode, $force)
Expand Down
2 changes: 2 additions & 0 deletions src/PHPCR/Shell/Console/Command/Phpcr/NodeInfoCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,5 +85,7 @@ public function execute(InputInterface $input, OutputInterface $output)

$table->render($output);
}

return 0;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
namespace PHPCR\Shell\Console\Command\Phpcr;

use PHPCR\RepositoryInterface;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
Expand Down Expand Up @@ -49,5 +48,7 @@ public function execute(InputInterface $input, OutputInterface $output)
$currentNode = $session->getNodeByPathOrIdentifier($path);
$transition = $input->getArgument('transition');
$currentNode->followLifecycleTransition($transition);

return 0;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -42,5 +42,7 @@ public function execute(InputInterface $input, OutputInterface $output)
foreach ($transitions as $transition) {
$output->writeln('<info>'.$transition.'</info>');
}

return 0;
}
}
3 changes: 2 additions & 1 deletion src/PHPCR/Shell/Console/Command/Phpcr/NodeListCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
use PHPCR\PropertyInterface;
use PHPCR\PropertyType;
use PHPCR\Shell\Console\Helper\Table;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
Expand Down Expand Up @@ -141,6 +140,8 @@ public function execute(InputInterface $input, OutputInterface $output)
number_format($this->time, $config['execution_time_expansion']))
);
}

return 0;
}

private function renderNode($currentNode, $table, $spacers = [], $filter = null)
Expand Down
2 changes: 2 additions & 0 deletions src/PHPCR/Shell/Console/Command/Phpcr/NodeMixinAddCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,5 +46,7 @@ public function execute(InputInterface $input, OutputInterface $output)
foreach ($nodes as $node) {
$node->addMixin($mixinName);
}

return 0;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -45,5 +45,7 @@ public function execute(InputInterface $input, OutputInterface $output)
foreach ($nodes as $node) {
$node->removeMixin($mixinName);
}

return 0;
}
}
3 changes: 2 additions & 1 deletion src/PHPCR/Shell/Console/Command/Phpcr/NodeMoveCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@

namespace PHPCR\Shell\Console\Command\Phpcr;

use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
Expand Down Expand Up @@ -42,5 +41,7 @@ public function execute(InputInterface $input, OutputInterface $output)
$destPath = $input->getArgument('destPath');

$session->move($srcPath, $destPath);

return 0;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -47,5 +47,7 @@ public function execute(InputInterface $input, OutputInterface $output)
$destChildRelPath = $input->getArgument('destChildRelPath');
$node = $session->getNodeByPathOrIdentifier($path);
$node->orderBefore($srcChildRelPath, $destChildRelPath);

return 0;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -44,5 +44,7 @@ public function execute(InputInterface $input, OutputInterface $output)
}

$property->remove();

return 0;
}
}
Loading