PHP Classes

File: tests/Formats/ConsoleFormatTest.php

Recommend this page to a friend!
  Classes of Rodolfo Berrios Arce   Var-Dump   tests/Formats/ConsoleFormatTest.php   Download  
File: tests/Formats/ConsoleFormatTest.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: 1 month ago
Size: 1,748 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\Formats;

use
Chevere\VarDump\Formats\ConsoleFormat;
use
Chevere\VarDump\Interfaces\HighlightInterface;
use
PHPUnit\Framework\TestCase;

final class
ConsoleFormatTest extends TestCase
{
    public function
testIndent(): void
   
{
       
$indent = 5;
       
$indented = (new ConsoleFormat())->indent($indent);
       
$this->assertSame($indent, strlen($indented));
    }

    public function
testEmphasis(): void
   
{
       
$string = 'string';
       
$emphasized = (new ConsoleFormat())->emphasis($string);
       
$this->assertTrue(strlen($emphasized) >= strlen($string));
    }

    public function
testFilterEncodedChars(): void
   
{
       
$string = 'string</a>';
       
$filtered = (new ConsoleFormat())->filterEncodedChars($string);
       
$this->assertSame($string, $filtered);
    }

    public function
testHighlight(): void
   
{
       
$string = 'string';
       
$highlighted = (new ConsoleFormat())
            ->
highlight(HighlightInterface::KEYS[0], $string);
       
$this->assertTrue(strlen($highlighted) >= strlen($string));
    }

    public function
testDetails(): void
   
{
       
$this->assertSame('', (new ConsoleFormat())->detailsOpen());
       
$this->assertSame('', (new ConsoleFormat())->detailsOpen(true));
       
$this->assertSame('', (new ConsoleFormat())->detailsOpen(false));
       
$this->assertSame('', (new ConsoleFormat())->detailsClose());
       
$this->assertSame('', (new ConsoleFormat())->detailsPullUp());
    }
}