From 8a5e11621f279851746aec97d2f75ef7b52b8fab Mon Sep 17 00:00:00 2001 From: Adam Sakhr Date: Mon, 11 Jul 2016 13:13:08 +0200 Subject: [PATCH 1/5] Test --- Adam/hello-world.php | 19 +++++++++++++++++++ Adam/hello-world_test.php | 21 +++++++++++++++++++++ 2 files changed, 40 insertions(+) create mode 100644 Adam/hello-world.php create mode 100644 Adam/hello-world_test.php diff --git a/Adam/hello-world.php b/Adam/hello-world.php new file mode 100644 index 0000000..5713469 --- /dev/null +++ b/Adam/hello-world.php @@ -0,0 +1,19 @@ +assertEquals('Hello, World!', helloWorld()); + } + + public function testSampleName() + { + $this->assertEquals('Hello, Alice!', helloWorld('Alice')); + } + + public function testAnotherSampleName() + { + $this->assertEquals('Hello, Bob!', helloWorld('Bob')); + } +} From 484b8969c06b469d3b1ee9725bffd4243d8fc833 Mon Sep 17 00:00:00 2001 From: Adam Sakhr Date: Mon, 11 Jul 2016 17:00:37 +0200 Subject: [PATCH 2/5] Test --- hello-world.php | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/hello-world.php b/hello-world.php index 4c88d22..06dff47 100644 --- a/hello-world.php +++ b/hello-world.php @@ -5,9 +5,16 @@ // It's been provided as a convenience to get you started writing code faster. // -function helloWorld($name) -{ - // - // YOUR CODE GOES HERE - // + + function helloWorld($name = null) + { + if ($name === null){ + echo "Hello, World!"; + } + else { + echo "Hello!". " ".($name); + } + } + helloWorld(); + } From 0c17d555c30f2d6e9f7d4314f87cb148587fbb70 Mon Sep 17 00:00:00 2001 From: Adam Sakhr Date: Mon, 11 Jul 2016 17:15:15 +0200 Subject: [PATCH 3/5] Correction --- hello-world.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hello-world.php b/hello-world.php index 06dff47..6738e60 100644 --- a/hello-world.php +++ b/hello-world.php @@ -17,4 +17,4 @@ function helloWorld($name = null) } helloWorld(); -} +?> From eb1b4ab26852d2eaf9d465131a3ec631cc726ce0 Mon Sep 17 00:00:00 2001 From: Adam Sakhr Date: Tue, 12 Jul 2016 13:43:33 +0200 Subject: [PATCH 4/5] removed --- Adam/hello-world.php | 19 ------------------- Adam/hello-world_test.php | 21 --------------------- 2 files changed, 40 deletions(-) delete mode 100644 Adam/hello-world.php delete mode 100644 Adam/hello-world_test.php diff --git a/Adam/hello-world.php b/Adam/hello-world.php deleted file mode 100644 index 5713469..0000000 --- a/Adam/hello-world.php +++ /dev/null @@ -1,19 +0,0 @@ -assertEquals('Hello, World!', helloWorld()); - } - - public function testSampleName() - { - $this->assertEquals('Hello, Alice!', helloWorld('Alice')); - } - - public function testAnotherSampleName() - { - $this->assertEquals('Hello, Bob!', helloWorld('Bob')); - } -} From 3fe027fabd2f70da7e65fefa9dc66c591f3e0208 Mon Sep 17 00:00:00 2001 From: Adam Sakhr Date: Tue, 12 Jul 2016 13:46:34 +0200 Subject: [PATCH 5/5] Check again --- hello-world.php | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/hello-world.php b/hello-world.php index 6738e60..179ce2b 100644 --- a/hello-world.php +++ b/hello-world.php @@ -9,12 +9,9 @@ function helloWorld($name = null) { if ($name === null){ - echo "Hello, World!"; + return "Hello, World!"; } else { - echo "Hello!". " ".($name); + return "Hello!". " ".($name); } } - helloWorld(); - -?>