-
-
Notifications
You must be signed in to change notification settings - Fork 241
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* 8.x: Bump v8.2.1 🚀 Add model insert tests. Add test for single insert. Fix binding values. Add failing tests for #558. Bump v8.2.0 🚀 Fix cs. Fix pagination tests. Enhance pagination as suggested on #563. Fix docs. Bump v8.1.3 🚀 Apply fixes from StyleCI Compare using actual db count. Use lower column name on column listing. Fix test suffix. Add failing tests for #596.
- Loading branch information
Showing
10 changed files
with
217 additions
and
29 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
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,65 @@ | ||
<?php | ||
|
||
namespace Yajra\Oci8\Tests\Functional; | ||
|
||
use Yajra\Oci8\Tests\User; | ||
use Yajra\Oci8\Tests\TestCase; | ||
use Yajra\Oci8\Tests\UserWithGuardedProperty; | ||
use Illuminate\Foundation\Testing\DatabaseTransactions; | ||
|
||
class ModelTest extends TestCase | ||
{ | ||
use DatabaseTransactions; | ||
|
||
/** @test */ | ||
public function it_can_fill_a_model_to_create_a_record() | ||
{ | ||
$attributes = [ | ||
'name' => 'John', | ||
'email' => 'john@example.com', | ||
]; | ||
|
||
$model = new User; | ||
$model->fill($attributes); | ||
$model->save(); | ||
|
||
$this->assertDatabaseHas('users', $attributes); | ||
} | ||
|
||
/** @test */ | ||
public function it_can_insert_record_using_a_model() | ||
{ | ||
User::query()->insert($attributes = [ | ||
'name' => 'John', | ||
'email' => 'john@example.com', | ||
]); | ||
|
||
$this->assertDatabaseHas('users', $attributes); | ||
} | ||
|
||
/** @test */ | ||
public function it_can_create_guarded_model_by_setting_the_property() | ||
{ | ||
$count = UserWithGuardedProperty::count(); | ||
|
||
$user = new UserWithGuardedProperty; | ||
$user->name = 'Test'; | ||
$user->email = 'test@example.com'; | ||
$user->save(); | ||
|
||
$this->assertDatabaseCount('users', $count + 1); | ||
} | ||
|
||
/** @test */ | ||
public function it_can_create_guarded_model_using_create_method() | ||
{ | ||
$count = UserWithGuardedProperty::count(); | ||
|
||
UserWithGuardedProperty::create([ | ||
'name' => 'Test', | ||
'email' => 'test@example.com', | ||
]); | ||
|
||
$this->assertDatabaseCount('users', $count + 1); | ||
} | ||
} |
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,37 @@ | ||
<?php | ||
|
||
namespace Yajra\Oci8\Tests\Functional; | ||
|
||
use Yajra\Oci8\Tests\TestCase; | ||
use Illuminate\Foundation\Testing\DatabaseTransactions; | ||
|
||
class QueryBuilderTest extends TestCase | ||
{ | ||
use DatabaseTransactions; | ||
|
||
/** @test */ | ||
public function it_can_perform_insert() | ||
{ | ||
$data = ['name' => 'Foo', 'job_id' => null]; | ||
|
||
$this->getConnection()->table('jobs')->insert($data); | ||
|
||
$this->assertDatabaseCount('jobs', 1); | ||
} | ||
|
||
/** @test */ | ||
public function it_can_perform_bulk_inserts() | ||
{ | ||
$data = [ | ||
['name' => 'Foo', 'job_id' => null], | ||
['name' => 'Bar', 'job_id' => 1], | ||
['name' => 'Test', 'job_id' => 2], | ||
['name' => null, 'job_id' => 4], | ||
['name' => null, 'job_id' => null], | ||
]; | ||
|
||
$this->getConnection()->table('jobs')->insert($data); | ||
|
||
$this->assertDatabaseCount('jobs', 5); | ||
} | ||
} |
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,10 @@ | ||
<?php | ||
|
||
namespace Yajra\Oci8\Tests; | ||
|
||
class UserWithGuardedProperty extends User | ||
{ | ||
protected $table = 'users'; | ||
|
||
protected $guarded = ['id']; | ||
} |