diff --git a/.travis.yml b/.travis.yml index fa1c2ba2..fff2af97 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,9 +1,7 @@ language: php php: - - 5.3 - 5.4 - - 5.5 before_script: - composer self-update @@ -12,5 +10,5 @@ before_script: script: - phpunit --coverage-text - - php vendor/behat/behat/bin/behat + - php vendor/behat/behat/bin/behat --format=failed - php vendor/bin/phpspec run diff --git a/features/fixtures/cms.xml b/features/fixtures/cms.xml index 3a52a3c0..37f4bcd2 100644 --- a/features/fixtures/cms.xml +++ b/features/fixtures/cms.xml @@ -31,7 +31,7 @@ mix:referenceable - 13543fc6-1abf-4708-bfcc-e49511754b40 + 66666fc6-1abf-4708-bfcc-e49511754b40 Article 1 diff --git a/features/node_clone.feature b/features/node_clone.feature index 8344e53d..67d1ac2e 100644 --- a/features/node_clone.feature +++ b/features/node_clone.feature @@ -6,25 +6,18 @@ Feature: Clone a node from a given workspace to the current workspace Background: Given that I am logged in as "testuser" And the current workspace is "default_1" - And the "cms.xml" fixtures are loaded + And the "session_data.xml" fixtures are loaded And the current workspace is "default" And the "cms.xml" fixtures are loaded - Scenario: Clone node - Given the current workspace is "default" - And I execute the "node:clone /cms/articles/article1 /cms/clone default_1" command + Scenario: Clone node no workspace (symlink) + Given I execute the "node:clone /cms/articles/article1 /cms/clone" command Then the command should not fail And I save the session And there should exist a node at "/cms/clone" - Scenario: Clone onto existing - Given I execute the "node:clone /cms/articles/article1 /cms/articles default_1" command - Then the command should fail - And I should see the following: - """ - Node already exists at destination - """ - - Scenario: Clone onto existing but remove - Given I execute the "node:clone --remove-existing /cms/articles/article1 /cms/articles/article1 default_1" command + Scenario: Clone node + Given I execute the "node:clone /tests_general_base /cms/foobar default_1" command Then the command should not fail + And I save the session + And there should exist a node at "/cms/foobar" diff --git a/features/node_copy.feature b/features/node_copy.feature index a6933e8d..1a2ad311 100644 --- a/features/node_copy.feature +++ b/features/node_copy.feature @@ -8,15 +8,15 @@ Feature: Copy a node from a given workspace to the current workspace And the current workspace is "default_1" And the "session_data.xml" fixtures are loaded And the current workspace is "default" - And I purge the current workspace + And the "session_data.xml" fixtures are loaded + + Scenario: Copy node in the same workspace + Given I execute the "node:copy /tests_general_base/index.txt /foo" command + Then the command should not fail + And I save the session + And there should exist a node at "/foo" Scenario: Copy node from a different workspace Given I execute the "node:copy /tests_general_base/index.txt /index.txt default_1" command Then the command should not fail And there should exist a node at "/index.txt" - - Scenario: Copy node in the same workspace - Given I execute the "node:copy /tests_general_base/index.txt /tests_general_base/index.txt.2" command - Then the command should not fail - And I save the session - And there should exist a node at "/tests_general_base/index.txt.2" diff --git a/features/session_namespace_list.feature b/features/session_namespace_list.feature index e5cc1453..4047015c 100644 --- a/features/session_namespace_list.feature +++ b/features/session_namespace_list.feature @@ -12,17 +12,4 @@ Feature: List all namepsaces mapped to prefixes in the current session And I should see a table containing the following rows: | Prefix | URI | | jcr | http://www.jcp.org/jcr/1.0 | - | sv | http://www.jcp.org/jcr/sv/1.0 | - | nt | http://www.jcp.org/jcr/nt/1.0 | - | mix | http://www.jcp.org/jcr/mix/1.0 | - | xml | http://www.w3.org/XML/1998/namespace | - | test | http://liip.to/jackalope | - | xs | http://www.w3.org/2001/XMLSchema | - | fn_old | http://www.w3.org/2004/10/xpath-functions | - | crx | http://www.day.com/crx/1.0 | - | lx | http://flux-cms.org/2.0 | - | sling | http://sling.apache.org/jcr/sling/1.0 | - | new_prefix | http://a_new_namespace | - | vlt | http://www.day.com/jcr/vault/1.0 | - | fn | http://www.w3.org/2005/xpath-functions | | rep | internal | diff --git a/src/PHPCR/Shell/Console/Command/Phpcr/NodeCloneCommand.php b/src/PHPCR/Shell/Console/Command/Phpcr/NodeCloneCommand.php index 62f43054..f67b7b09 100644 --- a/src/PHPCR/Shell/Console/Command/Phpcr/NodeCloneCommand.php +++ b/src/PHPCR/Shell/Console/Command/Phpcr/NodeCloneCommand.php @@ -14,8 +14,8 @@ protected function configure() { $this->setName('node:clone'); $this->setDescription('Copy a node from one workspace to another'); - $this->addArgument('srcAbsPath', InputArgument::REQUIRED, 'Absolute path to source node'); - $this->addArgument('destAbsPath', InputArgument::REQUIRED, 'Absolute path to destination node'); + $this->addArgument('srcPath', InputArgument::REQUIRED, 'Path to source node'); + $this->addArgument('destPath', InputArgument::REQUIRED, 'Path to destination node'); $this->addArgument('srcWorkspace', InputArgument::OPTIONAL, 'If specified, copy from this workspace'); $this->addOption('remove-existing', null, InputOption::VALUE_NONE, 'Remove existing nodes'); $this->setHelp(<<getHelper('phpcr')->getSession(); $srcWorkspace = $input->getArgument('srcWorkspace'); - $srcAbsPath = $input->getArgument('srcAbsPath'); - $destAbsPath = $input->getArgument('destAbsPath'); + $srcAbsPath = $session->getAbsPath($input->getArgument('srcPath')); + $destAbsPath = $session->getAbsPath($input->getArgument('destPath')); $removeExisting = $input->getOption('remove-existing'); // todo: Check to ensure that source node has the referenceable mixin + if (!$srcWorkspace) { + $srcWorkspace = $session->getWorkspace()->getName(); + } + $workspace = $session->getWorkspace(); $workspace->cloneFrom($srcWorkspace, $srcAbsPath, $destAbsPath, $removeExisting); } diff --git a/src/PHPCR/Shell/Console/Command/Phpcr/NodeCopyCommand.php b/src/PHPCR/Shell/Console/Command/Phpcr/NodeCopyCommand.php index 0fe96e68..10f83b50 100644 --- a/src/PHPCR/Shell/Console/Command/Phpcr/NodeCopyCommand.php +++ b/src/PHPCR/Shell/Console/Command/Phpcr/NodeCopyCommand.php @@ -13,8 +13,8 @@ protected function configure() { $this->setName('node:copy'); $this->setDescription('Copy a node'); - $this->addArgument('srcAbsPath', InputArgument::REQUIRED, 'Absolute path to source node'); - $this->addArgument('destAbsPath', InputArgument::REQUIRED, 'Absolute path to destination node'); + $this->addArgument('srcPath', InputArgument::REQUIRED, 'Path to source node'); + $this->addArgument('destPath', InputArgument::REQUIRED, 'Path to destination node'); $this->addArgument('srcWorkspace', InputArgument::OPTIONAL, 'If specified, copy from this workspace'); $this->setHelp(<<getHelper('phpcr')->getSession(); - $srcAbsPath = $input->getArgument('srcAbsPath'); - $destAbsPath = $input->getArgument('destAbsPath'); + $srcAbsPath = $session->getAbsPath($input->getArgument('srcPath')); + $destAbsPath = $session->getAbsPath($input->getArgument('destPath')); $srcWorkspace = $input->getArgument('srcWorkspace'); $workspace = $session->getWorkspace(); + $workspace->copy($srcAbsPath, $destAbsPath, $srcWorkspace); } }