Skip to content

Commit

Permalink
Merge pull request #113 from makeey/master
Browse files Browse the repository at this point in the history
Do not filter values in AbstractCreationalQuery
  • Loading branch information
nilportugues authored Apr 7, 2020
2 parents 8991871 + c81d63d commit b00877e
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 6 deletions.
7 changes: 1 addition & 6 deletions src/Manipulation/AbstractCreationalQuery.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,7 @@ public function getValues()
*/
public function setValues(array $values)
{
$this->values = \array_filter($values, function($value) {
if (is_int($value)) {
return true;
}
return $value;
});
$this->values = $values;

return $this;
}
Expand Down
12 changes: 12 additions & 0 deletions tests/Manipulation/InsertTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,4 +62,16 @@ public function itShouldGetColumns()

$this->assertInstanceOf('NilPortugues\Sql\QueryBuilder\Syntax\Column', $columns[0]);
}

/**
* @test
*/
public function itShouldSetNullableValues()
{
$values = ['user_id' => 1, 'description' => null, 'isVisible' => false];

$this->query->setValues($values);

$this->assertSame($values, $this->query->getValues());
}
}
12 changes: 12 additions & 0 deletions tests/Manipulation/UpdateTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,4 +58,16 @@ public function itShouldReturnValues()

$this->assertSame($values, $this->query->getValues());
}

/**
* @test
*/
public function itShouldSetNullableValues()
{
$values = ['user_id' => 1, 'description' => null, 'isVisible' => false];

$this->query->setValues($values);

$this->assertSame($values, $this->query->getValues());
}
}

0 comments on commit b00877e

Please sign in to comment.