mirror of
https://github.com/flarum/core.git
synced 2025-08-04 07:27:39 +02:00
fix: typing
This commit is contained in:
@@ -59,9 +59,9 @@ class ListDiscussionsTest extends TestCase
|
|||||||
$this->request('GET', '/api/discussions')
|
$this->request('GET', '/api/discussions')
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->assertEquals(200, $response->getStatusCode());
|
$this->assertEquals(200, $response->getStatusCode(), $body = $response->getBody()->getContents());
|
||||||
|
|
||||||
$data = json_decode($response->getBody()->getContents(), true);
|
$data = json_decode($body, true);
|
||||||
|
|
||||||
$this->assertEqualsCanonicalizing([3, 1, 2, 4], Arr::pluck($data['data'], 'id'));
|
$this->assertEqualsCanonicalizing([3, 1, 2, 4], Arr::pluck($data['data'], 'id'));
|
||||||
}
|
}
|
||||||
@@ -75,9 +75,9 @@ class ListDiscussionsTest extends TestCase
|
|||||||
])
|
])
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->assertEquals(200, $response->getStatusCode());
|
$this->assertEquals(200, $response->getStatusCode(), $body = $response->getBody()->getContents());
|
||||||
|
|
||||||
$data = json_decode($response->getBody()->getContents(), true);
|
$data = json_decode($body, true);
|
||||||
|
|
||||||
$this->assertEqualsCanonicalizing([3, 1, 2, 4], Arr::pluck($data['data'], 'id'));
|
$this->assertEqualsCanonicalizing([3, 1, 2, 4], Arr::pluck($data['data'], 'id'));
|
||||||
}
|
}
|
||||||
@@ -91,9 +91,9 @@ class ListDiscussionsTest extends TestCase
|
|||||||
])
|
])
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->assertEquals(200, $response->getStatusCode());
|
$this->assertEquals(200, $response->getStatusCode(), $body = $response->getBody()->getContents());
|
||||||
|
|
||||||
$data = json_decode($response->getBody()->getContents(), true);
|
$data = json_decode($body, true);
|
||||||
|
|
||||||
$this->assertEqualsCanonicalizing([2, 4, 3, 1], Arr::pluck($data['data'], 'id'));
|
$this->assertEqualsCanonicalizing([2, 4, 3, 1], Arr::pluck($data['data'], 'id'));
|
||||||
}
|
}
|
||||||
@@ -111,9 +111,9 @@ class ListDiscussionsTest extends TestCase
|
|||||||
])
|
])
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->assertEquals(200, $response->getStatusCode());
|
$this->assertEquals(200, $response->getStatusCode(), $body = $response->getBody()->getContents());
|
||||||
|
|
||||||
$data = json_decode($response->getBody()->getContents(), true);
|
$data = json_decode($body, true);
|
||||||
|
|
||||||
$this->assertEqualsCanonicalizing([3, 1, 2, 4], Arr::pluck($data['data'], 'id'));
|
$this->assertEqualsCanonicalizing([3, 1, 2, 4], Arr::pluck($data['data'], 'id'));
|
||||||
}
|
}
|
||||||
|
@@ -32,6 +32,7 @@ use Flarum\Tags\Search\TagSearcher;
|
|||||||
use Flarum\Tags\Tag;
|
use Flarum\Tags\Tag;
|
||||||
use Flarum\Tags\Utf8SlugDriver;
|
use Flarum\Tags\Utf8SlugDriver;
|
||||||
use Illuminate\Database\Eloquent\Builder;
|
use Illuminate\Database\Eloquent\Builder;
|
||||||
|
use Illuminate\Database\Eloquent\Relations\Relation;
|
||||||
|
|
||||||
return [
|
return [
|
||||||
(new Extend\Frontend('forum'))
|
(new Extend\Frontend('forum'))
|
||||||
@@ -108,8 +109,8 @@ return [
|
|||||||
function (Endpoint\Index|Endpoint\Show|Endpoint\Create $endpoint) {
|
function (Endpoint\Index|Endpoint\Show|Endpoint\Create $endpoint) {
|
||||||
return $endpoint
|
return $endpoint
|
||||||
->addDefaultInclude(['tags', 'tags.parent'])
|
->addDefaultInclude(['tags', 'tags.parent'])
|
||||||
->eagerLoadWhere('tags', function (Builder $query, Context $context, array $relations) {
|
->eagerLoadWhere('tags', function (Builder|Relation $query, Context $context) {
|
||||||
/** @var Builder<Tag> $query */
|
/** @var Builder<Tag>|Relation $query */
|
||||||
$query->withStateFor($context->getActor());
|
$query->withStateFor($context->getActor());
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user