Skip to content

Commit a78efb0

Browse files
committed
Merge pull request #22 from phpcr/version_features
Implemented missing version features
2 parents d28469f + 3052e45 commit a78efb0

14 files changed

+222
-55
lines changed

features/bootstrap/FeatureContext.php

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,6 @@ public function beforeScenario()
6161
/**
6262
* Cleans test folders in the temporary directory.
6363
*
64-
* @BeforeSuite
6564
* @AfterSuite
6665
*/
6766
public static function cleanTestFolders()
@@ -150,6 +149,17 @@ public function iExecuteTheCommand($args)
150149
$this->executeCommand($args);
151150
}
152151

152+
/**
153+
* @Given /^I execute the following commands:$/
154+
*/
155+
public function iExecuteTheFollowingCommands(TableNode $table)
156+
{
157+
foreach ($table->getRows() as $row) {
158+
$this->executeCommand($row[0]);
159+
$this->theCommandShouldNotFail();
160+
}
161+
}
162+
153163
/**
154164
* @Then /^I should see a table containing the following rows:$/
155165
*/
@@ -190,6 +200,15 @@ public function iShouldSeeTheFollowing(PyStringNode $string)
190200
PHPUnit_Framework_Assert::assertContains($string->getRaw(), $output);
191201
}
192202

203+
/**
204+
* @Then /^I should not see the following:$/
205+
*/
206+
public function iShouldNotSeeTheFollowing(PyStringNode $string)
207+
{
208+
$output = $this->getOutput();
209+
PHPUnit_Framework_Assert::assertNotContains($string->getRaw(), $output);
210+
}
211+
193212
/**
194213
* @Given /^the "([^"]*)" fixtures are loaded$/
195214
*/
@@ -765,4 +784,13 @@ public function theNodeShouldNotBeLocked($arg1)
765784

766785
PHPUnit_Framework_Assert::assertFalse($isLocked);
767786
}
787+
788+
/**
789+
* @Given /^I purge the current workspace$/
790+
*/
791+
public function iPurgeTheCurrentWorkspace()
792+
{
793+
$session = $this->getSession();
794+
NodeHelper::purgeWorkspace($session);
795+
}
768796
}

features/lock_token_remove.feature

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ Feature: Remove a lock token in the current session
99
Scenario: Create a new node
1010
Given I execute the "lock:token:remove foobar" command
1111
Then the command should fail
12-
Then I should not see the following:
12+
Then I should see the following:
1313
"""
1414
Not implemented
1515
"""

