From 1ff9b8ccd4db6bb6cdb4b63cc7964fb3241ceca4 Mon Sep 17 00:00:00 2001 From: hidenorigoto Date: Wed, 9 Oct 2013 18:34:24 +0900 Subject: [PATCH] =?UTF-8?q?[Tests/GreeterTest]=20=E6=99=82=E8=A8=88?= =?UTF-8?q?=E3=82=92=E3=83=A2=E3=83=83=E3=82=AF=E3=81=97=E3=81=A6=E6=9C=9D?= =?UTF-8?q?=E3=81=A8=E3=81=9D=E3=82=8C=E4=BB=A5=E5=A4=96=E3=81=AE=E3=83=86?= =?UTF-8?q?=E3=82=B9=E3=83=88=E3=82=92=E8=A8=98=E8=BF=B0=E3=81=97=E3=81=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/CodeIQ/Greeter/Tests/GreeterTest.php | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/src/CodeIQ/Greeter/Tests/GreeterTest.php b/src/CodeIQ/Greeter/Tests/GreeterTest.php index 0bdfe0d..9098db2 100644 --- a/src/CodeIQ/Greeter/Tests/GreeterTest.php +++ b/src/CodeIQ/Greeter/Tests/GreeterTest.php @@ -19,11 +19,27 @@ class GreeterTest extends \PHPUnit_Framework_TestCase /** * @test */ - public function あいさつする() + public function 朝ならおはようございます() { + $this->clock->expects($this->once()) + ->method('getCurrentTime') + ->will($this->returnValue(new \DateTimeImmutable('08:00:00'))); + $this->assertThat($this->SUT->greet(), $this->equalTo('おはようございます')); } + /** + * @test + */ + public function 朝でないならあいさつなし() + { + $this->clock->expects($this->once()) + ->method('getCurrentTime') + ->will($this->returnValue(new \DateTimeImmutable('15:00:00'))); + + $this->assertThat($this->SUT->greet(), $this->equalTo('')); + } + protected function setUp() { $this->clock = $this->getMock('CodeIQ\Greeter\Clock');