added phpunit and composer stuff
This commit is contained in:
30
tests/unit/TestEmail.php
Normal file
30
tests/unit/TestEmail.php
Normal file
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use model\forum\Email;
|
||||
final class TestEmail extends TestCase
|
||||
{
|
||||
public function testCanBeCreatedFromValidEmailAddress(): void
|
||||
{
|
||||
$this->assertInstanceOf(
|
||||
Email::class,
|
||||
new Email('user@example.com')
|
||||
);
|
||||
}
|
||||
|
||||
public function testCannotBeCreatedFromInvalidEmailAddress(): void
|
||||
{
|
||||
$email = new Email('user');
|
||||
$this->assertFalse($email->getValid());
|
||||
$this->assertEquals($email->getEmail(), 'invalid');
|
||||
}
|
||||
|
||||
public function testCanBeUsedAsString(): void
|
||||
{
|
||||
$this->assertEquals(
|
||||
'user@example.com',
|
||||
new Email('user@example.com')
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user