Created
November 2, 2017 14:46
-
-
Save asev/6919b0fcfcf6d463f913d283f4f813e7 to your computer and use it in GitHub Desktop.
preparation for unit tests
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Index: src/AppBundle/Service/HappyNumberGenerator.php | |
IDEA additional info: | |
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP | |
<+>UTF-8 | |
=================================================================== | |
--- src/AppBundle/Service/HappyNumberGenerator.php (revision ) | |
+++ src/AppBundle/Service/HappyNumberGenerator.php (revision ) | |
@@ -0,0 +1,11 @@ | |
+<?php | |
+ | |
+namespace AppBundle\Service; | |
+ | |
+class HappyNumberGenerator | |
+{ | |
+ public function generate() | |
+ { | |
+ return random_int(1, 99); | |
+ } | |
+} | |
Index: src/AppBundle/Entity/User.php | |
IDEA additional info: | |
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP | |
<+>UTF-8 | |
=================================================================== | |
--- src/AppBundle/Entity/User.php (revision ) | |
+++ src/AppBundle/Entity/User.php (revision ) | |
@@ -0,0 +1,42 @@ | |
+<?php | |
+ | |
+namespace AppBundle\Entity; | |
+ | |
+class User | |
+{ | |
+ private $name; | |
+ | |
+ private $email; | |
+ | |
+ /** | |
+ * @return mixed | |
+ */ | |
+ public function getName() | |
+ { | |
+ return $this->name; | |
+ } | |
+ | |
+ /** | |
+ * @param mixed $name | |
+ */ | |
+ public function setName($name) | |
+ { | |
+ $this->name = $name; | |
+ } | |
+ | |
+ /** | |
+ * @return mixed | |
+ */ | |
+ public function getEmail() | |
+ { | |
+ return $this->email; | |
+ } | |
+ | |
+ /** | |
+ * @param mixed $email | |
+ */ | |
+ public function setEmail($email) | |
+ { | |
+ $this->email = $email; | |
+ } | |
+} | |
Index: src/AppBundle/Service/Mailer.php | |
IDEA additional info: | |
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP | |
<+>UTF-8 | |
=================================================================== | |
--- src/AppBundle/Service/Mailer.php (revision ) | |
+++ src/AppBundle/Service/Mailer.php (revision ) | |
@@ -0,0 +1,19 @@ | |
+<?php | |
+ | |
+ | |
+namespace AppBundle\Service; | |
+ | |
+ | |
+class Mailer | |
+{ | |
+ /** | |
+ * @param string $recipientEmail | |
+ * @param string $body | |
+ * @return null | |
+ */ | |
+ public function send($recipientEmail, $body) | |
+ { | |
+ // todo: implement email sending | |
+ return null; | |
+ } | |
+} | |
Index: src/AppBundle/Service/UserMailer.php | |
IDEA additional info: | |
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP | |
<+>UTF-8 | |
=================================================================== | |
--- src/AppBundle/Service/UserMailer.php (revision ) | |
+++ src/AppBundle/Service/UserMailer.php (revision ) | |
@@ -0,0 +1,25 @@ | |
+<?php | |
+ | |
+namespace AppBundle\Service; | |
+ | |
+use AppBundle\Entity\User; | |
+ | |
+class UserMailer | |
+{ | |
+ /** | |
+ * @var Mailer | |
+ */ | |
+ private $mailer; | |
+ | |
+ public function __construct(Mailer $mailer) | |
+ { | |
+ $this->mailer = $mailer; | |
+ } | |
+ | |
+ public function sendHello(User $user) | |
+ { | |
+ $body = sprintf('Hello %s.', $user->getName()); | |
+ | |
+ $this->mailer->send($user->getEmail(), $body); | |
+ } | |
+} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment