for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Yiisoft\Validator\Tests;
use PHPUnit\Framework\TestCase;
use Yiisoft\Validator\Result;
class ResultTest extends TestCase
{
/**
* @test
*/
public function addErrorIsImmutable(): void
$result1 = $result2 = new Result();
$result1 = $result1->addError('Error');
$this->assertNotSame($result1, $result2);
}
public function isValidByDefault(): void
$result = new Result();
$this->assertTrue($result->isValid());
public function errorsAreEmptyByDefault(): void
$this->assertEmpty($result->getErrors());
public function errorIsProperlyAdded(): void
$result = (new Result())->addError('Error');
$this->assertContains('Error', $result->getErrors());
public function addingErrorChangesIsValid(): void
$this->assertFalse($result->isValid());