PHPUnit 🟢🔴
Installation
> composer require --dev phpunit/phpunit ^11
> .\vendor\bin\phpunit --version
Powershell on Windows:
> composer require --dev phpunit/phpunit ^^^^11
Usage
<?php declare(strict_types=1);
use PharIo\Manifest\Email;
use PHPUnit\Framework\TestCase;
final class EmailTest extends TestCase {
public function testCanBeCreatedFromValidEmail(): void {
$string = 'test@mail.com';
$email = new Email('test@mail.com');
$this->assertSame($string, $email->asString());
}
public function testCannotBeCreatedFromInvalidEmail(): void {
$this->expectException(InvalidArgumentException::class);
new Email('invalid');
}
}
PHPStorm
$ composer dump-autoload