respect-validation/tests/unit/Rules/ExistsTest.php
William Espindola 515b23e02f
Apply contribution guidelines to "Exists" rule
Co-authored-by: Henrique Moody <henriquemoody@gmail.com>
2018-06-20 22:34:21 +02:00

58 lines
1.3 KiB
PHP

<?php
/*
* This file is part of Respect/Validation.
*
* (c) Alexandre Gomes Gaigalas <alexandre@gaigalas.net>
*
* For the full copyright and license information, please view the "LICENSE.md"
* file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Respect\Validation\Rules;
use Respect\Validation\Test\RuleTestCase;
use SplFileInfo;
use SplFileObject;
/**
* @group rule
*
* @covers \Respect\Validation\Rules\Exists
*
* @author Gabriel Caruso <carusogabriel34@gmail.com>
* @author Henrique Moody <henriquemoody@gmail.com>
* @author Kennedy Tedesco <kennedyt.tw@gmail.com>
* @author William Espindola <oi@williamespindola.com.br>
*/
final class ExistsTest extends RuleTestCase
{
/**
* {@inheritdoc}
*/
public function providerForValidInput(): array
{
$rule = new Exists();
return [
[$rule, __FILE__],
[$rule, new SplFileInfo(__FILE__)],
[$rule, new SplFileObject(__FILE__)],
];
}
/**
* {@inheritdoc}
*/
public function providerForInvalidInput(): array
{
$rule = new Exists();
return [
[$rule, 'path/of/a/non-existent/file'],
[$rule, new SplFileInfo('path/of/a/non-existent/file')],
];
}
}