use Symfony\Component\HttpFoundation\RequestMatcher\IpsRequestMatcher;
class IpsRequestMatcherTest extends TestCase
{ /**
* @dataProvider getData
*/
public function test($ips, bool
$expected) { $matcher =
new IpsRequestMatcher($ips);
$request = Request::
create('', 'GET',
[],
[],
[],
['REMOTE_ADDR' => '127.0.0.1'
]);
$this->
assertSame($expected,
$matcher->
matches($request));
} public static function getData() { return [ [[], true
],
['127.0.0.1', true
],
['192.168.0.1', false
],
['127.0.0.1', true
],
['127.0.0.1, ::1', true
],
['192.168.0.1, ::1', false
],
[[