From 64c5eb644bc5fe678b78df3df16750b53e21d85d Mon Sep 17 00:00:00 2001
From: sockstack <85564748@qq.com>
Date: Wed, 7 Nov 2018 00:29:48 +0800
Subject: [PATCH 01/11] add travis-CI
---
.idea/design_pattern.iml | 38 ----
.idea/misc.xml | 6 -
.idea/modules.xml | 8 -
.idea/php.xml | 39 ----
.idea/workspace.xml | 407 ---------------------------------------
5 files changed, 498 deletions(-)
delete mode 100644 .idea/design_pattern.iml
delete mode 100644 .idea/misc.xml
delete mode 100644 .idea/modules.xml
delete mode 100644 .idea/php.xml
delete mode 100644 .idea/workspace.xml
diff --git a/.idea/design_pattern.iml b/.idea/design_pattern.iml
deleted file mode 100644
index caab06b..0000000
--- a/.idea/design_pattern.iml
+++ /dev/null
@@ -1,38 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/misc.xml b/.idea/misc.xml
deleted file mode 100644
index 28a804d..0000000
--- a/.idea/misc.xml
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/modules.xml b/.idea/modules.xml
deleted file mode 100644
index e203503..0000000
--- a/.idea/modules.xml
+++ /dev/null
@@ -1,8 +0,0 @@
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/php.xml b/.idea/php.xml
deleted file mode 100644
index 0564203..0000000
--- a/.idea/php.xml
+++ /dev/null
@@ -1,39 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/workspace.xml b/.idea/workspace.xml
deleted file mode 100644
index 6e44200..0000000
--- a/.idea/workspace.xml
+++ /dev/null
@@ -1,407 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
- $PROJECT_DIR$/composer.json
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- true
- DEFINITION_ORDER
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- 1541518168509
-
-
- 1541518168509
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
From bb2601f3ae22180116657bbae1c419a6b49749a5 Mon Sep 17 00:00:00 2001
From: sockstack <85564748@qq.com>
Date: Wed, 7 Nov 2018 00:30:27 +0800
Subject: [PATCH 02/11] add travis-CI
---
.gitignore | 1 +
.travis.yml | 16 ++++++++++++++++
README.md | 2 +-
3 files changed, 18 insertions(+), 1 deletion(-)
create mode 100644 .travis.yml
diff --git a/.gitignore b/.gitignore
index dd62680..124117d 100644
--- a/.gitignore
+++ b/.gitignore
@@ -5,3 +5,4 @@ sftp-config.json
composer.lock
.subsplit
.php_cs.cache
+.idea/
diff --git a/.travis.yml b/.travis.yml
new file mode 100644
index 0000000..b3ba12d
--- /dev/null
+++ b/.travis.yml
@@ -0,0 +1,16 @@
+language: php # 我们代码所需要运行的环境平台
+
+php: # 需要测试的版本
+ - 5.6
+ - 7.0
+ - 7.1
+ - 7.2
+
+dist: trusty # 系统版本
+sudo: false # 使用使用 sudo 模式
+
+# 执行前需要运行的命令
+install: travis_retry composer install --no-interaction --prefer-source
+
+# 主要构建命令
+script: vendor/bin/phpunit --verbose
diff --git a/README.md b/README.md
index 7c117c7..897409b 100644
--- a/README.md
+++ b/README.md
@@ -1,6 +1,6 @@
design_pattern
- .
+ [](https://github.styleci.io/repos/156411862) [](https://www.travis-ci.org/sockstack/weather-sdk-for-free)
## Installing
From 4caddfd22e49f33e16d89be961f46290d54ff68c Mon Sep 17 00:00:00 2001
From: sockstack <85564748@qq.com>
Date: Wed, 7 Nov 2018 00:33:08 +0800
Subject: [PATCH 03/11] modify readme.md
---
README.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/README.md b/README.md
index 897409b..64fa8bf 100644
--- a/README.md
+++ b/README.md
@@ -1,6 +1,6 @@
design_pattern
- [](https://github.styleci.io/repos/156411862) [](https://www.travis-ci.org/sockstack/weather-sdk-for-free)
+[](https://github.styleci.io/repos/156411862) [](https://www.travis-ci.org/sockstack/weather-sdk-for-free)
## Installing
From 35c5255e0e3e03dcd84f595ac80cd5001a68a011 Mon Sep 17 00:00:00 2001
From: sockstack <85564748@qq.com>
Date: Wed, 7 Nov 2018 00:36:59 +0800
Subject: [PATCH 04/11] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=BA=86=E6=8C=81?=
=?UTF-8?q?=E7=BB=AD=E9=9B=86=E6=88=90=E7=9A=84php=E7=89=88=E6=9C=AC?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.travis.yml | 1 -
1 file changed, 1 deletion(-)
diff --git a/.travis.yml b/.travis.yml
index b3ba12d..f3e95e5 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,7 +1,6 @@
language: php # 我们代码所需要运行的环境平台
php: # 需要测试的版本
- - 5.6
- 7.0
- 7.1
- 7.2
From e2f26d9718ddbd10d706312ad276d5012a1fc3b8 Mon Sep 17 00:00:00 2001
From: sockstack <85564748@qq.com>
Date: Wed, 7 Nov 2018 00:40:05 +0800
Subject: [PATCH 05/11] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E7=8A=B6=E6=80=81?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
README.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/README.md b/README.md
index 64fa8bf..682ae3b 100644
--- a/README.md
+++ b/README.md
@@ -1,6 +1,6 @@
design_pattern
-[](https://github.styleci.io/repos/156411862) [](https://www.travis-ci.org/sockstack/weather-sdk-for-free)
+[](https://www.travis-ci.org/sockstack/design_pattern) [](https://github.styleci.io/repos/156411862)
## Installing
From 90c53771f62aca4d8e3070a7c3da49821095d7fb Mon Sep 17 00:00:00 2001
From: lizoenn <623466433@qq.com>
Date: Wed, 7 Nov 2018 17:47:13 +0800
Subject: [PATCH 06/11] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=BA=86=E4=B8=A4?=
=?UTF-8?q?=E4=B8=AA=E5=AF=B9=E8=B1=A1=E7=9B=B8=E7=AD=89=E7=9A=84=E6=B5=8B?=
=?UTF-8?q?=E8=AF=95=E6=96=B9=E6=B3=95?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
README.md | 8 ++++++--
tests/SingletonTest.php | 2 +-
2 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/README.md b/README.md
index 682ae3b..41ff2ee 100644
--- a/README.md
+++ b/README.md
@@ -6,12 +6,16 @@
## Installing
```shell
-$ composer require sockstack/design_pattern -vvv
+$ git clone https://github.com/sockstack/design_pattern.git
```
## Usage
-TODO
+```shell
+$ cd design_pattern/
+$ composer install -vvv
+$ vendor/bin/phpunit
+```
## Contributing
diff --git a/tests/SingletonTest.php b/tests/SingletonTest.php
index f324788..4f33fc9 100644
--- a/tests/SingletonTest.php
+++ b/tests/SingletonTest.php
@@ -51,6 +51,6 @@ public function testSingleton()
$object1 = Singleton::getInstance();
$object2 = Singleton::getInstance();
- $this->assertEquals($object1, $object2);
+ $this->assertTrue($object1 === $object2, '两个对象不是同一个对象');
}
}
From 9496aeee9910cac71af4bd88933d598e88e8b4b1 Mon Sep 17 00:00:00 2001
From: sockstack <85564748@qq.com>
Date: Wed, 7 Nov 2018 23:54:36 +0800
Subject: [PATCH 07/11] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E7=AE=80=E5=8D=95?=
=?UTF-8?q?=E5=B7=A5=E5=8E=82=E6=A8=A1=E5=BC=8F?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../Sample/Driver/DriverInterface.php | 15 ++++++++
.../Sample/Driver/MysqlDriver.php | 19 +++++++++++
.../Sample/Driver/MysqliDriver.php | 19 +++++++++++
src/SimpleFactory/Sample/SimpleFactory.php | 34 +++++++++++++++++++
src/SimpleFactory/doc.md | 12 +++++++
tests/SimpleFactoryTest.php | 31 +++++++++++++++++
6 files changed, 130 insertions(+)
create mode 100644 src/SimpleFactory/Sample/Driver/DriverInterface.php
create mode 100644 src/SimpleFactory/Sample/Driver/MysqlDriver.php
create mode 100644 src/SimpleFactory/Sample/Driver/MysqliDriver.php
create mode 100644 src/SimpleFactory/Sample/SimpleFactory.php
create mode 100644 src/SimpleFactory/doc.md
create mode 100644 tests/SimpleFactoryTest.php
diff --git a/src/SimpleFactory/Sample/Driver/DriverInterface.php b/src/SimpleFactory/Sample/Driver/DriverInterface.php
new file mode 100644
index 0000000..7c33309
--- /dev/null
+++ b/src/SimpleFactory/Sample/Driver/DriverInterface.php
@@ -0,0 +1,15 @@
+fail("创建实例对象失败");
+ }
+
+ $mysqli = SimpleFactory::createMysqli();
+ if (!$mysqli instanceof MysqliDriver) {
+ $this->fail("创建实例对象失败");
+ }
+ }
+}
\ No newline at end of file
From db6dea225570dd6e8a583e3b8c1f12c7dadddd4b Mon Sep 17 00:00:00 2001
From: sockstack <85564748@qq.com>
Date: Wed, 7 Nov 2018 15:58:03 +0000
Subject: [PATCH 08/11] Apply fixes from StyleCI
---
src/SimpleFactory/Sample/Driver/DriverInterface.php | 5 ++---
src/SimpleFactory/Sample/Driver/MysqlDriver.php | 6 ++----
src/SimpleFactory/Sample/Driver/MysqliDriver.php | 6 ++----
src/SimpleFactory/Sample/SimpleFactory.php | 9 +++++----
tests/SimpleFactoryTest.php | 11 +++++------
5 files changed, 16 insertions(+), 21 deletions(-)
diff --git a/src/SimpleFactory/Sample/Driver/DriverInterface.php b/src/SimpleFactory/Sample/Driver/DriverInterface.php
index 7c33309..42ae0f4 100644
--- a/src/SimpleFactory/Sample/Driver/DriverInterface.php
+++ b/src/SimpleFactory/Sample/Driver/DriverInterface.php
@@ -3,13 +3,12 @@
* Created by PhpStorm.
* User: sockstack
* Date: 2018/11/7
- * Time: 23:40
+ * Time: 23:40.
*/
namespace Sockstack\DesignPattern\SimpleFactory\Sample\Driver;
-
interface DriverInterface
{
public function connection();
-}
\ No newline at end of file
+}
diff --git a/src/SimpleFactory/Sample/Driver/MysqlDriver.php b/src/SimpleFactory/Sample/Driver/MysqlDriver.php
index f44bc00..b2aaff6 100644
--- a/src/SimpleFactory/Sample/Driver/MysqlDriver.php
+++ b/src/SimpleFactory/Sample/Driver/MysqlDriver.php
@@ -3,17 +3,15 @@
* Created by PhpStorm.
* User: sockstack
* Date: 2018/11/7
- * Time: 23:40
+ * Time: 23:40.
*/
namespace Sockstack\DesignPattern\SimpleFactory\Sample\Driver;
-
class MysqlDriver implements DriverInterface
{
-
public function connection()
{
// TODO: Implement connection() method.
}
-}
\ No newline at end of file
+}
diff --git a/src/SimpleFactory/Sample/Driver/MysqliDriver.php b/src/SimpleFactory/Sample/Driver/MysqliDriver.php
index 776f8e1..1433980 100644
--- a/src/SimpleFactory/Sample/Driver/MysqliDriver.php
+++ b/src/SimpleFactory/Sample/Driver/MysqliDriver.php
@@ -3,17 +3,15 @@
* Created by PhpStorm.
* User: sockstack
* Date: 2018/11/7
- * Time: 23:41
+ * Time: 23:41.
*/
namespace Sockstack\DesignPattern\SimpleFactory\Sample\Driver;
-
class MysqliDriver implements DriverInterface
{
-
public function connection()
{
// TODO: Implement connection() method.
}
-}
\ No newline at end of file
+}
diff --git a/src/SimpleFactory/Sample/SimpleFactory.php b/src/SimpleFactory/Sample/SimpleFactory.php
index a850a83..55d05c3 100644
--- a/src/SimpleFactory/Sample/SimpleFactory.php
+++ b/src/SimpleFactory/Sample/SimpleFactory.php
@@ -3,19 +3,19 @@
* Created by PhpStorm.
* User: sockstack
* Date: 2018/11/7
- * Time: 23:34
+ * Time: 23:34.
*/
namespace Sockstack\DesignPattern\SimpleFactory\Sample;
-
use Sockstack\DesignPattern\SimpleFactory\Sample\Driver\MysqlDriver;
use Sockstack\DesignPattern\SimpleFactory\Sample\Driver\MysqliDriver;
class SimpleFactory
{
/**
- * 返回mysql实例
+ * 返回mysql实例.
+ *
* @return MysqlDriver
*/
public static function createMysql()
@@ -24,7 +24,8 @@ public static function createMysql()
}
/**
- * 返回mysqli实例
+ * 返回mysqli实例.
+ *
* @return MysqliDriver
*/
public static function createMysqli()
diff --git a/tests/SimpleFactoryTest.php b/tests/SimpleFactoryTest.php
index 54539d5..5ffda00 100644
--- a/tests/SimpleFactoryTest.php
+++ b/tests/SimpleFactoryTest.php
@@ -3,15 +3,14 @@
* Created by PhpStorm.
* User: sockstack
* Date: 2018/11/7
- * Time: 23:43
+ * Time: 23:43.
*/
namespace Sockstack\DesignPattern\Test;
-
use PHPUnit\Framework\TestCase;
-use Sockstack\DesignPattern\SimpleFactory\Sample\Driver\MysqliDriver;
use Sockstack\DesignPattern\SimpleFactory\Sample\Driver\MysqlDriver;
+use Sockstack\DesignPattern\SimpleFactory\Sample\Driver\MysqliDriver;
use Sockstack\DesignPattern\SimpleFactory\Sample\SimpleFactory;
class SimpleFactoryTest extends TestCase
@@ -20,12 +19,12 @@ public function testSimpleFactory()
{
$mysql = SimpleFactory::createMysql();
if (!$mysql instanceof MysqlDriver) {
- $this->fail("创建实例对象失败");
+ $this->fail('创建实例对象失败');
}
$mysqli = SimpleFactory::createMysqli();
if (!$mysqli instanceof MysqliDriver) {
- $this->fail("创建实例对象失败");
+ $this->fail('创建实例对象失败');
}
}
-}
\ No newline at end of file
+}
From 79aeeb1b2adf2d09cf4300aa34f31c337b140847 Mon Sep 17 00:00:00 2001
From: lizoenn <623466433@qq.com>
Date: Thu, 8 Nov 2018 16:14:03 +0800
Subject: [PATCH 09/11] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=B7=A5=E5=8E=82?=
=?UTF-8?q?=E6=96=B9=E6=B3=95=E6=A8=A1=E5=BC=8F?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/FactoryMethod/Sample/Implemention/SUV.php | 22 +++++++++++++++
.../Sample/Implemention/SUVFactory.php | 22 +++++++++++++++
.../Sample/Implemention/Taxi.php | 22 +++++++++++++++
.../Sample/Implemention/TaxiFactory.php | 22 +++++++++++++++
.../Sample/Interfaces/FactoryInterface.php | 15 ++++++++++
.../Sample/Interfaces/ProductInterface.php | 15 ++++++++++
src/FactoryMethod/doc.md | 11 ++++++++
tests/FactoryMethodText.php | 28 +++++++++++++++++++
8 files changed, 157 insertions(+)
create mode 100644 src/FactoryMethod/Sample/Implemention/SUV.php
create mode 100644 src/FactoryMethod/Sample/Implemention/SUVFactory.php
create mode 100644 src/FactoryMethod/Sample/Implemention/Taxi.php
create mode 100644 src/FactoryMethod/Sample/Implemention/TaxiFactory.php
create mode 100644 src/FactoryMethod/Sample/Interfaces/FactoryInterface.php
create mode 100644 src/FactoryMethod/Sample/Interfaces/ProductInterface.php
create mode 100644 src/FactoryMethod/doc.md
create mode 100644 tests/FactoryMethodText.php
diff --git a/src/FactoryMethod/Sample/Implemention/SUV.php b/src/FactoryMethod/Sample/Implemention/SUV.php
new file mode 100644
index 0000000..b139ec1
--- /dev/null
+++ b/src/FactoryMethod/Sample/Implemention/SUV.php
@@ -0,0 +1,22 @@
+assertTrue($suv instanceof SUV);
+
+ $taxi = TaxiFactory::create();
+ $this->assertTrue($taxi instanceof Taxi);
+ }
+}
\ No newline at end of file
From c37104a4a0cdb0c78d5438b7d639dc3714e5bb6c Mon Sep 17 00:00:00 2001
From: sockstack <85564748@qq.com>
Date: Thu, 8 Nov 2018 08:15:27 +0000
Subject: [PATCH 10/11] Apply fixes from StyleCI
---
src/FactoryMethod/Sample/Implemention/SUV.php | 8 +++-----
src/FactoryMethod/Sample/Implemention/SUVFactory.php | 6 ++----
src/FactoryMethod/Sample/Implemention/Taxi.php | 8 +++-----
src/FactoryMethod/Sample/Implemention/TaxiFactory.php | 6 ++----
src/FactoryMethod/Sample/Interfaces/FactoryInterface.php | 5 ++---
src/FactoryMethod/Sample/Interfaces/ProductInterface.php | 5 ++---
tests/FactoryMethodText.php | 5 ++---
7 files changed, 16 insertions(+), 27 deletions(-)
diff --git a/src/FactoryMethod/Sample/Implemention/SUV.php b/src/FactoryMethod/Sample/Implemention/SUV.php
index b139ec1..acde5bd 100644
--- a/src/FactoryMethod/Sample/Implemention/SUV.php
+++ b/src/FactoryMethod/Sample/Implemention/SUV.php
@@ -3,20 +3,18 @@
* Created by PhpStorm.
* User: Administrator
* Date: 2018/11/8
- * Time: 16:05
+ * Time: 16:05.
*/
namespace Sockstack\DesignPattern\FactoryMethod\Sample\Implemention;
-
use Sockstack\DesignPattern\FactoryMethod\Sample\Interfaces\ProductInterface;
class SUV implements ProductInterface
{
-
public function action()
{
// TODO: Implement action() method.
- return "SUV";
+ return 'SUV';
}
-}
\ No newline at end of file
+}
diff --git a/src/FactoryMethod/Sample/Implemention/SUVFactory.php b/src/FactoryMethod/Sample/Implemention/SUVFactory.php
index 6222d64..ccff740 100644
--- a/src/FactoryMethod/Sample/Implemention/SUVFactory.php
+++ b/src/FactoryMethod/Sample/Implemention/SUVFactory.php
@@ -3,20 +3,18 @@
* Created by PhpStorm.
* User: Administrator
* Date: 2018/11/8
- * Time: 16:04
+ * Time: 16:04.
*/
namespace Sockstack\DesignPattern\FactoryMethod\Sample\Implemention;
-
use Sockstack\DesignPattern\FactoryMethod\Sample\Interfaces\FactoryInterface;
class SUVFactory implements FactoryInterface
{
-
public static function create()
{
// TODO: Implement create() method.
return new SUV();
}
-}
\ No newline at end of file
+}
diff --git a/src/FactoryMethod/Sample/Implemention/Taxi.php b/src/FactoryMethod/Sample/Implemention/Taxi.php
index 86ba73e..0478667 100644
--- a/src/FactoryMethod/Sample/Implemention/Taxi.php
+++ b/src/FactoryMethod/Sample/Implemention/Taxi.php
@@ -3,20 +3,18 @@
* Created by PhpStorm.
* User: Administrator
* Date: 2018/11/8
- * Time: 16:06
+ * Time: 16:06.
*/
namespace Sockstack\DesignPattern\FactoryMethod\Sample\Implemention;
-
use Sockstack\DesignPattern\FactoryMethod\Sample\Interfaces\ProductInterface;
class Taxi implements ProductInterface
{
-
public function action()
{
// TODO: Implement action() method.
- return "Taxi";
+ return 'Taxi';
}
-}
\ No newline at end of file
+}
diff --git a/src/FactoryMethod/Sample/Implemention/TaxiFactory.php b/src/FactoryMethod/Sample/Implemention/TaxiFactory.php
index 8be806c..941f119 100644
--- a/src/FactoryMethod/Sample/Implemention/TaxiFactory.php
+++ b/src/FactoryMethod/Sample/Implemention/TaxiFactory.php
@@ -3,20 +3,18 @@
* Created by PhpStorm.
* User: Administrator
* Date: 2018/11/8
- * Time: 16:07
+ * Time: 16:07.
*/
namespace Sockstack\DesignPattern\FactoryMethod\Sample\Implemention;
-
use Sockstack\DesignPattern\FactoryMethod\Sample\Interfaces\FactoryInterface;
class TaxiFactory implements FactoryInterface
{
-
public static function create()
{
// TODO: Implement create() method.
return new Taxi();
}
-}
\ No newline at end of file
+}
diff --git a/src/FactoryMethod/Sample/Interfaces/FactoryInterface.php b/src/FactoryMethod/Sample/Interfaces/FactoryInterface.php
index 4ae3538..f87e37b 100644
--- a/src/FactoryMethod/Sample/Interfaces/FactoryInterface.php
+++ b/src/FactoryMethod/Sample/Interfaces/FactoryInterface.php
@@ -3,13 +3,12 @@
* Created by PhpStorm.
* User: Administrator
* Date: 2018/11/8
- * Time: 16:02
+ * Time: 16:02.
*/
namespace Sockstack\DesignPattern\FactoryMethod\Sample\Interfaces;
-
interface FactoryInterface
{
public static function create();
-}
\ No newline at end of file
+}
diff --git a/src/FactoryMethod/Sample/Interfaces/ProductInterface.php b/src/FactoryMethod/Sample/Interfaces/ProductInterface.php
index 70e1102..f2ed6f8 100644
--- a/src/FactoryMethod/Sample/Interfaces/ProductInterface.php
+++ b/src/FactoryMethod/Sample/Interfaces/ProductInterface.php
@@ -3,13 +3,12 @@
* Created by PhpStorm.
* User: Administrator
* Date: 2018/11/8
- * Time: 16:03
+ * Time: 16:03.
*/
namespace Sockstack\DesignPattern\FactoryMethod\Sample\Interfaces;
-
interface ProductInterface
{
public function action();
-}
\ No newline at end of file
+}
diff --git a/tests/FactoryMethodText.php b/tests/FactoryMethodText.php
index 1ca8af6..d727107 100644
--- a/tests/FactoryMethodText.php
+++ b/tests/FactoryMethodText.php
@@ -3,12 +3,11 @@
* Created by PhpStorm.
* User: Administrator
* Date: 2018/11/8
- * Time: 16:09
+ * Time: 16:09.
*/
namespace Sockstack\DesignPattern\Test;
-
use PHPUnit\Framework\TestCase;
use Sockstack\DesignPattern\FactoryMethod\Sample\Implemention\SUV;
use Sockstack\DesignPattern\FactoryMethod\Sample\Implemention\SUVFactory;
@@ -25,4 +24,4 @@ public function testFactoryMethod()
$taxi = TaxiFactory::create();
$this->assertTrue($taxi instanceof Taxi);
}
-}
\ No newline at end of file
+}
From bca96f76d5d372541590e7df5f3291e3f3d59ba1 Mon Sep 17 00:00:00 2001
From: sockstack <85564748@qq.com>
Date: Thu, 8 Nov 2018 20:44:39 +0800
Subject: [PATCH 11/11] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E4=BA=86=E6=A8=A1?=
=?UTF-8?q?=E6=8B=9F=E6=B5=8B=E8=AF=95=E7=B1=BB?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
composer.json | 3 ++-
tests/{FactoryMethodText.php => FactoryMethodTest.php} | 2 +-
2 files changed, 3 insertions(+), 2 deletions(-)
rename tests/{FactoryMethodText.php => FactoryMethodTest.php} (94%)
diff --git a/composer.json b/composer.json
index a961ea4..65f6a76 100644
--- a/composer.json
+++ b/composer.json
@@ -9,7 +9,8 @@
}
],
"require": {
- "phpunit/phpunit": "~5"
+ "phpunit/phpunit": "~5.7.0",
+ "mockery/mockery": "^1.2"
},
"autoload": {
"psr-4": {
diff --git a/tests/FactoryMethodText.php b/tests/FactoryMethodTest.php
similarity index 94%
rename from tests/FactoryMethodText.php
rename to tests/FactoryMethodTest.php
index d727107..d0190dd 100644
--- a/tests/FactoryMethodText.php
+++ b/tests/FactoryMethodTest.php
@@ -14,7 +14,7 @@
use Sockstack\DesignPattern\FactoryMethod\Sample\Implemention\Taxi;
use Sockstack\DesignPattern\FactoryMethod\Sample\Implemention\TaxiFactory;
-class FactoryMethodText extends TestCase
+class FactoryMethodTest extends TestCase
{
public function testFactoryMethod()
{