Skip to content
Snippets Groups Projects
Commit 8e360ade authored by Alex Pott's avatar Alex Pott
Browse files

Issue #3425718 by alexpott: Fix up gitlabci

parent 613d2e5e
No related branches found
No related tags found
1 merge request!42Fail pipeline if linting jobs fail
Pipeline #111812 passed
Showing
with 62 additions and 102 deletions
advancedqueue
epub
errorcode
firstname
karteinummer
messagetext
privateidentificationid
shorttext
vgwort
vgzm
webrange
webranges
ISNI
GNDID
ORCID
################
# 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:
......@@ -39,11 +11,6 @@ include:
- '/includes/include.drupalci.variables.yml'
- '/includes/include.drupalci.workflows.yml'
phpcs:
script:
- cp $_WEB_ROOT/core/phpcs.xml.dist ./
- vendor/bin/phpcs -s $_WEB_ROOT/modules/custom --report-junit=junit.xml --report-full --report-summary --report-source
################
# Pipeline configuration variables
#
......@@ -54,53 +21,22 @@ phpcs:
variables:
_PHPUNIT_CONCURRENT: "1"
_PHPUNIT_EXTRA: "--suppress-deprecations"
# @todo Fix stylelint and eslint in https://www.drupal.org/project/commerce_pos/issues/3392699
SKIP_STYLELINT: "1"
SKIP_ESLINT: "1"
SKIP_ESLINT: '1'
SKIP_STYLELINT: '1'
###################################################################################
#
# *
# /(
# ((((,
# /(((((((
# ((((((((((*
# ,(((((((((((((((
# ,(((((((((((((((((((
# ((((((((((((((((((((((((*
# *(((((((((((((((((((((((((((((
# ((((((((((((((((((((((((((((((((((*
# *(((((((((((((((((( .((((((((((((((((((
# ((((((((((((((((((. /(((((((((((((((((*
# /((((((((((((((((( .(((((((((((((((((,
# ,(((((((((((((((((( ((((((((((((((((((
# .(((((((((((((((((((( .(((((((((((((((((
# ((((((((((((((((((((((( ((((((((((((((((/
# (((((((((((((((((((((((((((/ ,(((((((((((((((*
# .((((((((((((((/ /(((((((((((((. ,(((((((((((((((
# *(((((((((((((( ,(((((((((((((/ *((((((((((((((.
# ((((((((((((((, /(((((((((((((. ((((((((((((((,
# (((((((((((((/ ,(((((((((((((* ,(((((((((((((,
# *((((((((((((( .((((((((((((((( ,(((((((((((((
# ((((((((((((/ /((((((((((((((((((. ,((((((((((((/
# ((((((((((((( *(((((((((((((((((((((((* *((((((((((((
# ((((((((((((( ,(((((((((((((..((((((((((((( *((((((((((((
# ((((((((((((, /((((((((((((* /((((((((((((/ ((((((((((((
# ((((((((((((( /((((((((((((/ (((((((((((((* ((((((((((((
# (((((((((((((/ /(((((((((((( ,((((((((((((, *((((((((((((
# (((((((((((((( *(((((((((((/ *((((((((((((. ((((((((((((/
# *((((((((((((((((((((((((((, /(((((((((((((((((((((((((
# ((((((((((((((((((((((((( ((((((((((((((((((((((((,
# .(((((((((((((((((((((((/ ,(((((((((((((((((((((((
# ((((((((((((((((((((((/ ,(((((((((((((((((((((/
# *((((((((((((((((((((( (((((((((((((((((((((,
# ,(((((((((((((((((((((, ((((((((((((((((((((/
# ,(((((((((((((((((((((* /((((((((((((((((((((
# ((((((((((((((((((((((, ,/((((((((((((((((((((,
# ,(((((((((((((((((((((((((((((((((((((((((((((((((((
# .(((((((((((((((((((((((((((((((((((((((((((((
# .((((((((((((((((((((((((((((((((((((,.
# .,(((((((((((((((((((((((((.
# Linting jobs are passing so any issue that breaks them should fix them.
#
###################################################################################
cspell:
allow_failure: false
eslint:
allow_failure: false
phpcs:
script:
- cp $_WEB_ROOT/core/phpcs.xml.dist ./
- vendor/bin/phpcs -s $_WEB_ROOT/modules/custom --report-junit=junit.xml --report-full --report-summary --report-source
allow_failure: false
phpstan:
allow_failure: false
stylelint:
allow_failure: false
......@@ -59,7 +59,7 @@ abstract class Participant implements \JsonSerializable {
* @return string
* The participant's involvement; either author, publisher, or translator.
*/
public function getInvolvment(): string {
public function getInvolvement(): string {
return $this->involvement;
}
......
......@@ -17,6 +17,8 @@ use Drupal\vgwort\Plugin\AdvancedQueue\JobType\RegistrationNotification;
use Drush\Commands\DrushCommands;
use Symfony\Component\DependencyInjection\ContainerInterface;
// cspell:ignore vgws vgwq
/**
* VGWort Drush commands.
*/
......
......@@ -111,7 +111,7 @@ final class EntityJobMapper {
// If they are rows:
// - Remove the queue item if possible.
// - Delete them from the map.
// The following code is optimised to do this in the minimum queries and
// The following code is optimized to do this in the minimum queries and
// amount of logic possible as this is run as part of saving an entity.
$result = $this->connection->select(self::TABLE, 'map')
->condition('entity_type', $entity_type)
......
......@@ -96,7 +96,7 @@ class MessageGenerator {
*/
private function hasAuthor(array $participants): bool {
foreach ($participants as $participant) {
if ($participant->getInvolvment() === Participant::AUTHOR) {
if ($participant->getInvolvement() === Participant::AUTHOR) {
return TRUE;
}
}
......
......@@ -7,6 +7,8 @@ use Drupal\node\Entity\Node;
use Drupal\Tests\BrowserTestBase;
use Drush\TestTraits\DrushTestTrait;
// cspell:ignore vgws vgwq
/**
* Tests the vgwort drush command.
*
......
......@@ -192,6 +192,7 @@ class EntityQueueTest extends VgWortKernelTestBase {
// Mark $entity as successfully sent to VG Wort.
$this->handler->append(new Response());
// cspell:disable-next-line
$this->handler->append(new Response(500, ['Content-Type' => ['application/json', 'charset=UTF-8']], '{"message":{"errorcode":1,"errormsg":"Privater Identifikationscode: Für den eingegebenen Wert existiert keine Zählmarke."}}'));
$this->container->get('advancedqueue.processor')->processQueue($queue);
$jobs = self::JOB_COUNT;
......@@ -322,6 +323,7 @@ class EntityQueueTest extends VgWortKernelTestBase {
$this->assertSame($jobs, $queue_backend->countJobs());
$this->handler->append(new Response());
// cspell:disable-next-line
$this->handler->append(new Response(500, ['Content-Type' => ['application/json', 'charset=UTF-8']], '{"message":{"errorcode":1,"errormsg":"Privater Identifikationscode: Für den eingegebenen Wert existiert keine Zählmarke."}}'));
$this->container->get('advancedqueue.processor')->processQueue($queue);
......
......@@ -69,20 +69,20 @@ class ParticipantPluginTest extends VgWortKernelTestBase {
$entity->vgwort_test[1] = [
'card_number' => '4321431',
'firstname' => 'Anna',
'surname' => 'Digby',
'surname' => 'Burns',
'agency_abbr' => '',
];
$entity->save();
$participants = $participant_manager->getParticipants($entity);
$this->assertCount(2, $participants);
$this->assertSame($bob_jones, $participants[1]->jsonSerialize());
$anna_digby = [
$anna_burns = [
'cardNumber' => 4321431,
'firstName' => 'Anna',
'surName' => 'Digby',
'surName' => 'Burns',
'involvement' => 'AUTHOR',
];
$this->assertSame($anna_digby, $participants[0]->jsonSerialize());
$this->assertSame($anna_burns, $participants[0]->jsonSerialize());
// Add a translator.
$entity->vgwort_test2 = [
......@@ -101,7 +101,7 @@ class ParticipantPluginTest extends VgWortKernelTestBase {
'involvement' => 'TRANSLATOR',
];
$this->assertSame($bob_jones, $participants[1]->jsonSerialize());
$this->assertSame($anna_digby, $participants[0]->jsonSerialize());
$this->assertSame($anna_burns, $participants[0]->jsonSerialize());
$this->assertSame($sarah_smith_translator, $participants[2]->jsonSerialize());
// Add an entity owner with no VG Wort info.
......@@ -112,7 +112,7 @@ class ParticipantPluginTest extends VgWortKernelTestBase {
$participants = $participant_manager->getParticipants($entity);
$this->assertCount(3, $participants);
$this->assertSame($bob_jones, $participants[1]->jsonSerialize());
$this->assertSame($anna_digby, $participants[0]->jsonSerialize());
$this->assertSame($anna_burns, $participants[0]->jsonSerialize());
$this->assertSame($sarah_smith_translator, $participants[2]->jsonSerialize());
// Add VG Wort to a new user.
......@@ -140,7 +140,7 @@ class ParticipantPluginTest extends VgWortKernelTestBase {
];
$this->assertSame($simon_george, $participants[1]->jsonSerialize());
$this->assertSame($bob_jones, $participants[2]->jsonSerialize());
$this->assertSame($anna_digby, $participants[0]->jsonSerialize());
$this->assertSame($anna_burns, $participants[0]->jsonSerialize());
$this->assertSame($sarah_smith_translator, $participants[3]->jsonSerialize());
// Make the user and entity participant info mostly match apart from
......@@ -164,7 +164,7 @@ class ParticipantPluginTest extends VgWortKernelTestBase {
];
$this->assertSame($sarah_smith_author, $participants[2]->jsonSerialize());
$this->assertSame($bob_jones, $participants[1]->jsonSerialize());
$this->assertSame($anna_digby, $participants[0]->jsonSerialize());
$this->assertSame($anna_burns, $participants[0]->jsonSerialize());
$this->assertSame($sarah_smith_translator, $participants[3]->jsonSerialize());
// Make the user and entity participant info mostly match apart from
......@@ -181,7 +181,7 @@ class ParticipantPluginTest extends VgWortKernelTestBase {
$participants = $participant_manager->getParticipants($entity);
$this->assertCount(3, $participants);
$this->assertSame($bob_jones, $participants[1]->jsonSerialize());
$this->assertSame($anna_digby, $participants[0]->jsonSerialize());
$this->assertSame($anna_burns, $participants[0]->jsonSerialize());
$this->assertSame($sarah_smith_translator, $participants[2]->jsonSerialize());
// And an agency to ensure that works.
......@@ -192,7 +192,7 @@ class ParticipantPluginTest extends VgWortKernelTestBase {
$participants = $participant_manager->getParticipants($entity);
$this->assertCount(4, $participants);
$this->assertSame($bob_jones, $participants[1]->jsonSerialize());
$this->assertSame($anna_digby, $participants[0]->jsonSerialize());
$this->assertSame($anna_burns, $participants[0]->jsonSerialize());
$this->assertSame(['code' => 'BBC', 'involvement' => 'AUTHOR'], $participants[3]->jsonSerialize());
$this->assertSame($sarah_smith_translator, $participants[2]->jsonSerialize());
......@@ -209,7 +209,7 @@ class ParticipantPluginTest extends VgWortKernelTestBase {
$participants = $participant_manager->getParticipants($entity);
$this->assertCount(5, $participants);
$this->assertSame($bob_jones, $participants[1]->jsonSerialize());
$this->assertSame($anna_digby, $participants[0]->jsonSerialize());
$this->assertSame($anna_burns, $participants[0]->jsonSerialize());
$this->assertSame(['code' => 'BBC', 'involvement' => 'AUTHOR'], $participants[4]->jsonSerialize());
$this->assertSame($sarah_smith_translator, $participants[2]->jsonSerialize());
$this->assertSame([
......
......@@ -148,6 +148,7 @@ class RegistrationNotificationJobTypeTest extends VgWortKernelTestBase {
/** @var \GuzzleHttp\Psr7\Request $request */
$request = $this->history[0]['request'];
$this->assertSame('POST', $request->getMethod());
// cspell:disable-next-line
$this->assertSame('Basic dXNlcm5hbWU6cGFzc3dvcmQ=', $request->getHeader('Authorization')[0]);
// The functionality of creating a message from an entity is tested in
// MessageGeneratorTest.
......@@ -175,10 +176,12 @@ class RegistrationNotificationJobTypeTest extends VgWortKernelTestBase {
->set('username', 'username')
->set('password', 'password')
->save();
// cspell:disable-next-line
$this->handler->append(new Response(500, ['Content-Type' => ['application/json', 'charset=UTF-8']], '{"message":{"errorcode":1,"errormsg":"Privater Identifikationscode: Für den eingegebenen Wert existiert keine Zählmarke."}}'));
$job = RegistrationNotification::createJob($this->entity);
$result = $this->processJob($job);
$this->assertSame(Job::STATE_FAILURE, $result->getState());
// cspell:disable-next-line
$this->assertSame('The request to VG Wort failed (status code: 500). Error code: 1. Error message: Privater Identifikationscode: Für den eingegebenen Wert existiert keine Zählmarke.', $result->getMessage());
$this->assertCount(1, $this->history);
}
......
......@@ -184,7 +184,7 @@ class VgWortKernelTest extends VgWortKernelTestBase {
$another_entity = $entity_storage->create([
'text' => 'Another text',
'name' => 'Anoter title',
'name' => 'Another title',
]);
$another_entity->save();
......@@ -221,7 +221,7 @@ class VgWortKernelTest extends VgWortKernelTestBase {
$another_entity = $entity_storage->create([
'text' => 'Another text',
'name' => 'Anoter title',
'name' => 'Another title',
]);
$another_entity->save();
......
......@@ -14,7 +14,7 @@ use Drupal\vgwort\Api\AgencyParticipant;
class AgencyParticipantTest extends UnitTestCase {
use PrettyJsonTrait;
public function testSerialisation(): void {
public function testSerialization(): void {
$participant = new AgencyParticipant('ABC', 'AUTHOR');
$expected_value = <<<JSON
{
......
......@@ -14,7 +14,7 @@ use Drupal\vgwort\Api\IdentificationCode;
class IdentificationCodeTest extends UnitTestCase {
use PrettyJsonTrait;
public function testSerialisation(): void {
public function testSerialization(): void {
$id = new IdentificationCode('12345678', 'ISNI');
$expected_value = <<<JSON
{
......
......@@ -14,7 +14,7 @@ use Drupal\vgwort\Api\MessageText;
class MessageTextTest extends UnitTestCase {
use PrettyJsonTrait;
public function testSerialisation(): void {
public function testSerialization(): void {
$text = new MessageText('The <blink>title</blink>', '<strong>The text</strong>');
$expected_value = <<<JSON
{
......
......@@ -18,7 +18,7 @@ use Drupal\vgwort\Api\Webrange;
class NewMessageTest extends UnitTestCase {
use PrettyJsonTrait;
public function testSerialisation(): void {
public function testSerialization(): void {
$id = new IdentificationCode('12345678', 'ISNI');
$id2 = new IdentificationCode('87654321', 'IPI');
$participant = new PersonParticipant(435236412, 'Octavia', 'Butler', 'AUTHOR', [$id, $id2]);
......
......@@ -15,7 +15,7 @@ use Drupal\vgwort\Api\PersonParticipant;
class PersonParticipantTest extends UnitTestCase {
use PrettyJsonTrait;
public function testSerialisation(): void {
public function testSerialization(): void {
$id = new IdentificationCode('12345678', 'ISNI');
$id2 = new IdentificationCode('87654321', 'IPI');
$participant = new PersonParticipant(435236412, 'Octavia', 'Butler', 'AUTHOR', [$id, $id2]);
......
......@@ -14,7 +14,7 @@ use Drupal\vgwort\Api\Webrange;
class WebrangeTest extends UnitTestCase {
use PrettyJsonTrait;
public function testSerialisation(): void {
public function testSerialization(): void {
$webrange = new Webrange(['http://example.com/node/1', 'http://example.com/node/2']);
$expected_value = <<<JSON
{
......
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