diff --git a/.gitignore b/.gitignore index e69de29..fbb3d71 100644 --- a/.gitignore +++ b/.gitignore @@ -0,0 +1 @@ +test/report \ No newline at end of file diff --git a/DbOps.php b/DbOps.php index 3af5097..07eaf3b 100644 --- a/DbOps.php +++ b/DbOps.php @@ -80,19 +80,19 @@ private function prepareBinding($value, $type): array * @param bool $set * @param bool $prepared * - * @return mixed + * @return string * @throws DbException */ - protected function operandi($input, bool $set, bool $prepared) + protected function operandi($input, bool $set, bool $prepared): string { switch (gettype($input)){ case 'integer': - return $input; + return ' = ' . $input; case 'NULL': - return $this->setNull($input, $set); + return $this->setNull($set); } if (empty($input)) { - return $this->setNull($input, $set); + return $this->setNull($set); } $firstLetter = strtolower(substr($input, 0, 1)); switch ($firstLetter) { @@ -139,7 +139,7 @@ protected function operandi($input, bool $set, bool $prepared) break; default: if (strtolower($input) == 'null') { - $return = ($set ? ' = NULL' : ' IS NULL'); + $return = $this->setNull($set); } elseif ($prepared) { $return = preg_match('/%/', $input) ? ' LIKE ? ' : ' = ? '; $this->addExclusion($input); @@ -151,7 +151,7 @@ protected function operandi($input, bool $set, bool $prepared) return $return; } - protected function setNull($value, bool $set): string + protected function setNull(bool $set): string { return ($set ? ' = NULL' : ' IS NULL'); } diff --git a/phpunit.xml b/phpunit.xml new file mode 100644 index 0000000..2843eb4 --- /dev/null +++ b/phpunit.xml @@ -0,0 +1,36 @@ + + + + + ./ + + + ./test + ./vendor + ./.github + ./ + + + + + + + + + ./test + + + + + + + \ No newline at end of file