clean install

This commit is contained in:
2024-12-10 15:08:16 +01:00
commit e14eb2d8fd
31193 changed files with 3555714 additions and 0 deletions

View File

@@ -0,0 +1,33 @@
<?php
namespace Drupal\subrequests_test\Controller;
use Drupal\Core\Cache\CacheableJsonResponse;
use Drupal\Core\Controller\ControllerBase;
/**
* A controller returning simple responses for testing.
*/
class TestController extends ControllerBase {
/**
* Returns a JSON response that says "Alfa".
*
* @return \Drupal\Core\Cache\CacheableJsonResponse
* The response object.
*/
public function alpha(): CacheableJsonResponse {
return new CacheableJsonResponse('Alfa');
}
/**
* Returns a JSON response that says "Brava!".
*
* @return \Drupal\Core\Cache\CacheableJsonResponse
* The response object.
*/
public function bravo(): CacheableJsonResponse {
return new CacheableJsonResponse('Brava!');
}
}

View File

@@ -0,0 +1,50 @@
<?php
namespace Drupal\subrequests_test;
use Drupal\Core\PageCache\RequestPolicyInterface;
use Drupal\Core\State\StateInterface;
use Symfony\Component\HttpFoundation\Request;
/**
* A request policy that returns a specific pre-set value.
*/
class TestPolicy implements RequestPolicyInterface {
/**
* The state service.
*
* @var \Drupal\Core\State\StateInterface
*/
protected $state;
/**
* Constructs a TestPolicy object.
*
* @param \Drupal\Core\State\StateInterface $state
* State service.
*/
public function __construct(StateInterface $state) {
$this->state = $state;
}
/**
* Sets the value this policy will return.
*
* @param string|null $value
* The value this policy will return. Should be one of the ALLOW or DENY
* constants of \Drupal\Core\PageCache\RequestPolicyInterface, or NULL
* to have no opinion.
*/
public static function setValue(?string $value): void {
\Drupal::state()->set('subrequests_test_request_policy', $value);
}
/**
* {@inheritdoc}
*/
public function check(Request $request) {
return $this->state->get('subrequests_test_request_policy');
}
}

View File

@@ -0,0 +1,11 @@
name: 'Subrequests Test'
type: module
package: Testing
description: Provides routes for functional tests of Subrequests.
dependencies:
- subrequests:subrequests
# Information added by Drupal.org packaging script on 2024-08-06
version: '3.0.12'
project: 'subrequests'
datestamp: 1722952641

View File

@@ -0,0 +1,15 @@
subrequests_test.alpha:
path: '/subrequests-test/alpha'
defaults:
_controller: '\Drupal\subrequests_test\Controller\TestController::alpha'
requirements:
# Allowed for testing.
_access: 'TRUE'
subrequests_test.bravo:
path: '/subrequests-test/bravo'
defaults:
_controller: '\Drupal\subrequests_test\Controller\TestController::bravo'
requirements:
# Allowed for testing.
_access: 'TRUE'

View File

@@ -0,0 +1,6 @@
services:
subrequests_test.request_policy:
class: Drupal\subrequests_test\TestPolicy
arguments: ['@state']
tags:
- { name: page_cache_request_policy }