From b017b7ee898e518f996b31efdf5a625dfb114ac1 Mon Sep 17 00:00:00 2001 From: zyimm Date: Thu, 23 Sep 2021 15:13:55 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BE=9D=E8=B5=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- composer.json | 2 ++ src/Pool/PoolFactory.php | 6 +++++- tests/MongoTest.php | 2 +- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/composer.json b/composer.json index cbe6630..ae9243e 100644 --- a/composer.json +++ b/composer.json @@ -9,9 +9,11 @@ ], "require": { "php": ">=7.2", + "hyperf/framework": "~2.1.0", "psr/container": "^1.0", "hyperf/pool": "^2.0", "hyperf/utils": "^2.0.0", + "hyperf/di": "^2.0.0", "ext-mongodb": "*" }, "require-dev": { diff --git a/src/Pool/PoolFactory.php b/src/Pool/PoolFactory.php index 63e645a..f9f9753 100644 --- a/src/Pool/PoolFactory.php +++ b/src/Pool/PoolFactory.php @@ -4,6 +4,7 @@ namespace Hyperf\Mongodb\Pool; use Hyperf\Di\Container; +use Hyperf\Di\Exception\NotFoundException; use Psr\Container\ContainerInterface; use Swoole\Coroutine\Channel; @@ -24,7 +25,10 @@ class PoolFactory $this->container = $container; } - public function getPool(string $name): MongoDBPool + /** + * @throws NotFoundException + */ + public function getPool(string $name): Channel { if (isset($this->pools[$name])) { return $this->pools[$name]; diff --git a/tests/MongoTest.php b/tests/MongoTest.php index 15d1dfe..e3563ce 100644 --- a/tests/MongoTest.php +++ b/tests/MongoTest.php @@ -4,7 +4,7 @@ namespace Zyimm\Test; class MongoTest extends \PHPUnit\Framework\TestCase { - public function testfindALL() + public function testFindALL() { $this->assertArrayHasKey('error_code', Sdk::instance($this->config()) ->service()