2018-06-23 16:24:48 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
/*
|
2023-02-17 05:13:51 +01:00
|
|
|
* Copyright (c) Alexandre Gomes Gaigalas <alganet@gmail.com>
|
|
|
|
* SPDX-License-Identifier: MIT
|
2018-06-23 16:24:48 +02:00
|
|
|
*/
|
|
|
|
|
|
|
|
declare(strict_types=1);
|
|
|
|
|
|
|
|
namespace Respect\Validation\Rules;
|
|
|
|
|
|
|
|
use ArrayObject;
|
|
|
|
use Respect\Validation\Test\RuleTestCase;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @group rule
|
|
|
|
*
|
|
|
|
* @covers \Respect\Validation\Rules\Equivalent
|
|
|
|
*
|
|
|
|
* @author Henrique Moody <henriquemoody@gmail.com>
|
|
|
|
*/
|
|
|
|
final class EquivalentTest extends RuleTestCase
|
|
|
|
{
|
|
|
|
/**
|
2019-04-05 14:33:00 +02:00
|
|
|
* {@inheritDoc}
|
2018-06-23 16:24:48 +02:00
|
|
|
*/
|
2023-04-02 16:00:37 +02:00
|
|
|
public static function providerForValidInput(): array
|
2018-06-23 16:24:48 +02:00
|
|
|
{
|
|
|
|
return [
|
|
|
|
[new Equivalent(1), true],
|
|
|
|
[new Equivalent('Something'), 'something'],
|
|
|
|
[new Equivalent([1, 2, 3]), [1, 2, 3]],
|
|
|
|
[new Equivalent((object) ['foo' => 'bar']), (object) ['foo' => 'bar']],
|
|
|
|
[new Equivalent(new ArrayObject([1, 2, 3, 4, 5])), new ArrayObject([1, 2, 3, 4, 5])],
|
|
|
|
];
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2019-04-05 14:33:00 +02:00
|
|
|
* {@inheritDoc}
|
2018-06-23 16:24:48 +02:00
|
|
|
*/
|
2023-04-02 16:00:37 +02:00
|
|
|
public static function providerForInvalidInput(): array
|
2018-06-23 16:24:48 +02:00
|
|
|
{
|
|
|
|
return [
|
|
|
|
[new Equivalent(1), false],
|
|
|
|
[new Equivalent('Something'), 'something else'],
|
|
|
|
[new Equivalent([1, 2, 3]), [1, 2, 3, 4]],
|
|
|
|
[new Equivalent((object) ['foo' => 'bar']), (object) ['foo' => 42]],
|
|
|
|
];
|
|
|
|
}
|
|
|
|
}
|