-
Notifications
You must be signed in to change notification settings - Fork 11.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[5.6] Allow integer values for whereYear() in SQLite (#24115)
* Allow integer values for whereYear() in SQLite * Fix style
- Loading branch information
1 parent
951d42f
commit a37aa1c
Showing
3 changed files
with
62 additions
and
8 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,54 @@ | ||
<?php | ||
|
||
namespace Illuminate\Tests\Integration\Database\EloquentBelongsToManyTest; | ||
|
||
use Illuminate\Support\Carbon; | ||
use Illuminate\Support\Facades\DB; | ||
use Illuminate\Support\Facades\Schema; | ||
use Illuminate\Tests\Integration\Database\DatabaseTestCase; | ||
|
||
/** | ||
* @group integration | ||
*/ | ||
class QueryBuilderTest extends DatabaseTestCase | ||
{ | ||
public function setUp() | ||
{ | ||
parent::setUp(); | ||
|
||
Schema::create('posts', function ($table) { | ||
$table->timestamp('created_at'); | ||
}); | ||
|
||
DB::table('posts')->insert([ | ||
['created_at' => new Carbon('2017-11-12 13:14:15')], | ||
['created_at' => new Carbon('2018-01-02 03:04:05')], | ||
]); | ||
} | ||
|
||
public function testWhereDate() | ||
{ | ||
$this->assertSame(1, DB::table('posts')->whereDate('created_at', '2018-01-02')->count()); | ||
} | ||
|
||
public function testWhereDay() | ||
{ | ||
$this->assertSame(1, DB::table('posts')->whereDay('created_at', '02')->count()); | ||
} | ||
|
||
public function testWhereMonth() | ||
{ | ||
$this->assertSame(1, DB::table('posts')->whereMonth('created_at', '01')->count()); | ||
} | ||
|
||
public function testWhereYear() | ||
{ | ||
$this->assertSame(1, DB::table('posts')->whereYear('created_at', '2018')->count()); | ||
$this->assertSame(1, DB::table('posts')->whereYear('created_at', 2018)->count()); | ||
} | ||
|
||
public function testWhereTime() | ||
{ | ||
$this->assertSame(1, DB::table('posts')->whereTime('created_at', '03:04:05')->count()); | ||
} | ||
} |