-
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #95 from codelicia/infection
fix(infection): errors
- Loading branch information
Showing
12 changed files
with
211 additions
and
59 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
vendor/ | ||
composer.lock | ||
cov/ | ||
.phpcs-cache | ||
.phpunit.result.cache | ||
.phpunit.cache/ |
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
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,65 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace CodeliciaTest\Soql; | ||
|
||
use Codelicia\Soql\BoundValuesSeparator; | ||
use PHPUnit\Framework\Attributes\Test; | ||
use PHPUnit\Framework\TestCase; | ||
|
||
final class BoundValuesSeparatorTest extends TestCase | ||
{ | ||
#[Test] | ||
public function separate_bound_values(): void | ||
{ | ||
$boundValues = [ | ||
'name' => 'John', | ||
'age' => 30, | ||
'hobbies' => ['reading', 'swimming'], | ||
'description' => null, | ||
]; | ||
|
||
$expected = [ | ||
':name' => "'John'", | ||
':age' => 30, | ||
':hobbies' => "'reading', 'swimming'", | ||
':description' => null, | ||
]; | ||
|
||
$result = BoundValuesSeparator::separateBoundValues($boundValues); | ||
|
||
self::assertSame($expected, $result); | ||
} | ||
|
||
#[Test] | ||
public function with_objects(): void | ||
{ | ||
$boundValues = [ | ||
'name' => new class () { | ||
public function __toString(): string | ||
{ | ||
return 'John'; | ||
} | ||
}, | ||
]; | ||
|
||
$expected = [':name' => "'John'"]; | ||
|
||
$result = BoundValuesSeparator::separateBoundValues($boundValues); | ||
|
||
self::assertSame($expected, $result); | ||
} | ||
|
||
#[Test] | ||
public function with_missing_type(): void | ||
{ | ||
$boundValues = ['name' => 'John']; | ||
|
||
$expected = [':name' => "'John'"]; | ||
|
||
$result = BoundValuesSeparator::separateBoundValues($boundValues); | ||
|
||
self::assertSame($expected, $result); | ||
} | ||
} |
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
Oops, something went wrong.