Skip to content

Commit 36b7963

Browse files
committed
Fixed node count
1 parent e3dee4f commit 36b7963

File tree

3 files changed

+12
-2
lines changed

3 files changed

+12
-2
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ dev-master
1313

1414
- [embedded] No exit code returned
1515
- [profile] Profile configuration overwritten by session parameters
16+
- [node:list] Incorrect node count
1617

1718
beta1
1819
-----

features/all/phpcr_node_list.feature

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,3 +135,11 @@ Feature: List properites and chidren of current nodeA
135135
| numberPropertyNode/ | nt:file | +jcr:content |
136136
+---------------------+---------+--------------+
137137
"""
138+
139+
Scenario: Correct node count
140+
Given I execute the "node:list /tests_general_base/*/jcr:content" command
141+
Then the command should not fail
142+
And I should see the following:
143+
"""
144+
5 nodes in set
145+
"""

src/PHPCR/Shell/Console/Command/Phpcr/NodeListCommand.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ public function execute(InputInterface $input, OutputInterface $output)
100100
$this->renderNode($node, $table, array(), $filter);
101101

102102
if ($table->getNumberOfRows() > 0) {
103+
$this->nbNodes++;
103104
$output->writeln(sprintf('<path>%s</path> [%s] > %s',
104105
$node->getPath(),
105106
$node->getPrimaryNodeType()->getName(),
@@ -120,7 +121,6 @@ public function execute(InputInterface $input, OutputInterface $output)
120121

121122
private function renderNode($currentNode, $table, $spacers = array(), $filter = null)
122123
{
123-
$this->nbNodes++;
124124
if ($this->showChildren) {
125125
$this->renderChildren($currentNode, $table, $spacers, $filter);
126126
}
@@ -173,11 +173,12 @@ private function renderChildren($currentNode, $table, $spacers, $filter = null)
173173
if (count($spacers) < $this->maxLevel) {
174174
$newSpacers = $spacers;
175175
if ($isLast) {
176-
$newSpacers[] = ' ';
176+
$newSpacers[] = ': ';
177177
} else {
178178
$newSpacers[] = '| ';
179179
}
180180

181+
$this->nbNodes++;
181182
$this->renderNode($child, $table, $newSpacers);
182183
}
183184
}

0 commit comments

Comments
 (0)