From 77cd8f62c9cb1558d53ae701c9b3570ef1916878 Mon Sep 17 00:00:00 2001 From: Marcel Kapfer Date: Sat, 18 Sep 2021 22:44:43 +0200 Subject: [PATCH] Removed PHPunit learning files --- src/Email.php | 33 --------------------------------- tests/EmailTest.php | 27 --------------------------- 2 files changed, 60 deletions(-) delete mode 100644 src/Email.php delete mode 100644 tests/EmailTest.php diff --git a/src/Email.php b/src/Email.php deleted file mode 100644 index ac3c74d..0000000 --- a/src/Email.php +++ /dev/null @@ -1,33 +0,0 @@ -ensureIsValidEmail($email); - $this->email = $email; - } - - public static function fromString(string $email): self - { - return new self($email); - } - - public function __toString(): string - { - return $this->email; - } - - private function ensureIsValidEmail(string $email): void - { - if(!filter_var($email, FILTER_VALIDATE_EMAIL)) { - throw new \InvalidArgumentException( - sprintf("%s is not a valid email address", $email) - ); - } - } -} diff --git a/tests/EmailTest.php b/tests/EmailTest.php deleted file mode 100644 index 696af28..0000000 --- a/tests/EmailTest.php +++ /dev/null @@ -1,27 +0,0 @@ -assertInstanceOf( - Email::class, - Email::fromString($this->email) - ); - } - - public function testCannotBeCreatedFromInvalidEmailAddress(): void { - $this->expectException(InvalidArgumentException::class); - Email::fromString('invalid'); - } - - public function testCanBeUsedAsString(): void { - $this->assertEquals( - $this->email, - Email::fromString($this->email) - ); - } -}