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

61 lines
1.2 KiB
PHP
Raw Normal View History

2012-04-11 21:00:18 +02:00
<?php
2015-06-08 16:47:14 +02:00
/*
* Copyright (c) Alexandre Gomes Gaigalas <alganet@gmail.com>
* SPDX-License-Identifier: MIT
*/
declare(strict_types=1);
2012-04-11 21:00:18 +02:00
namespace Respect\Validation\Rules;
use Respect\Validation\Test\RuleTestCase;
use SplFileInfo;
use SplFileObject;
use stdClass;
use function dir;
2017-11-04 11:21:40 +01:00
/**
* @group rule
*
2017-02-04 14:01:14 +01:00
* @covers \Respect\Validation\Rules\Directory
*
* @author Gabriel Caruso <carusogabriel34@gmail.com>
* @author Henrique Moody <henriquemoody@gmail.com>
* @author William Espindola <oi@williamespindola.com.br>
*/
final class DirectoryTest extends RuleTestCase
2012-04-11 21:00:18 +02:00
{
/**
* {@inheritDoc}
2012-04-11 21:00:18 +02:00
*/
public static function providerForValidInput(): array
2012-04-11 21:00:18 +02:00
{
$rule = new Directory();
return [
[$rule, __DIR__],
[$rule, new SplFileInfo(__DIR__)],
[$rule, dir(__DIR__)],
];
2012-04-11 21:00:18 +02:00
}
/**
* {@inheritDoc}
2012-04-11 21:00:18 +02:00
*/
public static function providerForInvalidInput(): array
2012-04-11 21:00:18 +02:00
{
$rule = new Directory();
2015-10-18 03:44:47 +02:00
return [
[$rule, new SplFileInfo(__FILE__)],
[$rule, new SplFileObject(__FILE__)],
[$rule, ''],
[$rule, __FILE__],
[$rule, new stdClass()],
[$rule, [__DIR__]],
2015-10-18 03:44:47 +02:00
];
2012-04-11 21:00:18 +02:00
}
}