respect-validation/tests/unit/Rules/ExistsTest.php

55 lines
1.1 KiB
PHP
Raw Normal View History

<?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;
2015-10-31 15:32:25 +01:00
use SplFileInfo;
use SplFileObject;
/**
* @group rule
*
2017-02-04 14:01:14 +01:00
* @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 static function providerForValidInput(): array
{
$rule = new Exists();
return [
[$rule, __FILE__],
[$rule, new SplFileInfo(__FILE__)],
[$rule, new SplFileObject(__FILE__)],
];
}
/**
* {@inheritDoc}
*/
public static function providerForInvalidInput(): array
{
$rule = new Exists();
2015-10-31 15:32:25 +01:00
return [
[$rule, 'path/of/a/non-existent/file'],
[$rule, new SplFileInfo('path/of/a/non-existent/file')],
2015-10-31 15:32:25 +01:00
];
}
}