| Server IP : 127.0.1.1 / Your IP : 216.73.216.152 Web Server : Apache/2.4.52 (Ubuntu) System : Linux bahcrestlinepropertiesllc 5.15.0-113-generic #123-Ubuntu SMP Mon Jun 10 08:16:17 UTC 2024 x86_64 User : www-data ( 33) PHP Version : 7.4.33 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare, MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /var/www/bahcrestline/core/vendor/phpunit/phpunit/tests/unit/Util/TestDox/ |
Upload File : |
<?php declare(strict_types=1);
/*
* This file is part of PHPUnit.
*
* (c) Sebastian Bergmann <sebastian@phpunit.de>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace PHPUnit\Util\TestDox;
use Exception;
use PHPUnit\Framework\AssertionFailedError;
use PHPUnit\Framework\TestCase;
use PHPUnit\Framework\Warning;
/**
* @group testdox
* @small
*/
final class CliTestDoxPrinterTest extends TestCase
{
/**
* @var TestableCliTestDoxPrinter
*/
private $printer;
/**
* @var TestableCliTestDoxPrinter
*/
private $verbosePrinter;
protected function setUp(): void
{
$this->printer = new TestableCliTestDoxPrinter;
$this->verbosePrinter = new TestableCliTestDoxPrinter(null, true);
}
protected function tearDown(): void
{
$this->printer = null;
$this->verbosePrinter = null;
}
public function testPrintsTheClassNameOfTheTestClass(): void
{
$this->printer->startTest($this);
$this->printer->endTest($this, 0);
$this->assertStringStartsWith('Cli Test Dox Printer (PHPUnit\Util\TestDox\CliTestDoxPrinter)', $this->printer->getBuffer());
}
public function testPrintsThePrettifiedMethodName(): void
{
$this->printer->startTest($this);
$this->printer->endTest($this, 0.001);
$this->assertStringContainsString('Prints the prettified method name', $this->printer->getBuffer());
}
public function testPrintsCheckMarkForSuccessfulTest(): void
{
$this->printer->startTest($this);
$this->printer->endTest($this, 0.001);
$this->assertStringContainsString('✔', $this->printer->getBuffer());
}
public function testDoesNotPrintAdditionalInformationForSuccessfulTest(): void
{
$this->printer->startTest($this);
$this->printer->endTest($this, 0.001);
$this->assertStringNotContainsString('│', $this->printer->getBuffer());
}
public function testPrintsCrossForTestWithError(): void
{
$this->printer->startTest($this);
$this->printer->addError($this, new Exception, 0);
$this->printer->endTest($this, 0.001);
$this->assertStringContainsString('✘', $this->printer->getBuffer());
}
public function testPrintsAdditionalInformationForTestWithError(): void
{
$this->printer->startTest($this);
$this->printer->addError($this, new Exception, 0);
$this->printer->endTest($this, 0.001);
$this->assertStringContainsString('│', $this->printer->getBuffer());
}
public function testPrintsWarningTriangleForTestWithWarning(): void
{
$this->printer->startTest($this);
$this->printer->addWarning($this, new Warning, 0);
$this->printer->endTest($this, 0.001);
$this->assertStringContainsString('⚠', $this->printer->getBuffer());
}
public function testPrintsAdditionalInformationForTestWithWarning(): void
{
$this->printer->startTest($this);
$this->printer->addWarning($this, new Warning, 0);
$this->printer->endTest($this, 0.001);
$this->assertStringContainsString('│', $this->printer->getBuffer());
}
public function testPrintsCrossForTestWithFailure(): void
{
$this->printer->startTest($this);
$this->printer->addFailure($this, new AssertionFailedError, 0);
$this->printer->endTest($this, 0.001);
$this->assertStringContainsString('✘', $this->printer->getBuffer());
}
public function testPrintsAdditionalInformationForTestWithFailure(): void
{
$this->printer->startTest($this);
$this->printer->addFailure($this, new AssertionFailedError, 0);
$this->printer->endTest($this, 0.001);
$this->assertStringContainsString('│', $this->printer->getBuffer());
}
public function testPrintsEmptySetSymbolForTestWithFailure(): void
{
$this->printer->startTest($this);
$this->printer->addIncompleteTest($this, new Exception, 0);
$this->printer->endTest($this, 0.001);
$this->assertStringContainsString('∅', $this->printer->getBuffer());
}
public function testDoesNotPrintAdditionalInformationForIncompleteTestByDefault(): void
{
$this->printer->startTest($this);
$this->printer->addIncompleteTest($this, new Exception, 0);
$this->printer->endTest($this, 0.001);
$this->assertStringNotContainsString('│', $this->printer->getBuffer());
}
public function testPrintsAdditionalInformationForIncompleteTestInVerboseMode(): void
{
$this->verbosePrinter->startTest($this);
$this->verbosePrinter->addIncompleteTest($this, new Exception('E_X_C_E_P_T_I_O_N'), 0);
$this->verbosePrinter->endTest($this, 0.001);
$this->assertStringContainsString('│', $this->verbosePrinter->getBuffer());
$this->assertStringContainsString('E_X_C_E_P_T_I_O_N', $this->verbosePrinter->getBuffer());
}
public function testPrintsRadioactiveSymbolForRiskyTest(): void
{
$this->printer->startTest($this);
$this->printer->addRiskyTest($this, new Exception, 0);
$this->printer->endTest($this, 0.001);
$this->assertStringContainsString('☢', $this->printer->getBuffer());
}
public function testDoesNotPrintAdditionalInformationForRiskyTestByDefault(): void
{
$this->printer->startTest($this);
$this->printer->addRiskyTest($this, new Exception, 0);
$this->printer->endTest($this, 0.001);
$this->assertStringNotContainsString('│', $this->printer->getBuffer());
}
public function testPrintsAdditionalInformationForRiskyTestInVerboseMode(): void
{
$this->verbosePrinter->startTest($this);
$this->verbosePrinter->addRiskyTest($this, new Exception, 0);
$this->verbosePrinter->endTest($this, 0.001);
$this->assertStringContainsString('│', $this->verbosePrinter->getBuffer());
}
public function testPrintsArrowForSkippedTest(): void
{
$this->printer->startTest($this);
$this->printer->addSkippedTest($this, new Exception, 0);
$this->printer->endTest($this, 0.001);
$this->assertStringContainsString('↩', $this->printer->getBuffer());
}
public function testDoesNotPrintAdditionalInformationForSkippedTestByDefault(): void
{
$this->printer->startTest($this);
$this->printer->addSkippedTest($this, new Exception, 0);
$this->printer->endTest($this, 0.001);
$this->assertStringNotContainsString('│', $this->printer->getBuffer());
}
public function testPrintsAdditionalInformationForSkippedTestInVerboseMode(): void
{
$this->verbosePrinter->startTest($this);
$this->verbosePrinter->addSkippedTest($this, new Exception('S_K_I_P_P_E_D'), 0);
$this->verbosePrinter->endTest($this, 0.001);
$this->assertStringContainsString('│', $this->verbosePrinter->getBuffer());
$this->assertStringContainsString('S_K_I_P_P_E_D', $this->verbosePrinter->getBuffer());
}
}