Skip to content

Commit

Permalink
Added tests
Browse files Browse the repository at this point in the history
  • Loading branch information
george-meredith committed Jul 30, 2024
1 parent d214bf5 commit 42b90ba
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions tests/Database/DatabaseQueryBuilderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,13 @@ public function testAliasWrappingAsWholeConstant()
$this->assertSame('select "x"."y" as "foo.bar" from "baz"', $builder->toSql());
}

public function testAliasInArrayKey()
{
$builder = $this->getBuilder();
$builder->select(['foo.bar' => 'x.y'])->from('baz');
$this->assertSame('select "x"."y" as "foo.bar" from "baz"', $builder->toSql());
}

public function testAliasWrappingWithSpacesInDatabaseName()
{
$builder = $this->getBuilder();
Expand All @@ -117,6 +124,13 @@ public function testAddingSelects()
$this->assertSame('select "foo", "bar", "baz", "boom" from "users"', $builder->toSql());
}

public function testAddingSelectsWithAlias()
{
$builder = $this->getBuilder();
$builder->select('foo')->addSelect(['baz' => 'bar'])->addSelect(['bust' => 'boom'])->from('users');
$this->assertSame('select "foo", "bar" as "baz", "boom" as "bust" from "users"', $builder->toSql());
}

public function testBasicSelectWithPrefix()
{
$builder = $this->getBuilder();
Expand Down

0 comments on commit 42b90ba

Please sign in to comment.