PHP Classes

File: tests/Processors/FloatProcessorTest.php

Recommend this page to a friend!
  Classes of Rodolfo Berrios Arce   Var-Dump   tests/Processors/FloatProcessorTest.php   Download  
File: tests/Processors/FloatProcessorTest.php
Role: Class source
Content type: text/plain
Description: Class source
Class: Var-Dump
Show the value of a variable in colored way
Author: By
Last change:
Date: 19 days ago
Size: 1,320 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\Processors;

use
Chevere\Tests\Traits\VarDumperTrait;
use
Chevere\VarDump\Processors\FloatProcessor;
use
InvalidArgumentException;
use
PHPUnit\Framework\TestCase;

final class
FloatProcessorTest extends TestCase
{
    use
VarDumperTrait;

    public function
testConstruct(): void
   
{
        foreach ([
0.1, 1.1, 10.0, 2.00, 110.011] as $var) {
           
$stringVar = (string) $var;
           
$expectedInfo = 'length=' . strlen($stringVar);
           
$varDumper = $this->getVarDumper($var);
           
$this->assertProcessor(FloatProcessor::class, $varDumper);
           
$processor = new FloatProcessor($varDumper);
           
$this->assertSame($expectedInfo, $processor->info());
           
$this->assertSame(
               
"float {$stringVar} ({$expectedInfo})",
               
$varDumper->writer()->__toString()
            );
        }
    }

    public function
testInvalidArgument(): void
   
{
       
$this->expectException(InvalidArgumentException::class);
        new
FloatProcessor($this->getVarDumper(100));
    }
}