-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #66 from singlestore-labs/ISSUE-61
Added possibility to set query options
- Loading branch information
Showing
3 changed files
with
91 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
<?php | ||
|
||
namespace SingleStore\Laravel\Tests\Hybrid; | ||
|
||
use Illuminate\Support\Facades\DB; | ||
use SingleStore\Laravel\Schema\Blueprint; | ||
use SingleStore\Laravel\Tests\BaseTest; | ||
|
||
class OptionTest extends BaseTest | ||
{ | ||
use HybridTestHelpers; | ||
|
||
protected function setUp(): void | ||
{ | ||
parent::setUp(); | ||
|
||
if ($this->runHybridIntegrations()) { | ||
$this->createTable(function (Blueprint $table) { | ||
$table->id(); | ||
}); | ||
} | ||
} | ||
|
||
/** @test */ | ||
public function singleOption() | ||
{ | ||
$query = DB::table('test')->options(['interpreter_mode' => 'compile']); | ||
echo get_class($query); | ||
$this->assertEquals('select * from `test` OPTION (interpreter_mode=compile)', $query->toSql()); | ||
|
||
if ($this->runHybridIntegrations()) { | ||
$query->get(); | ||
} | ||
} | ||
|
||
/** @test */ | ||
public function emptyOption() | ||
{ | ||
$query = DB::table('test')->options([]); | ||
echo get_class($query); | ||
$this->assertEquals('select * from `test`', $query->toSql()); | ||
|
||
if ($this->runHybridIntegrations()) { | ||
$query->get(); | ||
} | ||
} | ||
|
||
/** @test */ | ||
public function multiOption() | ||
{ | ||
$query = DB::table('test')->options(['interpreter_mode' => 'compile', 'resource_pool' => 'default_pool']); | ||
echo get_class($query); | ||
$this->assertEquals('select * from `test` OPTION (interpreter_mode=compile,resource_pool=default_pool)', $query->toSql()); | ||
|
||
if ($this->runHybridIntegrations()) { | ||
$query->get(); | ||
} | ||
} | ||
} |