Added test cases.

This commit is contained in:
李铭昕 2021-04-16 16:43:26 +08:00
parent 500d83af5e
commit 4fa2e2367c
4 changed files with 17 additions and 2 deletions

View File

@ -1,5 +1,9 @@
# v2.1.15 - TBD # v2.1.15 - TBD
## Added
- [#3484](https://github.com/hyperf/hyperf/pull/3484) Added methods `withMax()` `withMin()` `withSum()` and `withAvg()`.
# v2.1.14 - 2021-04-12 # v2.1.14 - 2021-04-12
## Fixed ## Fixed

View File

@ -2,12 +2,12 @@
# v2.1.14 - 2021-04-12 # v2.1.14 - 2021-04-12
## Fixed ## 修复
- [#3465](https://github.com/hyperf/hyperf/pull/3465) 修复协程风格下,`WebSocket` 服务不支持配置多个端口的问题。 - [#3465](https://github.com/hyperf/hyperf/pull/3465) 修复协程风格下,`WebSocket` 服务不支持配置多个端口的问题。
- [#3467](https://github.com/hyperf/hyperf/pull/3467) 修复协程风格下,`WebSocket` 服务无法正常释放连接池的问题。 - [#3467](https://github.com/hyperf/hyperf/pull/3467) 修复协程风格下,`WebSocket` 服务无法正常释放连接池的问题。
## Added ## 新增
- [#3472](https://github.com/hyperf/hyperf/pull/3472) 新增方法 `Sender::getResponse()`,可以在协程风格的 `WebSocket` 服务里,获得与 `fd` 一一对应的 `Response` 对象。 - [#3472](https://github.com/hyperf/hyperf/pull/3472) 新增方法 `Sender::getResponse()`,可以在协程风格的 `WebSocket` 服务里,获得与 `fd` 一一对应的 `Response` 对象。

View File

@ -336,6 +336,8 @@ abstract class Relation
/** /**
* Get a relationship join table hash. * Get a relationship join table hash.
* *
* For safety, The relationship ensures this method is only used in the same coroutine.
*
* @return string * @return string
*/ */
public function getRelationCountHash(bool $incrementJoinCount = true) public function getRelationCountHash(bool $incrementJoinCount = true)

View File

@ -681,6 +681,15 @@ class ModelBuilderTest extends TestCase
$this->assertEquals('select "model_builder_test_model_parent_stubs".*, (select count(*) from "model_builder_test_model_close_related_stubs" where "model_builder_test_model_parent_stubs"."foo_id" = "model_builder_test_model_close_related_stubs"."id") as "foo_count" from "model_builder_test_model_parent_stubs"', $builder->toSql()); $this->assertEquals('select "model_builder_test_model_parent_stubs".*, (select count(*) from "model_builder_test_model_close_related_stubs" where "model_builder_test_model_parent_stubs"."foo_id" = "model_builder_test_model_close_related_stubs"."id") as "foo_count" from "model_builder_test_model_parent_stubs"', $builder->toSql());
} }
public function testWithMax()
{
$model = new ModelBuilderTestModelParentStub();
$builder = $model->withMax('foo', 'id');
$this->assertEquals('select "model_builder_test_model_parent_stubs".*, (select max("model_builder_test_model_close_related_stubs"."id") from "model_builder_test_model_close_related_stubs" where "model_builder_test_model_parent_stubs"."foo_id" = "model_builder_test_model_close_related_stubs"."id") as "foo_max_id" from "model_builder_test_model_parent_stubs"', $builder->toSql());
}
public function testWithCountAndSelect() public function testWithCountAndSelect()
{ {
$model = new ModelBuilderTestModelParentStub(); $model = new ModelBuilderTestModelParentStub();