Skip to content

Commit

Permalink
add test
Browse files Browse the repository at this point in the history
  • Loading branch information
taka-oyama committed Sep 3, 2024
1 parent 823d436 commit 15e027d
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions tests/Query/BuilderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,14 @@
use Colopl\Spanner\Schema\Blueprint;
use Colopl\Spanner\Tests\TestCase;
use Colopl\Spanner\TimestampBound\ExactStaleness;
use Google\Cloud\Core\Exception\BadRequestException;
use Google\Cloud\Spanner\Bytes;
use Google\Cloud\Spanner\Duration;
use Illuminate\Database\QueryException;
use Illuminate\Support\Carbon;
use LogicException;

use Ramsey\Uuid\Uuid;
use const Grpc\STATUS_ALREADY_EXISTS;

class BuilderTest extends TestCase
Expand Down Expand Up @@ -1083,4 +1085,22 @@ public function test_setRequestTimeoutSeconds(): void
$this->expectExceptionMessageMatches('/DEADLINE_EXCEEDED/');
$query->get();
}

public function test_whereIn_with_unnest_overflow_flag_turned_on(): void
{
$query = $this->getDefaultConnection()->table(self::TABLE_NAME_USER);
$query->whereIn('userId', array_map(Uuid::uuid4()->toString(...), range(1, 1000)));
$this->assertSame([], $query->get());
}


public function test_whereIn_with_unnest_overflow_flag_turned_off(): void
{
$this->expectExceptionMessage('Number of parameters in query exceeds the maximum allowed limit of 950.');
$this->expectException(QueryException::class);

config()->set('database.connections.main.use_unnest_on_parameter_overflow', false);
$query = $this->getDefaultConnection()->table(self::TABLE_NAME_USER);
$query->whereIn('userId', array_map(Uuid::uuid4()->toString(...), range(1, 1000)))->get();
}
}

0 comments on commit 15e027d

Please sign in to comment.