Skip to content

Commit

Permalink
Merge pull request #2 from shlinkio/feature/fix-select
Browse files Browse the repository at this point in the history
Fix select call with array instead of variadic args
  • Loading branch information
acelaya authored Feb 17, 2024
2 parents 1037b7d + ec0a77e commit ac1c4e0
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/Query/Select.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,6 @@ final class Select extends AbstractSelect
*/
protected function modifySelection(QueryBuilder $qb, array $selections): void
{
$qb->select($selections);
$qb->select(...$selections);
}
}
6 changes: 3 additions & 3 deletions tests/Query/SelectSpec.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,21 +42,21 @@ public function it_is_a_query_modifier(): void

public function it_select_single_filed(QueryBuilder $qb): void
{
$qb->select(['a.foo'])->shouldBeCalled()->willReturn($qb);
$qb->select('a.foo')->shouldBeCalled()->willReturn($qb);
$this->modify($qb, 'a');
}

public function it_select_several_fields(QueryBuilder $qb): void
{
$this->beConstructedWith('foo', 'bar');
$qb->select(['b.foo', 'b.bar'])->shouldBeCalled()->willReturn($qb);
$qb->select('b.foo', 'b.bar')->shouldBeCalled()->willReturn($qb);
$this->modify($qb, 'b');
}

public function it_select_operand(QueryBuilder $qb): void
{
$this->beConstructedWith('foo', new Field('bar'));
$qb->select(['b.foo', 'b.bar'])->shouldBeCalled()->willReturn($qb);
$qb->select('b.foo', 'b.bar')->shouldBeCalled()->willReturn($qb);
$this->modify($qb, 'b');
}
}

0 comments on commit ac1c4e0

Please sign in to comment.