Skip to content

Commit 1ef57cf

Browse files
committed
Bug fix for unused Node::all columns argument & unit test
Fix from here: etrepat#181
1 parent 07f24dc commit 1ef57cf

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

src/Baum/Node.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -364,7 +364,7 @@ public static function all($columns = array('*')) {
364364

365365
return $instance->newQuery()
366366
->orderBy($instance->getQualifiedOrderColumnName())
367-
->get();
367+
->get($columns);
368368
}
369369

370370
/**

tests/suite/Category/CategoryHierarchyTest.php

+7
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,13 @@ public function testAllStatic() {
99
$this->assertEquals($results, $expected);
1010
}
1111

12+
public function testAllStaticSomeColumns() {
13+
$results = Category::all(['id','name'])->toArray();
14+
$expected = Category::query()->select(['id', 'name'])->orderBy('lft')->get()->toArray();
15+
16+
$this->assertEquals($results, $expected);
17+
}
18+
1219
public function testAllStaticWithCustomOrder() {
1320
$results = OrderedCategory::all();
1421
$expected = OrderedCategory::query()->orderBy('name')->get();

0 commit comments

Comments
 (0)