diff --git a/tests/Database/DatabaseQueryBuilderTest.php b/tests/Database/DatabaseQueryBuilderTest.php index c6a3a7453bc..87c756657d1 100755 --- a/tests/Database/DatabaseQueryBuilderTest.php +++ b/tests/Database/DatabaseQueryBuilderTest.php @@ -3,7 +3,6 @@ namespace Illuminate\Tests\Database; use BadMethodCallException; -use Carbon\Month; use Closure; use DateTime; use Illuminate\Contracts\Database\Query\ConditionExpression; @@ -1405,11 +1404,6 @@ public function testWhereMonthBetween() $this->assertSame('select * from "users" where month("created_at") between ? and ?', $builder->toSql()); $this->assertEquals([0 => '01', 1 => '10'], $builder->getBindings()); - $builder = $this->getBuilder(); - $builder->select('*')->from('users')->whereMonthBetween('created_at', [Month::January, Month::October]); - $this->assertSame('select * from "users" where month("created_at") between ? and ?', $builder->toSql()); - $this->assertEquals([0 => '01', 1 => '10'], $builder->getBindings()); - $builder = $this->getBuilder(); $builder->select('*')->from('users')->whereMonthBetween('created_at', [['1'], ['10', '12']]); $this->assertSame('select * from "users" where month("created_at") between ? and ?', $builder->toSql()); @@ -1439,6 +1433,18 @@ public function testWhereMonthBetween() $this->assertEquals([0 => now()->format('m'), 1 => now()->format('m')], $builder->getBindings()); } + public function testWhereMonthBetweenAcceptsMonthEnum() + { + if (! class_exists(\Carbon\Month::class)) { + $this->markTestSkipped('Carbon 3.0 is not installed.'); + } + + $builder = $this->getBuilder(); + $builder->select('*')->from('users')->whereMonthBetween('created_at', [\Carbon\Month::January, \Carbon\Month::October]); + $this->assertSame('select * from "users" where month("created_at") between ? and ?', $builder->toSql()); + $this->assertEquals([0 => '01', 1 => '10'], $builder->getBindings()); + } + public function testWhereDayBetween() { $builder = $this->getBuilder(); diff --git a/tests/Integration/Database/QueryBuilderTest.php b/tests/Integration/Database/QueryBuilderTest.php index 05bf71615c2..0160f95556b 100644 --- a/tests/Integration/Database/QueryBuilderTest.php +++ b/tests/Integration/Database/QueryBuilderTest.php @@ -334,7 +334,7 @@ public function testWhereMonthBetween() $this->assertSame(1, DB::table('posts')->whereMonthBetween('created_at', [1, 3])->count()); } - public function testWhereMonthBetweenUsinCarbon() + public function testWhereMonthBetweenUsingCarbon() { if (! class_exists(\Carbon\Month::class)) { $this->markTestSkipped('Carbon 3.0 is not installed.');