features/node_info.feature

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ Feature: Show information about node
1919
| Index | 1 |
2020
| Primary node type | nt:unstructured |
2121
| Mixin node types | |
22-
| Checked out? | [ERROR] Not implemented by jackalope |
22+
| Checked out? | N/A |
2323
| Locked? | [ERROR] Not implemented by jackalope |
2424
+-------------------+--------------------------------------+
2525
"""

features/version_checkout.feature

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,13 @@ Feature: Checkout a version
1010
Scenario: Checkout a a given node
1111
Given I execute the "version:checkout /tests_version_base/versioned" command
1212
Then the command should not fail
13-
And the node "/tests_version_base/verionable" should be checked out
13+
And the current node is "/tests_version_base/versioned"
14+
And I execute the "node:info" command
15+
Then I should see the following:
16+
"""
17+
| Checked out? | yes
18+
"""
19+
1420

1521
Scenario: Checkout a non-versionable node
1622
Given I execute the "version:checkout /tests_version_base" command

features/version_checkpoint.feature

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,23 @@ Feature: Checkpoint
88
And the "versionable.xml" fixtures are loaded
99

1010
Scenario: Checkpoint a a given node
11-
Given I execute the "version:checkpoint /tests_version_base/versioned" command
11+
Given I execute the following commands:
12+
| cd /tests_version_base/versioned |
13+
| node:set foo bar |
14+
| session:save |
15+
| version:checkpoint /tests_version_base/versioned |
16+
| node:set foo baz |
17+
| session:save |
18+
| version:checkpoint /tests_version_base/versioned |
1219
Then the command should not fail
13-
And the node "/tests_version_base/verionable" should be checked out
1420
And I should see the following:
1521
"""
16-
Version:
22+
Version: 1.1
23+
"""
24+
And I execute the "node:info" command
25+
Then I should see the following:
26+
"""
27+
| Checked out? | yes
1728
"""
1829

1930
Scenario: Checkpoint a non versionable node

features/version_remove.feature

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,23 @@ Feature: Remove node version
55

66
Background:
77
Given that I am logged in as "testuser"
8-
And the "session_data.xml" fixtures are loaded
8+
And the "versionable.xml" fixtures are loaded
99

1010
Scenario: Checkout a a given node
11-
Given the node "/tests_general_base" has a version with label "mylabel"
12-
And I execute the "version:remove /tests_general_base mylabel" command
11+
Given I execute the following commands:
12+
| cd /tests_version_base/versioned |
13+
| version:checkout /tests_version_base/versioned |
14+
| node:set foo baz |
15+
| session:save |
16+
| version:checkin /tests_version_base/versioned |
17+
| version:checkout /tests_version_base/versioned |
18+
| node:set foo bar |
19+
| session:save |
20+
| version:checkin /tests_version_base/versioned |
21+
And I execute the "version:remove /tests_version_base/versioned 1.0" command
1322
Then the command should not fail
14-
And the node "/tests_general_base" should have a node version labeled "mylabel"
23+
And I execute the "version:history /tests_version_base/versioned" command
24+
Then I should not see the following:
25+
"""
26+
| 1.0 |
27+
"""

features/version_restore.feature

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -5,22 +5,21 @@ Feature: Restore a version
55

66
Background:
77
Given that I am logged in as "testuser"
8-
And the "session_data.xml" fixtures are loaded
8+
And the "versionable.xml" fixtures are loaded
99

1010
Scenario: Restore node version
11-
Given there exists a node version "asd" for node "/tests_general_base"
12-
And I execute the "version:restore --version=asd" command
11+
Given I execute the following commands:
12+
| cd /tests_version_base/versioned |
13+
| node:set foo initalbar |
14+
| session:save |
15+
| version:checkpoint /tests_version_base/versioned |
16+
| node:set foo baz |
17+
| session:save |
18+
| version:checkpoint /tests_version_base/versioned |
19+
And I execute the "version:restore /tests_version_base/versioned 1.0" command
1320
Then the command should not fail
14-
And the version of "/tests_general_base" should be "asd"
15-
16-
Scenario: Restore node version by label
17-
Given there exists a node version "asd" for node "/tests_general_base"
18-
And I execute the "version:restore --label=asd" command
19-
Then the command should not fail
20-
And the version of "/tests_general_base" should be "asd"
21-
22-
Scenario: Restore multiple node versions
23-
Given there exists a node version "asd" for node "/tests_general_base"
24-
And I execute the "version:restore --version=asd --version=dsa" command
25-
Then the command should not fail
26-
And the version of "/tests_general_base" should be "asd"
21+
And I execute the "ls" command
22+
Then I should see the following:
23+
"""
24+
| foo | STRING | inital
25+
"""

features/workspace_namespace_register.feature

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,14 @@ Feature: Register a namespace on the workspace
55

66
Background:
77
Given that I am logged in as "testuser"
8-
And the "clean.xml" system view fixtures are loaded
98

10-
Scenario: List namespaces
11-
Given I execute the "workspace:namespace:register dcms http://foobar.com/ns" command
12-
Then the command should not fail
9+
# We cannot test namespace registration because jackrabbit does not support
10+
# namespace unregistration, so we simply try doing something which provokes
11+
# to throw an exception.
12+
Scenario: Attemp to register a default namespace
13+
Given I execute the "workspace:namespace:register foo http\://www.jcp.org/jcr/nt/1.0" command
14+
Then the command should fail
15+
And I should see the following:
16+
"""
17+
Can not change default namespace
18+
"""

features/workspace_namespace_unregister.feature

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,14 @@ Feature: Unregister a namespace on the workspace
55

66
Background:
77
Given that I am logged in as "testuser"
8-
And the "session_data.xml" fixtures are loaded
98

10-
Scenario: List namespaces
11-
Given the namespace "http://foobar.com/ns" with prefix "foo" exists
12-
And I execute the "workspace:namespace:unregister http://foobar.com/ns" command
9+
# We cannot test namespace registration because jackrabbit does not support
10+
# namespace unregistration, so we simply try doing something which provokes
11+
# to throw an exception.
12+
Scenario: Attemp to unregister a default namespace
13+
Given I execute the "workspace:namespace:unregister internal" command
1314
Then the command should fail
1415
And I should see the following:
1516
"""
16-
not supported by jackrabbit backend
17+
Unregistering namespace not supported by jackrabbit backend
1718
"""

features/workspace_node_clone.feature

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,20 @@ Feature: Clone a node from a given workspace to the current workspace
1010
And the current workspace is "default"
1111
And the "cms.xml" fixtures are loaded
1212

13-
# Scenario: Clone node
14-
# Given the current workspace is "default"
15-
# And I execute the "workspace:node:clone default_1 /cms/articles/article1 /cms/clone" command
16-
# Then the command should not fail
17-
# And I save the session
18-
# And there should exist a node at "/cms/clone"
13+
Scenario: Clone node
14+
Given the current workspace is "default"
15+
And I execute the "workspace:node:clone default_1 /cms/articles/article1 /cms/clone" command
16+
Then the command should not fail
17+
And I save the session
18+
And there should exist a node at "/cms/clone"
1919

2020
Scenario: Clone onto existing
2121
Given I execute the "workspace:node:clone default_1 /cms/articles/article1 /cms/articles" command
2222
Then the command should fail
23+
And I should see the following:
24+
"""
25+
Node already exists at destination
26+
"""
2327

2428
Scenario: Clone onto existing but remove
2529
Given I execute the "workspace:node:clone --remove-existing default_1 /cms/articles/article1 /cms/articles/article1" command

0 commit comments

Comments
 (0)