Skip to content

Commit

Permalink
Merge pull request #173 from City-of-Helsinki/UHF-X-description-value
Browse files Browse the repository at this point in the history
Add default value for description field value
  • Loading branch information
hyrsky authored Nov 7, 2024
2 parents 079fb5d + b0cda27 commit 6cca3df
Show file tree
Hide file tree
Showing 24 changed files with 28 additions and 26 deletions.
2 changes: 1 addition & 1 deletion helfi_tpr.install
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@

declare(strict_types=1);

use Drupal\content_translation\ContentTranslationHandler;
use Drupal\Core\Field\BaseFieldDefinition;
use Drupal\Core\Language\LanguageInterface;
use Drupal\Core\StringTranslation\TranslatableMarkup;
use Drupal\content_translation\ContentTranslationHandler;
use Drupal\helfi_tpr\Entity\ChannelTypeCollection;
use Drupal\migrate\Plugin\MigrateIdMapInterface;

Expand Down
5 changes: 4 additions & 1 deletion migrations/tpr_unit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,10 @@ process:
plugin: default_value
default_value: plain_text
www/uri: www
description/value: desc
description/value:
plugin: default_value
source: desc
default_value: ''
description/summary: short_desc
service_map_embed: id
latitude: latitude
Expand Down
2 changes: 1 addition & 1 deletion src/Entity/TprEntityBase.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
use Drupal\Core\Entity\EntityPublishedInterface;
use Drupal\Core\Entity\EntityPublishedTrait;
use Drupal\Core\Entity\EntityTypeInterface;
use Drupal\Core\Entity\RevisionableInterface;
use Drupal\Core\Entity\RevisionLogEntityTrait;
use Drupal\Core\Entity\RevisionLogInterface;
use Drupal\Core\Entity\RevisionableInterface;
use Drupal\Core\Field\BaseFieldDefinition;
use Drupal\Core\Session\AccountInterface;
use Drupal\Core\StringTranslation\TranslatableMarkup;
Expand Down
2 changes: 1 addition & 1 deletion src/Entity/TranslationHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@

namespace Drupal\helfi_tpr\Entity;

use Drupal\content_translation\ContentTranslationHandler;
use Drupal\Core\Entity\EntityInterface;
use Drupal\Core\Form\FormStateInterface;
use Drupal\content_translation\ContentTranslationHandler;

