You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Given I execute the "UPDATE [nt:unstructured] AS a SET a.tags = 'Rockets' WHERE a.tags = 'Trains'" command
27
+
Scenario: Replace a multivalue index by value
28
+
Given I execute the "UPDATE [nt:unstructured] AS a SET a.tags = array_replace(a.tags, 'Trains', 'Rockets') WHERE a.tags = 'Trains'" command
29
+
Then the command should not fail
30
+
And I save the session
31
+
Then the command should not fail
32
+
And the node at "/cms/articles/article1" should have the property "tags" with value "Rockets" at index "1"
33
+
34
+
Scenario: Set a multivalue value
35
+
Given I execute the "UPDATE [nt:unstructured] AS a SET a.tags = array('Rockets', 'Dragons') WHERE a.tags = 'Trains'" command
36
+
And I save the session
37
+
Then the command should not fail
38
+
And the node at "/cms/articles/article1" should have the property "tags" with value "Rockets" at index "0"
39
+
And the node at "/cms/articles/article1" should have the property "tags" with value "Dragons" at index "1"
40
+
41
+
Scenario: Update single multivalue without selector
42
+
Given I execute the "UPDATE [nt:unstructured] SET tags = array_replace(tags, 'Planes', 'Rockets') WHERE tags = 'Planes'" command
29
43
And I save the session
30
44
Then the command should not fail
31
45
And I should see the following:
32
46
"""
33
-
Cannot update property "tags". Updating multi-value nodes with more than one element not currently supported
47
+
1 row(s) affected
34
48
"""
49
+
And the node at "/cms/articles/article1" should have the property "tags" with value "Rockets" at index "0"
50
+
And the node at "/cms/articles/article1" should have the property "tags" with value "Automobiles" at index "2"
35
51
36
-
Scenario:Update single multivalue
37
-
Given I execute the "UPDATE [nt:unstructured] AS a SET a.tag = 'Rockets' WHERE a.tags = 'Planes'" command
52
+
Scenario:Remove single multivalue
53
+
Given I execute the "UPDATE [nt:unstructured] AS a SET a.tags = array_remove(a.tags, 'Planes') WHERE a.tags = 'Planes'" command
38
54
And I save the session
39
55
Then the command should not fail
40
56
And I should see the following:
41
57
"""
42
58
2 row(s) affected
43
59
"""
44
-
And the node at "/cms/articles/article1" should have the property "tag" with value "Rockets" at index "0"
60
+
And the node at "/cms/articles/article1" should have the property "tags" with value "Trains" at index "0"
61
+
And the node at "/cms/articles/article1" should have the property "tags" with value "Automobiles" at index "1"
62
+
63
+
Scenario: Remove single multivalue by index
64
+
Given I execute the "UPDATE [nt:unstructured] AS a SET a.tags = array_set(a.tags, 0, NULL) WHERE a.tags = 'Planes'" command
65
+
And I save the session
66
+
Then the command should not fail
67
+
And I should see the following:
68
+
"""
69
+
1 row(s) affected
70
+
"""
71
+
And the node at "/cms/articles/article1" should have the property "tags" with value "Trains" at index "0"
72
+
And the node at "/cms/articles/article1" should have the property "tags" with value "Automobiles" at index "1"
73
+
74
+
Scenario: Add a multivalue property
75
+
Given I execute the "UPDATE [nt:unstructured] AS a SET a.tags = array_append(a.tags, 'Kite') WHERE a.tags = 'Planes'" command
76
+
And I save the session
77
+
Then the command should not fail
78
+
And I should see the following:
79
+
"""
80
+
1 row(s) affected
81
+
"""
82
+
And the node at "/cms/articles/article1" should have the property "tags" with value "Planes" at index "0"
83
+
And the node at "/cms/articles/article1" should have the property "tags" with value "Automobiles" at index "2"
84
+
And the node at "/cms/articles/article1" should have the property "tags" with value "Kite" at index "3"
85
+
86
+
Scenario: Replace a multivalue property by index
87
+
Given I execute the "UPDATE [nt:unstructured] AS a SET a.tags = array_set(a.tags, 1, 'Kite'), a.tags = array_set(a.tags, 2, 'foobar') WHERE a.tags = 'Planes'" command
88
+
And I save the session
89
+
Then the command should not fail
90
+
And I should see the following:
91
+
"""
92
+
1 row(s) affected
93
+
"""
94
+
And the node at "/cms/articles/article1" should have the property "tags" with value "Planes" at index "0"
95
+
And the node at "/cms/articles/article1" should have the property "tags" with value "Kite" at index "1"
96
+
And the node at "/cms/articles/article1" should have the property "tags" with value "foobar" at index "2"
97
+
98
+
Scenario: Replace a multivalue property by invalid index
99
+
Given I execute the "UPDATE [nt:unstructured] AS a SET a.tags = array_set(a.tags, 10, 'Kite') WHERE a.tags = 'Planes'" command
100
+
Then the command should fail
101
+
And I should see the following:
102
+
"""
103
+
Multivalue index "10" does not exist
104
+
"""
105
+
106
+
Scenario: Attempt to update a numerically named property (must use a selector)
107
+
Given I execute the "UPDATE [nt:unstructured] AS a SET a.tags = array_set(a.tags, a.10, 'Kite') WHERE a.tags = 'Planes'" command
108
+
Then the command should fail
109
+
And I should see the following:
110
+
"""
111
+
[PHPCR\PathNotFoundException] Property 10
112
+
"""
113
+
114
+
Scenario: Replace a multivalue property by invalid index with array (invalid)
115
+
Given I execute the "UPDATE [nt:unstructured] AS a SET a.tags = array_set(a.tags, 0, array('Kite')) WHERE a.tags = 'Planes'" command
116
+
Then the command should fail
117
+
And I should see the following:
118
+
"""
119
+
Cannot use an array as a value in a multivalue property
0 commit comments