Skip to content
Snippets Groups Projects
Commit 6f425c20 authored by Stefan Auditor's avatar Stefan Auditor Committed by Kristof De Jaeger
Browse files

Issue #3411635 by swentel: Fix tests and add gitlab-ci file

parent 110898a3
No related branches found
Tags 1.0.0-alpha18
1 merge request!27Adds gitlab ci template and rebuilds container to activate default language
Pipeline #70469 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: $_GITLAB_TEMPLATES_REF
file:
- '/includes/include.drupalci.main.yml'
# EXPERIMENTAL: 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'
################
# 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/1.0.x/includes/include.drupalci.variables.yml
################
# variables:
# SKIP_ESLINT: '1'
###################################################################################
#
# *
# /(
# ((((,
# /(((((((
# ((((((((((*
# ,(((((((((((((((
# ,(((((((((((((((((((
# ((((((((((((((((((((((((*
# *(((((((((((((((((((((((((((((
# ((((((((((((((((((((((((((((((((((*
# *(((((((((((((((((( .((((((((((((((((((
# ((((((((((((((((((. /(((((((((((((((((*
# /((((((((((((((((( .(((((((((((((((((,
# ,(((((((((((((((((( ((((((((((((((((((
# .(((((((((((((((((((( .(((((((((((((((((
# ((((((((((((((((((((((( ((((((((((((((((/
# (((((((((((((((((((((((((((/ ,(((((((((((((((*
# .((((((((((((((/ /(((((((((((((. ,(((((((((((((((
# *(((((((((((((( ,(((((((((((((/ *((((((((((((((.
# ((((((((((((((, /(((((((((((((. ((((((((((((((,
# (((((((((((((/ ,(((((((((((((* ,(((((((((((((,
# *((((((((((((( .((((((((((((((( ,(((((((((((((
# ((((((((((((/ /((((((((((((((((((. ,((((((((((((/
# ((((((((((((( *(((((((((((((((((((((((* *((((((((((((
# ((((((((((((( ,(((((((((((((..((((((((((((( *((((((((((((
# ((((((((((((, /((((((((((((* /((((((((((((/ ((((((((((((
# ((((((((((((( /((((((((((((/ (((((((((((((* ((((((((((((
# (((((((((((((/ /(((((((((((( ,((((((((((((, *((((((((((((
# (((((((((((((( *(((((((((((/ *((((((((((((. ((((((((((((/
# *((((((((((((((((((((((((((, /(((((((((((((((((((((((((
# ((((((((((((((((((((((((( ((((((((((((((((((((((((,
# .(((((((((((((((((((((((/ ,(((((((((((((((((((((((
# ((((((((((((((((((((((/ ,(((((((((((((((((((((/
# *((((((((((((((((((((( (((((((((((((((((((((,
# ,(((((((((((((((((((((, ((((((((((((((((((((/
# ,(((((((((((((((((((((* /((((((((((((((((((((
# ((((((((((((((((((((((, ,/((((((((((((((((((((,
# ,(((((((((((((((((((((((((((((((((((((((((((((((((((
# .(((((((((((((((((((((((((((((((((((((((((((((
# .((((((((((((((((((((((((((((((((((((,.
# .,(((((((((((((((((((((((((.
#
###################################################################################
......@@ -138,6 +138,7 @@ abstract class ActivityPubTestBase extends BrowserTestBase {
protected function setupLanguage($language) {
ConfigurableLanguage::createFromLangcode($language)->save();
\Drupal::configFactory()->getEditable('system.site')->set('default_langcode', $language)->save();
$this->rebuildContainer();
}
/**
......
......@@ -66,9 +66,9 @@ class CommentTest extends ActivityPubTestBase {
];
$this->drupalGet('admin/config/services/activitypub');
$this->submitForm($edit, 'Save configuration');
$edit = ['existing_storage_name' => 'activitypub_activity', 'existing_storage_label' => 'Activity reference'];
$this->drupalGet('admin/structure/comment/manage/comment/fields/add-field');
$this->submitForm($edit, 'Save and continue');
$edit = [];
$this->drupalGet('admin/structure/comment/manage/comment/fields/reuse');
$this->submitForm($edit, 'Re-use');
$this->submitForm([], 'Save settings');
$this->drupalGet('admin/structure/comment/manage/comment/display');
$this->submitForm(['fields[activitypub_activity][region]' => 'hidden'], 'Save');
......
......@@ -2,7 +2,6 @@
namespace Drupal\Tests\activitypub\Functional;
use Drupal\activitypub\Entity\ActivityPubActivityInterface;
use Drupal\Core\Url;
/**
......@@ -77,4 +76,4 @@ class InboxTest extends ActivityPubTestBase {
self::assertEquals($stored_payload['object']['content'], $payload['object']['content']);
}
}
\ No newline at end of file
}
<?php
namespace Drupal\Tests\activitypub\Functional;
/**
* Tests Webfinger localized..
*
* @group activitypub
*/
class WebfingerLocalizedTest extends WebfingerTest {
/**
* {@inheritdoc}
*/
protected static $modules = [
'language',
];
/**
* {@inheritdoc}
*/
protected function setUp($language = NULL): void {
parent::setUp();
$this->setupLanguage('es');
}
/**
* Test webfinger response.
*
* @throws \Behat\Mink\Exception\ExpectationException
*/
public function testWebfingerResponse() {
$this->testWebfingerResponseHelper();
}
}
<?php
namespace Drupal\Tests\activitypub\Functional;
use Drupal\Core\Url;
/**
* Tests Webfinger functionality.
*
* @group activitypub
*/
class WebfingerTest extends ActivityPubTestBase {
/**
* Test webfinger response.
*
* @throws \Behat\Mink\Exception\ExpectationException
*/
public function testWebfingerResponse() {
$this->testWebfingerResponseHelper();
}
/**
* Test webfinger response helper.
*
* @throws \Behat\Mink\Exception\ExpectationException
*/
protected function testWebfingerResponseHelper() {
$assert_session = $this->assertSession();
$page = $this->getSession()->getPage();
$this->enableActivityPub($assert_session);
$this->drupalLogout();
$this->drupalGet('.well-known/webfinger');
$assert_session->statusCodeEquals(404);
$assert_session->responseHeaderContains('Content-Type', 'application/jrd+json; charset=utf-8');
$resource = $this->getResourceUrl($this->accountNameOne);
$this->drupalGet('.well-known/webfinger', ['query' => ['resource' => $resource]]);
$assert_session->statusCodeEquals(200);
$content = json_decode($page->getContent());
self::assertEquals(Url::fromRoute('entity.user.canonical', ['user' => $this->authenticatedUserOne->id()], ['absolute' => TRUE])->toString(), $content->aliases[0]);
$resource = $this->getResourceUrl($this->accountNameOne, FALSE);
$this->drupalGet('.well-known/webfinger', ['query' => ['resource' => $resource]]);
$assert_session->statusCodeEquals(200);
$content = json_decode($page->getContent());
self::assertEquals(Url::fromRoute('entity.user.canonical', ['user' => $this->authenticatedUserOne->id()], ['absolute' => TRUE])->toString(), $content->aliases[0]);
}
}
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