/**
* Translation handler for TPR entities.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public static function create(
ContainerInterface $container,
array $configuration,
$plugin_id,
$plugin_definition
$plugin_definition,
) : self {
$instance = parent::create($container, $configuration, $plugin_id,
$plugin_definition);
Expand Down
2 changes: 1 addition & 1 deletion src/Plugin/migrate/source/OntologyWordDetails.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public static function create(
array $configuration,
$plugin_id,
$plugin_definition,
MigrationInterface $migration = NULL
?MigrationInterface $migration = NULL,
) {
$instance = parent::create($container, $configuration, $plugin_id, $plugin_definition, $migration);
$instance->configFactory = $container->get('config.factory');
Expand Down
2 changes: 1 addition & 1 deletion src/Plugin/views/filter/ProvidedLanguages.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class ProvidedLanguages extends InOperator {
/**
* {@inheritdoc}
*/
public function init(ViewExecutable $view, DisplayPluginBase $display, array &$options = NULL): void {
public function init(ViewExecutable $view, DisplayPluginBase $display, ?array &$options = NULL): void {
parent::init($view, $display, $options);
$this->valueTitle = (string) $this->t('Allowed languages');
$this->definition['options callback'] = [$this, 'generateOptions'];
Expand Down
2 changes: 1 addition & 1 deletion tests/src/Functional/ErrandServiceListTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@

namespace Drupal\Tests\helfi_tpr\Functional;

use donatj\MockWebServer\Response;
use Drupal\Core\Entity\ContentEntityInterface;
use Drupal\Core\Entity\TranslatableInterface;
use Drupal\helfi_tpr\Entity\ErrandService;
use donatj\MockWebServer\Response;

/**
* Tests Errand Service entity's list functionality.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@

namespace Drupal\Tests\helfi_tpr\Functional\Plugin\Field\FieldFormatter;

use Drupal\Tests\helfi_api_base\Functional\MigrationTestBase;
use Drupal\helfi_tpr\Entity\TprEntityBase;
use Drupal\helfi_tpr\Entity\Unit;
use Drupal\Tests\helfi_api_base\Functional\MigrationTestBase;

/**
* Base class to test TPR field formatters.
Expand Down
2 changes: 1 addition & 1 deletion tests/src/Functional/ServiceListTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@

namespace Drupal\Tests\helfi_tpr\Functional;

use donatj\MockWebServer\Response;
use Drupal\Core\Entity\ContentEntityInterface;
use Drupal\Core\Entity\TranslatableInterface;
use Drupal\helfi_tpr\Entity\Service;
use donatj\MockWebServer\Response;

/**
* Tests Service entity's list functionality.
Expand Down
2 changes: 1 addition & 1 deletion tests/src/Functional/ServiceRevisionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
namespace Drupal\Tests\helfi_tpr\Functional;

use Drupal\Core\Url;
use Drupal\helfi_tpr\Entity\Service;
use Drupal\Tests\helfi_tpr\Traits\TprMigrateTrait;
use Drupal\helfi_tpr\Entity\Service;

/**
* Tests service revisions.
Expand Down
2 changes: 1 addition & 1 deletion tests/src/Functional/ServiceTranslationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
namespace Drupal\Tests\helfi_tpr\Functional;

use Drupal\Core\Url;
use Drupal\helfi_tpr\Entity\Service;
use Drupal\Tests\helfi_tpr\Traits\TprMigrateTrait;
use Drupal\helfi_tpr\Entity\Service;

/**
* Tests Service translations.
Expand Down
2 changes: 1 addition & 1 deletion tests/src/Functional/UnitListTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@

namespace Drupal\Tests\helfi_tpr\Functional;

use donatj\MockWebServer\Response;
use Drupal\Core\Entity\ContentEntityInterface;
use Drupal\Core\Entity\TranslatableInterface;
use Drupal\helfi_tpr\Entity\Unit;
use donatj\MockWebServer\Response;

/**
* Tests Unit entity's list functionality.
Expand Down
2 changes: 1 addition & 1 deletion tests/src/Functional/UnitRevisionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
namespace Drupal\Tests\helfi_tpr\Functional;

use Drupal\Core\Url;
use Drupal\helfi_tpr\Entity\Unit;
use Drupal\Tests\helfi_tpr\Traits\TprMigrateTrait;
use Drupal\helfi_tpr\Entity\Unit;

/**
* Tests unit revisions.
Expand Down
2 changes: 1 addition & 1 deletion tests/src/Functional/UnitTranslationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
namespace Drupal\Tests\helfi_tpr\Functional;

use Drupal\Core\Url;
use Drupal\helfi_tpr\Entity\Unit;
use Drupal\Tests\helfi_tpr\Traits\TprMigrateTrait;
use Drupal\helfi_tpr\Entity\Unit;

/**
* Tests Unit translations.
Expand Down
4 changes: 2 additions & 2 deletions tests/src/Kernel/MigrationTestBase.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public function setUp() : void {
protected function getMigrateMapRowHash(
string $migrationId,
int|string $sourceId,
string $language
string $language,
) : ? string {
/** @var \Drupal\Core\Database\Connection $database */
$database = $this->container->get('database');
Expand Down Expand Up @@ -97,7 +97,7 @@ protected function assertMigrateMapRowHash(
string $migrationId,
string $expected,
int|string $sourceId,
string $language
string $language,
) {
$this->assertEquals($expected, $this->getMigrateMapRowHash($migrationId, $sourceId, $language));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@

use Drupal\Core\Field\FieldItemInterface;
use Drupal\Core\Field\FieldItemListInterface;
use Drupal\Tests\field\Kernel\FieldKernelTestBase;
use Drupal\entity_test\Entity\EntityTest;
use Drupal\field\Entity\FieldConfig;
use Drupal\field\Entity\FieldStorageConfig;
use Drupal\Tests\field\Kernel\FieldKernelTestBase;

/**
* Tests accessibility sentence field.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@

use Drupal\Core\Field\FieldItemInterface;
use Drupal\Core\Field\FieldItemListInterface;
use Drupal\Tests\field\Kernel\FieldKernelTestBase;
use Drupal\entity_test\Entity\EntityTest;
use Drupal\field\Entity\FieldConfig;
use Drupal\field\Entity\FieldStorageConfig;
use Drupal\helfi_tpr\Field\Connection\OpeningHour;
use Drupal\Tests\field\Kernel\FieldKernelTestBase;

/**
* Tests connection item field.
Expand Down
2 changes: 1 addition & 1 deletion tests/src/Kernel/TokenTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@

namespace Drupal\Tests\helfi_tpr\Kernel;

use Drupal\Tests\media\Traits\MediaTypeCreationTrait;
use Drupal\file\Entity\File;
use Drupal\helfi_tpr\Entity\Unit;
use Drupal\media\Entity\Media;
use Drupal\Tests\media\Traits\MediaTypeCreationTrait;

/**
* Tests custom tokens.
Expand Down
2 changes: 1 addition & 1 deletion tests/src/Unit/ChannelTypeCollectionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
namespace Drupal\Tests\helfi_tpr\Unit;

use Drupal\Core\StringTranslation\TranslatableMarkup;
use Drupal\Tests\UnitTestCase;
use Drupal\helfi_tpr\Entity\ChannelType;
use Drupal\helfi_tpr\Entity\ChannelTypeCollection;
use Drupal\Tests\UnitTestCase;

/**
* Tests connection value objects.
Expand Down
2 changes: 1 addition & 1 deletion tests/src/Unit/ConnectionRepositoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

namespace Drupal\Tests\helfi_tpr\Unit;

use Drupal\Tests\UnitTestCase;
use Drupal\helfi_tpr\Field\Connection\Connection;
use Drupal\helfi_tpr\Field\Connection\Highlight;
use Drupal\helfi_tpr\Field\Connection\Link;
Expand All @@ -14,7 +15,6 @@
use Drupal\helfi_tpr\Field\Connection\Repository;
use Drupal\helfi_tpr\Field\Connection\Subgroup;
use Drupal\helfi_tpr\Field\Connection\Topical;
use Drupal\Tests\UnitTestCase;

/**
* Tests repository value objects.
Expand Down
3 changes: 1 addition & 2 deletions tests/src/Unit/ConnectionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

namespace Drupal\Tests\helfi_tpr\Unit;

use Drupal\Tests\UnitTestCase;
use Drupal\helfi_tpr\Field\Connection\Highlight;
use Drupal\helfi_tpr\Field\Connection\Link;
use Drupal\helfi_tpr\Field\Connection\OpeningHour;
Expand All @@ -15,8 +16,6 @@
use Drupal\helfi_tpr\Field\Connection\TextWithLink;
use Drupal\helfi_tpr\Field\Connection\Topical;

use Drupal\Tests\UnitTestCase;

/**
* Tests connection value objects.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@
use Drupal\Core\Field\FieldItemListInterface;
use Drupal\Core\Field\FieldTypePluginManagerInterface;
use Drupal\Core\TypedData\TraversableTypedDataInterface;
use Drupal\Tests\UnitTestCase;
use Drupal\helfi_api_base\Entity\RemoteEntityBase;
use Drupal\helfi_tpr\Entity\Unit;
use Drupal\helfi_tpr\Plugin\Field\FieldFormatter\ServiceMapFormatter;
use Drupal\Tests\UnitTestCase;
use Prophecy\PhpUnit\ProphecyTrait;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@

namespace Drupal\Tests\helfi_tpr\Unit\Plugin\migrate\process;

use Drupal\Tests\UnitTestCase;
use Drupal\helfi_tpr\Field\Connection\OpeningHour;
use Drupal\helfi_tpr\Field\Connection\OpeningHourObject;
use Drupal\helfi_tpr\Plugin\migrate\process\ArrayElementEquals;
use Drupal\migrate\MigrateExecutableInterface;
use Drupal\migrate\Row;
use Drupal\Tests\UnitTestCase;
use Prophecy\PhpUnit\ProphecyTrait;

/**
Expand Down

0 comments on commit 6cca3df

Please sign in to comment.