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()