Skip to content

Commit 42227c6

Browse files
committed
SqlBuilder::addAlias: Fixed tests
1 parent 1329476 commit 42227c6

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

tests/Database/Table/SqlBuilder.addAlias().phpt

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,8 @@ $driver = $connection->getSupplementalDriver();
2929

3030

3131
test(function() use ($context, $driver) { // test duplicated table names throw exception
32-
if ($driver->isSupported(ISupplementalDriver::SUPPORT_SCHEMA)) {
33-
$sqlBuilder = new SqlBuilderMock('public.author', $context);
34-
} else {
35-
$sqlBuilder = new SqlBuilderMock('author', $context);
36-
}
32+
$authorTable = ($driver->isSupported(ISupplementalDriver::SUPPORT_SCHEMA) ? 'public.' : '' ) . 'author';
33+
$sqlBuilder = new SqlBuilderMock($authorTable, $context);
3734
$sqlBuilder->addAlias(':book(translator)', 'book1');
3835
$sqlBuilder->addAlias(':book:book_tag', 'book2');
3936
Assert::exception(function() use ($sqlBuilder) {
@@ -42,7 +39,7 @@ test(function() use ($context, $driver) { // test duplicated table names throw e
4239

4340
Assert::exception(function() use ($sqlBuilder) { // reserved by base table name
4441
$sqlBuilder->addAlias(':book', 'author');
45-
}, Nette\InvalidArgumentException::class, "Table alias 'author' from chain ':book' is already in use by chain 'author'. Please add/change alias for one of them.");
42+
}, Nette\InvalidArgumentException::class, "Table alias 'author' from chain ':book' is already in use by chain '$authorTable'. Please add/change alias for one of them.");
4643

4744
Assert::exception(function() use ($sqlBuilder) {
4845
$sqlBuilder->addAlias(':book', 'book1');

0 commit comments

Comments
 (0)