-
Notifications
You must be signed in to change notification settings - Fork 0
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 #10 from Clearfacts/CLEARFACTS-8478
[CLEARFACTS-8478] support int in param cleaning
- Loading branch information
Showing
5 changed files
with
81 additions
and
22 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
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,46 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Tests\Datalog\Processor; | ||
|
||
use Datalog\Processor\SessionRequestProcessor; | ||
use Symfony\Component\HttpFoundation\Session\SessionInterface; | ||
use Tests\Datalog\TestCase; | ||
|
||
class SessionRequestProcessorTest extends TestCase | ||
{ | ||
private SessionRequestProcessor $processor; | ||
|
||
public function setUp(): void | ||
{ | ||
$this->processor = new SessionRequestProcessor( | ||
$this->createMock(SessionInterface::class) | ||
); | ||
} | ||
|
||
public function testCleansParamKeys(): void | ||
{ | ||
$params = [ | ||
'foo' => 'bar', | ||
'test password test' => 'password', | ||
1 => 'one', | ||
'tester csrf_token tester' => 'csrf_token', | ||
'baz' => [ | ||
'qux' => 'quux', | ||
], | ||
'password' => 'password', | ||
'password test' => 'password', | ||
]; | ||
|
||
$cleanedParams = self::callPrivateMethod($this->processor, 'clean', $params); | ||
|
||
$this->assertSame([ | ||
'foo' => 'bar', | ||
1 => 'one', | ||
'baz' => [ | ||
'qux' => 'quux', | ||
], | ||
], $cleanedParams); | ||
} | ||
} |
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,17 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Tests\Datalog; | ||
|
||
class TestCase extends \PHPUnit\Framework\TestCase | ||
{ | ||
public static function callPrivateMethod(&$object, $methodName, ...$params) | ||
{ | ||
$reflectionObject = new \ReflectionObject($object); | ||
$method = $reflectionObject->getMethod($methodName); | ||
$method->setAccessible(true); | ||
|
||
return $method->invokeArgs($object, $params); | ||
} | ||
} |