mirror of
https://github.com/Respect/Validation.git
synced 2024-04-30 13:42:48 +02:00
cc3bf86b2f
Doing regex on phone numbers is not a great idea. This is a breaking change, but a good one. Phone validation is now much stricter, and allows choosing the country.
62 lines
1.2 KiB
PHP
62 lines
1.2 KiB
PHP
<?php
|
|
|
|
/*
|
|
* Copyright (c) Alexandre Gomes Gaigalas <alganet@gmail.com>
|
|
* SPDX-License-Identifier: MIT
|
|
*/
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace Respect\Validation\Rules;
|
|
|
|
use Respect\Validation\Test\RuleTestCase;
|
|
use stdClass;
|
|
|
|
use function stream_context_create;
|
|
use function tmpfile;
|
|
|
|
/**
|
|
* @group rule
|
|
*
|
|
* @covers \Respect\Validation\Rules\ResourceType
|
|
*
|
|
* @author Gabriel Caruso <carusogabriel34@gmail.com>
|
|
* @author Henrique Moody <henriquemoody@gmail.com>
|
|
*/
|
|
final class ResourceTypeTest extends RuleTestCase
|
|
{
|
|
/**
|
|
* {@inheritDoc}
|
|
*/
|
|
public function providerForValidInput(): array
|
|
{
|
|
$rule = new ResourceType();
|
|
|
|
return [
|
|
[$rule, stream_context_create()],
|
|
[$rule, tmpfile()],
|
|
];
|
|
}
|
|
|
|
/**
|
|
* {@inheritDoc}
|
|
*/
|
|
public function providerForInvalidInput(): array
|
|
{
|
|
$rule = new ResourceType();
|
|
|
|
return [
|
|
[$rule, 'String'],
|
|
[$rule, 123],
|
|
[$rule, []],
|
|
[
|
|
$rule,
|
|
static function (): void {
|
|
},
|
|
],
|
|
[$rule, new stdClass()],
|
|
[$rule, null],
|
|
];
|
|
}
|
|
}
|