From 31ae781a1298029078f6ba66ea4e5177eee511c9 Mon Sep 17 00:00:00 2001 From: Trismegiste Date: Sat, 24 Aug 2013 00:37:08 +0200 Subject: [PATCH] unit test --- Tests/Singleton/SingletonTest.php | 34 +++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 Tests/Singleton/SingletonTest.php diff --git a/Tests/Singleton/SingletonTest.php b/Tests/Singleton/SingletonTest.php new file mode 100644 index 0000000..7291f9d --- /dev/null +++ b/Tests/Singleton/SingletonTest.php @@ -0,0 +1,34 @@ +assertInstanceOf('DesignPatterns\Singleton\Singleton', $firstCall); + $secondCall = Singleton::getInstance(); + $this->assertSame($firstCall, $secondCall); + } + + public function testNoConstructor() + { + $obj = Singleton::getInstance(); + + $refl = new \ReflectionObject($obj); + $meth = $refl->getMethod('__construct'); + $this->assertTrue($meth->isPrivate()); + } + +} \ No newline at end of file