PHP Classes

File: tests/FunctionsBoolTest.php

Recommend this page to a friend!
  Classes of Rodolfo Berrios Arce   Parameter   tests/FunctionsBoolTest.php   Download  
File: tests/FunctionsBoolTest.php
Role: Class source
Content type: text/plain
Description: Class source
Class: Parameter
Validate function parameters with PHP attributes
Author: By
Last change:
Date: 15 days ago
Size: 1,073 bytes
 

Contents

Class file image Download
<?php

/*
 * This file is part of Chevere.
 *
 * (c) Rodolfo Berrios <[email protected]>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

declare(strict_types=1);

namespace
Chevere\Tests;

use
PHPUnit\Framework\Attributes\DataProvider;
use
PHPUnit\Framework\TestCase;
use function
Chevere\Parameter\bool;

final class
FunctionsBoolTest extends TestCase
{
    public function
testBool(): void
   
{
       
$bool = bool();
       
$this->assertSame('', $bool->description());
       
$this->assertNull($bool->default());
    }

    public static function
boolArgumentsProvider(): array
    {
        return [
            [
'foo', true],
            [
'bar', false],
        ];
    }

   
#[DataProvider('boolArgumentsProvider')]
   
public function testBoolArguments(string $description, bool $default): void
   
{
       
$bool = bool($description, $default);
       
$this->assertSame($description, $bool->description());
       
$this->assertSame($default, $bool->default());
    }
}