From 1b5fe57b9fa551da3f59aad70b2eeb138c93d563 Mon Sep 17 00:00:00 2001 From: cloud Date: Fri, 15 Apr 2022 04:27:54 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8D=95=E4=BE=8B=E6=A8=A1=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- demo/Creational/Singleton/Run.php | 41 +++++++++++++++++ demo/Creational/Singleton/Singleton.php | 45 +++++++++++++++++++ .../Singleton/Tests/SingletonTest.php | 20 +++++++++ 3 files changed, 106 insertions(+) create mode 100644 demo/Creational/Singleton/Run.php create mode 100644 demo/Creational/Singleton/Singleton.php create mode 100644 demo/Creational/Singleton/Tests/SingletonTest.php diff --git a/demo/Creational/Singleton/Run.php b/demo/Creational/Singleton/Run.php new file mode 100644 index 0000000..1ffa60d --- /dev/null +++ b/demo/Creational/Singleton/Run.php @@ -0,0 +1,41 @@ +assertInstanceOf(Singleton::class, $firstCall); + // 断言两个变量具有相同的类型和值。 用于对象,它断言两个变量引用同一个对象 + $this->assertSame($firstCall, $secondCall); + } +} \ No newline at end of file