Skip to content
Snippets Groups Projects
Commit 70f38c57 authored by Adam Bramley's avatar Adam Bramley Committed by dpi
Browse files

Issue #3452035 by dpi, acbramley: :arrow_up: Drupal 11 compatibility

parent f83d86bd
No related branches found
No related tags found
1 merge request!7Issue #3452035: Drupal 11
Pipeline #281141 passed with warnings
################
# DrupalCI GitLabCI template
#
# Gitlab-ci.yml to replicate DrupalCI testing for Contrib
#
# With thanks to:
# * The GitLab Acceleration Initiative participants
# * DrupalSpoons
################
################
# Guidelines
#
# This template is designed to give any Contrib maintainer everything they need to test, without requiring modification. It is also designed to keep up to date with Core Development automatically through the use of include files that can be centrally maintained.
#
# However, you can modify this template if you have additional needs for your project.
################
################
# Includes
#
# Additional configuration can be provided through includes.
# One advantage of include files is that if they are updated upstream, the changes affect all pipelines using that include.
#
# Includes can be overridden by re-declaring anything provided in an include, here in gitlab-ci.yml
# https://docs.gitlab.com/ee/ci/yaml/includes.html#override-included-configuration-values
################
include:
################
# DrupalCI includes:
# As long as you include this, any future includes added by the Drupal Association will be accessible to your pipelines automatically.
# View these include files at https://git.drupalcode.org/project/gitlab_templates/
################
- project: $_GITLAB_TEMPLATES_REPO
# "ref" value can be:
# - Recommended (default) - `ref: $_GITLAB_TEMPLATES_REF` - The Drupal Association will update this value to the recommended tag for contrib.
# - Latest - `ref: main` - Get the latest additions and bug fixes as they are merged into the templates.
# - Minor or Major latests - `ref: 1.x-latest` or `ref: 1.0.x-latest` - Get the latest additions within a minor (mostly bugfixes) or major (bugs and new features).
# - Fixed tag - `ref: 1.0.1` - Set the value to a known tag. This will not get any updates.
# If you change the default value of ref, you should set the _CURL_TEMPLATES_REF variable in the variables section to be the same as set here.
ref: $_GITLAB_TEMPLATES_REF
file:
- '/includes/include.drupalci.main.yml'
# For Drupal 7, remove the above line and uncomment the below.
# - '/includes/include.drupalci.main-d7.yml'
- '/includes/include.drupalci.variables.yml'
- '/includes/include.drupalci.workflows.yml'
# https://git.drupalcode.org/project/gitlab_templates/-/blob/main/includes/include.drupalci.main.yml#L355
composer:
.pintoComposerJob:
# https://docs.gitlab.com/ee/ci/yaml/#extends
extends: .composer-base
after_script:
......@@ -71,69 +28,23 @@ composer:
- |
composer config repositories.local-path '{"type": "path", "url": "/builds/project/pinto/web/modules/custom/pinto"}'
- composer require drupal/pinto
- rm composer.lock
# https://git.drupalcode.org/project/gitlab_templates/-/blob/main/includes/include.drupalci.main.yml#L355
composer:
# https://docs.gitlab.com/ee/ci/yaml/#extends
extends: .pintoComposerJob
################
# Pipeline configuration variables
#
# These are the variables provided to the Run Pipeline form that a user may want to override.
#
# Docs at https://git.drupalcode.org/project/gitlab_templates/-/blob/main/includes/include.drupalci.variables.yml
################
# variables:
# SKIP_ESLINT: '1'
# OPT_IN_TEST_NEXT_MAJOR: '1'
# _CURL_TEMPLATES_REF: 'main'
composer (next major):
extends: .pintoComposerJob
composer (next minor):
extends: .pintoComposerJob
variables:
OPT_IN_TEST_NEXT_MAJOR: '1'
OPT_IN_TEST_NEXT_MINOR: '1'
SKIP_ESLINT: '1'
_TARGET_PHP: $CORE_PHP_MAX
# https://git.drupalcode.org/project/gitlab_templates/-/blob/main/includes/include.drupalci.variables.yml
_CSPELL_IGNORE_PATHS: '"LICENSE.md", "composer.json"'
###################################################################################
#
# *
# /(
# ((((,
# /(((((((
# ((((((((((*
# ,(((((((((((((((
# ,(((((((((((((((((((
# ((((((((((((((((((((((((*
# *(((((((((((((((((((((((((((((
# ((((((((((((((((((((((((((((((((((*
# *(((((((((((((((((( .((((((((((((((((((
# ((((((((((((((((((. /(((((((((((((((((*
# /((((((((((((((((( .(((((((((((((((((,
# ,(((((((((((((((((( ((((((((((((((((((
# .(((((((((((((((((((( .(((((((((((((((((
# ((((((((((((((((((((((( ((((((((((((((((/
# (((((((((((((((((((((((((((/ ,(((((((((((((((*
# .((((((((((((((/ /(((((((((((((. ,(((((((((((((((
# *(((((((((((((( ,(((((((((((((/ *((((((((((((((.
# ((((((((((((((, /(((((((((((((. ((((((((((((((,
# (((((((((((((/ ,(((((((((((((* ,(((((((((((((,
# *((((((((((((( .((((((((((((((( ,(((((((((((((
# ((((((((((((/ /((((((((((((((((((. ,((((((((((((/
# ((((((((((((( *(((((((((((((((((((((((* *((((((((((((
# ((((((((((((( ,(((((((((((((..((((((((((((( *((((((((((((
# ((((((((((((, /((((((((((((* /((((((((((((/ ((((((((((((
# ((((((((((((( /((((((((((((/ (((((((((((((* ((((((((((((
# (((((((((((((/ /(((((((((((( ,((((((((((((, *((((((((((((
# (((((((((((((( *(((((((((((/ *((((((((((((. ((((((((((((/
# *((((((((((((((((((((((((((, /(((((((((((((((((((((((((
# ((((((((((((((((((((((((( ((((((((((((((((((((((((,
# .(((((((((((((((((((((((/ ,(((((((((((((((((((((((
# ((((((((((((((((((((((/ ,(((((((((((((((((((((/
# *((((((((((((((((((((( (((((((((((((((((((((,
# ,(((((((((((((((((((((, ((((((((((((((((((((/
# ,(((((((((((((((((((((* /((((((((((((((((((((
# ((((((((((((((((((((((, ,/((((((((((((((((((((,
# ,(((((((((((((((((((((((((((((((((((((((((((((((((((
# .(((((((((((((((((((((((((((((((((((((((((((((
# .((((((((((((((((((((((((((((((((((((,.
# .,(((((((((((((((((((((((((.
#
###################################################################################
......@@ -4,7 +4,7 @@
"type": "drupal-module",
"require": {
"php": ">=8.2",
"drupal/core": "^10.1",
"drupal/core": "^10.2 || ^11",
"dpi/pinto": "^0 || ^1",
"thecodingmachine/safe": "^2.5"
},
......
name: Pinto
type: module
description: Theme object system
core_version_requirement: ^10.1
core_version_requirement: ^10.2 || ^11
php: 8.2
<?php
declare(strict_types=1);
namespace Drupal\pinto_test\Pinto\Generic;
use Drupal\pinto\Object\DrupalObjectTrait;
use Pinto\Attribute\Asset\Css;
use Pinto\Attribute\Asset\Js;
use Pinto\Attribute\ThemeDefinition;
/**
* All purpose test object.
*/
#[Css('styles.css')]
#[Js('app.js')]
final class Generic {
use DrupalObjectTrait;
/**
* Constructor.
*/
private function __construct(
readonly string $text,
) {
}
/**
* Creates a new object.
*/
public static function create(
string $text,
): static {
return new static($text);
}
public function __invoke(): mixed {
return $this->pintoBuild(function (mixed $build): mixed {
return $build + [
'#test_text' => $this->text,
];
});
}
#[ThemeDefinition]
public static function theme(): array {
return [
'variables' => [
'test_text' => NULL,
],
];
}
}
......@@ -18,7 +18,7 @@ enum Objects: string implements ObjectListInterface {
use ObjectListTrait;
#[Definition(ObjectTest::class)]
#[Definition(Generic::class)]
case ObjectTest = 'object_test';
#[Definition(ObjectThemeDefinitionClass::class)]
......
......@@ -14,7 +14,7 @@ use Pinto\Attribute\ThemeDefinition;
*/
#[Css('styles.css')]
#[Js('app.js')]
final class ObjectTest {
final class TestObject {
use DrupalObjectTrait;
......
......@@ -5,7 +5,7 @@ declare(strict_types=1);
namespace Drupal\pinto_test_routes\Controller;
use Drupal\Core\Controller\ControllerBase;
use Drupal\pinto_test\Pinto\Generic\ObjectTest;
use Drupal\pinto_test\Pinto\Generic\Generic;
final class ObjectTestController extends ControllerBase {
......@@ -13,7 +13,7 @@ final class ObjectTestController extends ControllerBase {
return [
// Direct invoke.
// Avoids invocation via Renderer.
'foo' => ObjectTest::create('foo bar!')(),
'foo' => Generic::create('foo bar!')(),
];
}
......
......@@ -32,7 +32,7 @@ final class PintoTest extends BrowserTestBase {
* Test direct invocation of a theme object.
*
* @see \Drupal\pinto_test_routes\Controller\ObjectTestController::__invoke
* @see \Drupal\pinto_test\Pinto\Generic\ObjectTest
* @see \Drupal\pinto_test\Pinto\Generic\Generic
* @see \Drupal\pinto_test\Pinto\Generic\Objects
*/
public function testDirectInvocation(): void {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment