Skip to content

Commit

Permalink
fix conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
taylorotwell committed Aug 27, 2020
2 parents aa4e269 + cd1ab41 commit fad3e5f
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/Illuminate/Database/Eloquent/Builder.php
Expand Up @@ -193,7 +193,7 @@ public function whereKey($id)
return $this;
}

if ($this->model->getKeyType() === 'string') {
if ($id !== null && $this->model->getKeyType() === 'string') {
$id = (string) $id;
}

Expand All @@ -214,7 +214,7 @@ public function whereKeyNot($id)
return $this;
}

if ($this->model->getKeyType() === 'string') {
if ($id !== null && $this->model->getKeyType() === 'string') {
$id = (string) $id;
}

Expand Down
2 changes: 1 addition & 1 deletion src/Illuminate/Foundation/Application.php
Expand Up @@ -33,7 +33,7 @@ class Application extends Container implements ApplicationContract, CachesConfig
*
* @var string
*/
const VERSION = '7.26.0';
const VERSION = '7.26.1';

/**
* The base path for the Laravel installation.
Expand Down
26 changes: 26 additions & 0 deletions tests/Database/DatabaseEloquentBuilderTest.php
Expand Up @@ -1063,6 +1063,19 @@ public function testWhereKeyMethodWithStringZero()
$builder->whereKey($int);
}

public function testWhereKeyMethodWithStringNull()
{
$model = new EloquentBuilderTestStubStringPrimaryKey();
$builder = $this->getBuilder()->setModel($model);
$keyName = $model->getQualifiedKeyName();

$builder->getQuery()->shouldReceive('where')->once()->with($keyName, '=', m::on(function ($argument) {
return $argument === null;
}));

$builder->whereKey(null);
}

public function testWhereKeyMethodWithArray()
{
$model = $this->getMockModel();
Expand Down Expand Up @@ -1102,6 +1115,19 @@ public function testWhereKeyNotMethodWithStringZero()
$builder->whereKeyNot($int);
}

public function testWhereKeyNotMethodWithStringNull()
{
$model = new EloquentBuilderTestStubStringPrimaryKey();
$builder = $this->getBuilder()->setModel($model);
$keyName = $model->getQualifiedKeyName();

$builder->getQuery()->shouldReceive('where')->once()->with($keyName, '!=', m::on(function ($argument) {
return $argument === null;
}));

$builder->whereKeyNot(null);
}

public function testWhereKeyNotMethodWithInt()
{
$model = $this->getMockModel();
Expand Down

0 comments on commit fad3e5f

Please sign in to comment.