Skip to content

Commit 5e5fdd2

Browse files
committed
Merge pull request #106 from phpcr/jcr-sync
Jcr sync
2 parents d7cf233 + 4e1a4c3 commit 5e5fdd2

File tree

3 files changed

+194
-56
lines changed

3 files changed

+194
-56
lines changed
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<sv:node
3+
xmlns:mix="http://www.jcp.org/jcr/mix/1.0"
4+
xmlns:nt="http://www.jcp.org/jcr/nt/1.0"
5+
xmlns:xs="http://www.w3.org/2001/XMLSchema"
6+
xmlns:jcr="http://www.jcp.org/jcr/1.0"
7+
xmlns:sv="http://www.jcp.org/jcr/sv/1.0"
8+
sv:name="tests_observation_manager">
9+
<sv:property sv:name="jcr:primaryType" sv:type="Name">
10+
<sv:value>nt:unstructured</sv:value>
11+
</sv:property>
12+
<sv:property sv:name="jcr:created" sv:type="Date">
13+
<sv:value>2013-04-27T13:00:54.082+02:00</sv:value>
14+
</sv:property>
15+
<sv:node sv:name="testGetUnfilteredEventJournal">
16+
<sv:property sv:name="jcr:primaryType" sv:type="Name">
17+
<sv:value>nt:unstructured</sv:value>
18+
</sv:property>
19+
</sv:node>
20+
<sv:node sv:name="testFilteredEventJournal">
21+
<sv:property sv:name="jcr:primaryType" sv:type="Name">
22+
<sv:value>nt:unstructured</sv:value>
23+
</sv:property>
24+
</sv:node>
25+
<sv:node sv:name="testFilteredEventJournalUuid">
26+
<sv:property sv:name="jcr:primaryType" sv:type="Name">
27+
<sv:value>nt:unstructured</sv:value>
28+
</sv:property>
29+
<sv:property sv:name="jcr:mixinTypes" sv:type="Name">
30+
<sv:value>mix:referenceable</sv:value>
31+
</sv:property>
32+
<sv:property sv:name="jcr:uuid" sv:type="String">
33+
<sv:value>842e61c0-09ab-42a9-4444-308ccc90e6f4</sv:value>
34+
</sv:property>
35+
</sv:node>
36+
<sv:node sv:name="testFilteredEventJournalNodeType">
37+
<sv:property sv:name="jcr:primaryType" sv:type="Name">
38+
<sv:value>nt:unstructured</sv:value>
39+
</sv:property>
40+
<sv:property sv:name="jcr:mixinTypes" sv:type="Name">
41+
<sv:value>mix:referenceable</sv:value>
42+
</sv:property>
43+
<sv:property sv:name="jcr:uuid" sv:type="String">
44+
<sv:value>842e61c0-09ab-42a9-3333-308ccc90e6f4</sv:value>
45+
</sv:property>
46+
</sv:node>
47+
<sv:node sv:name="testUserData">
48+
<sv:property sv:name="jcr:primaryType" sv:type="Name">
49+
<sv:value>nt:unstructured</sv:value>
50+
</sv:property>
51+
</sv:node>
52+
</sv:node>

tests/05_Reading/NodeReadMethodsTest.php

Lines changed: 36 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -149,9 +149,15 @@ public function testGetNodeRepositoryException()
149149

150150
public function testGetNodes()
151151
{
152-
$node1 = $this->rootNode->getNode('tests_general_base');
153-
$iterator = $this->rootNode->getNodes();
152+
$parent = $this->rootNode->getNode('tests_general_base');
153+
$iterator = $parent->getNodes();
154154
$this->assertInstanceOf('Iterator', $iterator);
155+
$this->assertInstanceOf('Countable', $iterator);
156+
157+
$this->assertCount(8, $iterator);
158+
foreach($iterator as $node) {
159+
$this->assertInstanceOf('PHPCR\NodeInterface', $node);
160+
}
155161
}
156162

157163
/**
@@ -175,19 +181,44 @@ public function testGetNodesPattern()
175181
$this->assertNotContains('index.txt', $nodes);
176182
}
177183

178-
public function testGetNodesPatternAdvanced()
184+
public function testGetNodesTypeFilter()
179185
{
180186
$this->node = $this->rootNode->getNode('tests_general_base');
181-
$iterator = $this->node->getNodes("test:* | idExample");
187+
$iterator = $this->node->getNodes(null, 'nt:file');
182188
$nodes = array();
183189
foreach ($iterator as $n) {
184190
$this->assertInstanceOf('PHPCR\NodeInterface', $n);
185191
/** @var $n \PHPCR\NodeInterface */
186192
array_push($nodes, $n->getName());
187193
}
194+
$this->assertContains('index.txt', $nodes);
188195
$this->assertContains('idExample', $nodes);
189-
$this->assertContains('test:namespacedNode', $nodes);
196+
$this->assertNotContains('test:namespacedNode', $nodes);
197+
$this->assertNotContains('emptyExample', $nodes);
198+
$this->assertNotContains('multiValueProperty', $nodes);
199+
$this->assertContains('numberPropertyNode', $nodes);
200+
$this->assertContains('NumberPropertyNodeToCompare1', $nodes);
201+
$this->assertContains('NumberPropertyNodeToCompare2', $nodes);
202+
}
203+
204+
public function testGetNodesTypeFilterList()
205+
{
206+
$this->node = $this->rootNode->getNode('tests_general_base');
207+
$iterator = $this->node->getNodes("id*", array('nt:file', 'nt:folder'));
208+
$nodes = array();
209+
foreach ($iterator as $n) {
210+
$this->assertInstanceOf('PHPCR\NodeInterface', $n);
211+
/** @var $n \PHPCR\NodeInterface */
212+
array_push($nodes, $n->getName());
213+
}
190214
$this->assertNotContains('index.txt', $nodes);
215+
$this->assertContains('idExample', $nodes);
216+
$this->assertNotContains('test:namespacedNode', $nodes);
217+
$this->assertNotContains('emptyExample', $nodes);
218+
$this->assertNotContains('multiValueProperty', $nodes);
219+
$this->assertNotContains('numberPropertyNode', $nodes);
220+
$this->assertNotContains('NumberPropertyNodeToCompare1', $nodes);
221+
$this->assertNotContains('NumberPropertyNodeToCompare2', $nodes);
191222
}
192223

193224
public function testGetNodesNameGlobs()

0 commit comments

Comments
 (0)