Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class HiddenLocationExceptionSubscriberSpec extends ObjectBehavior
public function let(
LocationTagger $locationTagger,
ContentInfoTagger $contentInfoTagger
) {
): void {
$this->beConstructedWith($locationTagger, $contentInfoTagger);
}

Expand All @@ -35,7 +35,7 @@ public function it_tags_on_hidden_location_exception(
Location $location,
ContentInfo $contentInfo,
HiddenLocationException $exception
) {
): void {
$exception->getLocation()->willReturn($location);
$location->getContentInfo()->willReturn($contentInfo);
$locationTagger->tag($location)->willReturn($locationTagger);
Expand All @@ -61,7 +61,7 @@ public function it_does_not_tag_on_other_exceptions(
LocationTagger $locationTagger,
ContentInfoTagger $contentInfoTagger,
\Exception $exception
) {
): void {
$event = new ExceptionEvent(
$kernel->getWrappedObject(),
$request->getWrappedObject(),
Expand Down
8 changes: 4 additions & 4 deletions spec/EventSubscriber/HttpCacheResponseSubscriberSpec.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public function let(
ParameterBag $requestAttributes,
ResponseCacheConfigurator $configurator,
ResponseTagger $dispatcherTagger
) {
): void {
$request->attributes = $requestAttributes;

$this->beConstructedWith($configurator, $dispatcherTagger);
Expand All @@ -39,7 +39,7 @@ public function it_does_not_enable_cache_if_the_view_is_not_a_cachableview(
ResponseCacheConfigurator $configurator,
ParameterBag $requestAttributes,
View $nonCachableView
) {
): void {
$requestAttributes->get('view')->willReturn($nonCachableView);

$event = new ResponseEvent(
Expand All @@ -61,7 +61,7 @@ public function it_does_not_enable_cache_if_it_is_disabled_in_the_view(
ResponseCacheConfigurator $configurator,
CachableView $view,
ParameterBag $requestAttributes
) {
): void {
$requestAttributes->get('view')->willReturn($view);
$view->isCacheEnabled()->willReturn(false);

Expand All @@ -85,7 +85,7 @@ public function it_enables_cache(
CachableView $view,
ParameterBag $requestAttributes,
ResponseTagger $dispatcherTagger
) {
): void {
$requestAttributes->get('view')->willReturn($view);
$view->isCacheEnabled()->willReturn(true);

Expand Down
24 changes: 12 additions & 12 deletions spec/EventSubscriber/RestKernelViewSubscriberSpec.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public function let(
Request $request,
ParameterBag $attributes,
ResponseTagger $tagHandler
) {
): void {
$request->attributes = $attributes;

$this->beConstructedWith($tagHandler);
Expand All @@ -42,7 +42,7 @@ public function it_does_nothing_on_uncachable_methods(
Request $request,
Response $response,
ParameterBag $attributes
) {
): void {
$request->isMethodCacheable()->willReturn(false);
$attributes->get(new AnyValueToken())->shouldNotBeCalled();

Expand All @@ -61,7 +61,7 @@ public function it_does_nothing_on_non_rest_requests(
Request $request,
Response $response,
ParameterBag $attributes
) {
): void {
$request->isMethodCacheable()->willReturn(true);
$attributes->get('is_rest_request')->willReturn(false);

Expand All @@ -84,7 +84,7 @@ public function it_writes_tags_on_section(
ParameterBag $attributes,
Section $restValue,
ResponseTagger $tagHandler
) {
): void {
$restValue->beConstructedWith([['id' => 5]]);

$request->isMethodCacheable()->willReturn(true);
Expand Down Expand Up @@ -112,7 +112,7 @@ public function it_does_nothing_on_content_type_draft(
ParameterBag $attributes,
ContentType $restValue,
ResponseTagger $tagHandler
) {
): void {
$restValue->beConstructedWith([['status' => ContentType::STATUS_DRAFT]]);

$request->isMethodCacheable()->willReturn(true);
Expand All @@ -136,7 +136,7 @@ public function it_writes_tags_on_content_type_defined(
ParameterBag $attributes,
ContentType $restValue,
ResponseTagger $tagHandler
) {
): void {
$restValue->beConstructedWith([['id' => 4, 'status' => ContentType::STATUS_DEFINED]]);

$request->isMethodCacheable()->willReturn(true);
Expand Down Expand Up @@ -164,7 +164,7 @@ public function it_does_nothing_on_rest_content_type_draft(
RestContentType $restValue,
ContentType $contentType,
ResponseTagger $tagHandler
) {
): void {
$contentType->beConstructedWith([['status' => ContentType::STATUS_DRAFT]]);
$restValue->contentType = $contentType;

Expand All @@ -190,7 +190,7 @@ public function it_writes_tags_on_rest_content_type_defined(
RestContentType $restValue,
ContentType $contentType,
ResponseTagger $tagHandler
) {
): void {
$contentType->beConstructedWith([['id' => 4, 'status' => ContentType::STATUS_DEFINED]]);
$restValue->contentType = $contentType;

Expand Down Expand Up @@ -220,7 +220,7 @@ public function it_does_nothing_on_rest_content_type_group_ref_draft(
ContentType $contentType,
ContentTypeGroup $contentTypeGroup,
ResponseTagger $tagHandler
) {
): void {
$contentType->beConstructedWith([['status' => ContentType::STATUS_DRAFT]]);
$restValue->contentType = $contentType;
$restValue->contentTypeGroups = [$contentTypeGroup];
Expand Down Expand Up @@ -248,7 +248,7 @@ public function it_writes_tags_on_rest_content_type_group_ref_defined(
ContentType $contentType,
ContentTypeGroup $contentTypeGroup,
ResponseTagger $tagHandler
) {
): void {
$contentType->beConstructedWith([['id' => 4, 'status' => ContentType::STATUS_DEFINED]]);
$restValue->contentType = $contentType;

Expand Down Expand Up @@ -280,7 +280,7 @@ public function it_writes_tags_on_rest_content_type_group_list(
ContentTypeGroupList $restValue,
ContentTypeGroup $contentTypeGroup,
ResponseTagger $tagHandler
) {
): void {
$contentTypeGroup->beConstructedWith([['id' => 2]]);
$restValue->contentTypeGroups = [$contentTypeGroup];

Expand Down Expand Up @@ -310,7 +310,7 @@ public function it_writes_tags_on_rest_version_list(
VersionInfo $versionInfo,
ContentInfo $contentInfo,
ResponseTagger $tagHandler
) {
): void {
$contentInfo->beConstructedWith([['id' => 33]]);
$versionInfo->beConstructedWith([['contentInfo' => $contentInfo]]);
$restValue->versions = [$versionInfo];
Expand Down
14 changes: 7 additions & 7 deletions spec/EventSubscriber/UserContextSubscriberSpec.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,13 @@ public function let(
RepositoryTagPrefix $prefixService,
Response $response,
ResponseHeaderBag $responseHeaders
) {
): void {
$response->headers = $responseHeaders;

$this->beConstructedWith($prefixService, 'xkey');
}

public function it_is_initializable()
public function it_is_initializable(): void
{
$this->shouldHaveType(UserContextSubscriber::class);
}
Expand All @@ -40,7 +40,7 @@ public function it_does_nothing_on_uncachable_methods(
Request $request,
Response $response,
ResponseHeaderBag $responseHeaders
) {
): void {
$response->getTtl()->shouldNotBecalled();
$response->isCacheable()->willReturn(false);

Expand All @@ -62,7 +62,7 @@ public function it_does_nothing_on_wrong_content_type(
Request $request,
Response $response,
ResponseHeaderBag $responseHeaders
) {
): void {
$response->isCacheable()->willReturn(true);
$responseHeaders->get(Argument::exact('Content-Type'))->willReturn('text/html');

Expand All @@ -84,7 +84,7 @@ public function it_does_nothing_on_empty_ttl(
Request $request,
Response $response,
ResponseHeaderBag $responseHeaders
) {
): void {
$response->isCacheable()->willReturn(true);
$responseHeaders->get(Argument::exact('Content-Type'))->willReturn('application/vnd.fos.user-context-hash');
$response->getTtl()->willReturn(0);
Expand All @@ -107,7 +107,7 @@ public function it_tags_response_with_no_prefix(
Response $response,
ResponseHeaderBag $responseHeaders,
RepositoryTagPrefix $prefixService
) {
): void {
$response->isCacheable()->willReturn(true);
$responseHeaders->get(Argument::exact('Content-Type'))->willReturn('application/vnd.fos.user-context-hash');
$response->getTtl()->willReturn(100);
Expand All @@ -131,7 +131,7 @@ public function it_tags_response_with_a_prefix(
Response $response,
ResponseHeaderBag $responseHeaders,
RepositoryTagPrefix $prefixService
) {
): void {
$response->isCacheable()->willReturn(true);
$responseHeaders->get(Argument::exact('Content-Type'))->willReturn('application/vnd.fos.user-context-hash');
$response->getTtl()->willReturn(100);
Expand Down
10 changes: 5 additions & 5 deletions spec/EventSubscriber/XLocationIdResponseSubscriberSpec.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public function let(
ResponseTagger $tagHandler,
Repository $repository,
ResponseHeaderBag $responseHeaders
) {
): void {
$response->headers = $responseHeaders;

$this->beConstructedWith($tagHandler, $repository);
Expand All @@ -38,7 +38,7 @@ public function it_does_not_rewrite_header_if_there_is_none(
Request $request,
Response $response,
ResponseHeaderBag $responseHeaders
) {
): void {
$responseHeaders->has('X-Location-Id')->willReturn(false);
$responseHeaders->set()->shouldNotBecalled();

Expand All @@ -59,7 +59,7 @@ public function it_rewrite_header_with_location_info(
ResponseTagger $tagHandler,
Repository $repository,
ResponseHeaderBag $responseHeaders
) {
): void {
$responseHeaders->has('X-Location-Id')->willReturn(true);
$responseHeaders->get('X-Location-Id')->willReturn('123');

Expand Down Expand Up @@ -103,7 +103,7 @@ public function it_rewrite_header_on_not_found_location(
ResponseTagger $tagHandler,
Repository $repository,
ResponseHeaderBag $responseHeaders
) {
): void {
$responseHeaders->has('X-Location-Id')->willReturn(true);
$responseHeaders->get('X-Location-Id')->willReturn('123');

Expand Down Expand Up @@ -131,7 +131,7 @@ public function it_rewrite_header_also_in_unofficial_plural_form_and_merges_exis
ResponseTagger $tagHandler,
Repository $repository,
ResponseHeaderBag $responseHeaders
) {
): void {
$responseHeaders->has('X-Location-Id')->willReturn(true);
$responseHeaders->get('X-Location-Id')->willReturn('123,34');

Expand Down
Loading
Loading