Skip to content
This repository has been archived by the owner on Aug 25, 2022. It is now read-only.

ISAICP-5599: Do not run sparql_entity_storage tests anymore. #106

Open
wants to merge 6 commits into
base: 8.x-1.x
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 0 additions & 12 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
"drupal/sparql_entity_storage": "^1.0"
},
"require-dev": {
"minimaxir/big-list-of-naughty-strings": "dev-master",
Copy link
Contributor

@claudiu-cristea claudiu-cristea Jan 18, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this removed? EDIT: I see, is tested in the other module.

"drupal/coder": "^8.3",
"easyrdf/easyrdf": "1.0.0 as 0.9.2",
"mglaman/phpstan-drupal": "^0.12.6",
Expand All @@ -24,17 +23,6 @@
{
"type": "composer",
"url": "https://packages.drupal.org/8"
},
{
"type": "package",
"package": {
"name": "minimaxir/big-list-of-naughty-strings",
"version": "dev-master",
"dist": {
"url": "https://github.com/minimaxir/big-list-of-naughty-strings/archive/master.zip",
"type": "zip"
}
}
}
]
}
2 changes: 2 additions & 0 deletions modules/rdf_draft/rdf_draft.install
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
* Includes installation functions for the rdf_draft module.
*/

declare(strict_types = 1);

use Drupal\Core\Serialization\Yaml;
use Drupal\sparql_entity_storage\Entity\SparqlGraph;
use Drupal\sparql_entity_storage\SparqlGraphInterface;
Expand Down
2 changes: 2 additions & 0 deletions modules/rdf_draft/rdf_draft.module
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
* Procedural lumps of code for the rdf_draft module.
*/

declare(strict_types = 1);

use Drupal\Core\Entity\EntityInterface;
use Drupal\sparql_entity_storage\SparqlEntityStorageInterface;
use Drupal\sparql_entity_storage\SparqlGraphInterface;
Expand Down
2 changes: 2 additions & 0 deletions modules/rdf_draft/src/Controller/RdfController.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types = 1);

namespace Drupal\rdf_draft\Controller;

use Drupal\Core\Controller\ControllerBase;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types = 1);

namespace Drupal\rdf_draft\EventSubscriber;

use Drupal\Core\Entity\EntityTypeManagerInterface;
Expand Down
8 changes: 4 additions & 4 deletions modules/rdf_draft/src/RdfGraphAccessCheck.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
use Drupal\Core\Entity\EntityTypeManagerInterface;
use Drupal\Core\Extension\ModuleHandlerInterface;
use Drupal\Core\Session\AccountInterface;
use Drupal\rdf_entity\RdfInterface;
use Drupal\sparql_entity_storage\SparqlEntityStorage;
use Drupal\sparql_entity_storage\SparqlGraphInterface;
use Drupal\rdf_entity\RdfInterface;
use Symfony\Component\Routing\Route;

/**
Expand Down Expand Up @@ -67,7 +67,7 @@ public function access(Route $route, AccountInterface $account, RdfInterface $rd
// Check if there is an entity saved in the passed graph.
$entity = $storage->load($rdf_entity->id(), [$graph]);

// @todo: When the requested graph is the only one and it is not the
// @todo When the requested graph is the only one and it is not the
// default, it is loaded in the default view, so maybe there is no need
// to also show a separate tab.
return AccessResult::allowedIf($entity && $this->checkAccess($rdf_entity, $route, $account, $operation, $graph))->cachePerPermissions()->addCacheableDependency($rdf_entity);
Expand All @@ -92,9 +92,9 @@ public function checkAccess(EntityInterface $entity, Route $route, AccountInterf
return FALSE;
}

// @todo: This probably needs to be cached manually creating a cid.
// @todo This probably needs to be cached manually creating a cid.
// @see: \Drupal\node\Access\NodeRevisionAccessCheck::checkAccess().
// @todo: This needs also to check cache for cached permission.
// @todo This needs also to check cache for cached permission.
// @see: \Drupal\Core\Entity\EntityAccessControlHandler::access().
$has_permission = $account->hasPermission($map[$operation]) || $account->hasPermission($type_map[$operation]);
$access = $has_permission ? AccessResult::allowed() : AccessResult::neutral();
Expand Down
2 changes: 2 additions & 0 deletions modules/rdf_draft/src/RdfGraphAccessCheckInterface.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types = 1);

namespace Drupal\rdf_draft;

use Drupal\Core\Entity\EntityInterface;
Expand Down
2 changes: 2 additions & 0 deletions modules/rdf_draft/src/RdfGraphPermissions.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types = 1);

namespace Drupal\rdf_draft;

use Drupal\Core\DependencyInjection\ContainerInjectionInterface;
Expand Down
5 changes: 4 additions & 1 deletion modules/rdf_draft/src/Routing/RouteSubscriber.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
use Drupal\Core\Entity\EntityTypeManagerInterface;
use Drupal\Core\Routing\RouteSubscriberBase;
use Drupal\Core\Routing\RoutingEvents;
use Drupal\Core\StringTranslation\StringTranslationTrait;
use Drupal\sparql_entity_storage\SparqlEntityStorage;
use Symfony\Component\Routing\Route;
use Symfony\Component\Routing\RouteCollection;
Expand All @@ -17,6 +18,8 @@
*/
class RouteSubscriber extends RouteSubscriberBase {

use StringTranslationTrait;

/**
* The entity type manager service.
*
Expand Down Expand Up @@ -73,7 +76,7 @@ protected function getRdfGraphRoute(EntityTypeInterface $entity_type, array $gra
$route
->addDefaults([
'_controller' => '\Drupal\rdf_draft\Controller\RdfController::view',
'_title' => (string) t('View @title', ['@title' => (string) $graph_definition['title']]),
'_title' => (string) $this->t('View @title', ['@title' => (string) $graph_definition['title']]),
])
->addRequirements([
'_access_rdf_graph' => 'TRUE',
Expand Down
2 changes: 2 additions & 0 deletions modules/rdf_export/src/Controller/RdfExportController.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types = 1);

namespace Drupal\rdf_export\Controller;

use Drupal\Core\Controller\ControllerBase;
Expand Down
8 changes: 5 additions & 3 deletions modules/rdf_export/src/Form/SettingsForm.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types = 1);

namespace Drupal\rdf_export\Form;

use Drupal\Core\Form\ConfigFormBase;
Expand Down Expand Up @@ -32,7 +34,7 @@ public function getFormId() {
*/
public function buildForm(array $form, FormStateInterface $form_state) {
$export_types = $this->config('rdf_export.settings')->get('export_types');
// @todo: Check which format are supported by the server?
// @todo Check which format are supported by the server?
$formats = Format::getFormats();
$list = [];
/** @var \EasyRdf\Format $format */
Expand All @@ -44,11 +46,11 @@ public function buildForm(array $form, FormStateInterface $form_state) {

$form['export_types'] = [
'#type' => 'select',
'#title' => t('Export types'),
'#title' => $this->t('Export types'),
'#options' => $list,
'#multiple' => TRUE,
'#default_value' => empty($export_types) ? [] : $export_types,
'#description' => t('Select the export types for rdf entities.'),
'#description' => $this->t('Select the export types for rdf entities.'),
];

return parent::buildForm($form, $form_state);
Expand Down
4 changes: 3 additions & 1 deletion modules/rdf_export/tests/src/Functional/RdfExportTest.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
<?php

declare(strict_types = 1);

namespace Drupal\Tests\rdf_export\Functional;

use Drupal\rdf_entity\Entity\Rdf;
use Drupal\Tests\BrowserTestBase;
use Drupal\Tests\sparql_entity_storage\Traits\SparqlConnectionTrait;
use Drupal\rdf_entity\Entity\Rdf;

/**
* Tests the RDF export functionality.
Expand Down
2 changes: 2 additions & 0 deletions modules/rdf_taxonomy/rdf_taxonomy.install
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
* Install rdf taxonomy.
*/

declare(strict_types = 1);

use Drupal\Core\Field\BaseFieldDefinition;
use Drupal\Core\StringTranslation\TranslatableMarkup;
use Drupal\rdf_taxonomy\Entity\RdfTerm;
Expand Down
6 changes: 4 additions & 2 deletions modules/rdf_taxonomy/rdf_taxonomy.module
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,18 @@
* Main functions and hook implementations of the RDF Taxonomy module.
*/

declare(strict_types = 1);

use Drupal\Core\Access\AccessResult;
use Drupal\Core\Entity\EntityTypeInterface;
use Drupal\Core\Field\BaseFieldDefinition;
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Session\AccountInterface;
use Drupal\sparql_entity_storage\Entity\Query\Sparql\SparqlArg;
use Drupal\sparql_entity_storage\Entity\SparqlMapping;
use Drupal\rdf_taxonomy\Entity\RdfTerm;
use Drupal\rdf_taxonomy\RdfTaxonomyTermListBuilder;
use Drupal\rdf_taxonomy\TermRdfStorage;
use Drupal\sparql_entity_storage\Entity\Query\Sparql\SparqlArg;
use Drupal\sparql_entity_storage\Entity\SparqlMapping;
use Drupal\sparql_entity_storage\UriEncoder;
use Drupal\taxonomy\Entity\Term;
use Drupal\taxonomy\Entity\Vocabulary;
Expand Down
2 changes: 2 additions & 0 deletions modules/rdf_taxonomy/src/Entity/RdfTerm.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types = 1);

namespace Drupal\rdf_taxonomy\Entity;

use Drupal\Core\Entity\EntityTypeInterface;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types = 1);

namespace Drupal\rdf_taxonomy\EventSubscriber;

use Drupal\sparql_entity_storage\Event\OutboundValueEvent;
Expand Down
2 changes: 2 additions & 0 deletions modules/rdf_taxonomy/src/RdfTaxonomyConfigOverrides.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types = 1);

namespace Drupal\rdf_taxonomy;

use Drupal\Core\Cache\CacheableMetadata;
Expand Down
2 changes: 2 additions & 0 deletions modules/rdf_taxonomy/src/RdfTaxonomyTermListBuilder.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types = 1);

namespace Drupal\rdf_taxonomy;

use Drupal\Core\Entity\EntityInterface;
Expand Down
2 changes: 2 additions & 0 deletions modules/rdf_taxonomy/src/Routing/RouteSubscriber.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types = 1);

namespace Drupal\rdf_taxonomy\Routing;

use Drupal\Core\Routing\RouteSubscriberBase;
Expand Down
2 changes: 1 addition & 1 deletion modules/rdf_taxonomy/src/TermRdfStorage.php
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ protected function alterGraph(Graph &$graph, EntityInterface $entity): void {
/**
* {@inheritdoc}
*/
public function resetCache(array $ids = NULL, array $graph_ids = NULL): void {
public function resetCache(?array $ids = NULL, ?array $graph_ids = NULL): void {
drupal_static_reset('taxonomy_term_count_nodes');
$this->parents = [];
$this->parentsAll = [];
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
<?php

declare(strict_types = 1);

namespace Drupal\Tests\rdf_taxonomy\Functional;

use Drupal\Tests\BrowserTestBase;
use Drupal\Tests\sparql_entity_storage\Traits\SparqlConnectionTrait;
use Drupal\filter\Entity\FilterFormat;
use Drupal\sparql_entity_storage\Entity\SparqlMapping;
use Drupal\taxonomy\Entity\Vocabulary;
use Drupal\Tests\BrowserTestBase;
use Drupal\Tests\sparql_entity_storage\Traits\SparqlConnectionTrait;

/**
* Tests adding, editing and deleting terms in an unlocked vocabulary.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@

namespace Drupal\rdf_taxonomy\Tests;

use Drupal\taxonomy\Entity\Term;
use Drupal\Tests\rdf_entity\Kernel\RdfKernelTestBase;
use Drupal\taxonomy\Entity\Term;

/**
* Tests Entity Query functionality of the Sparql backend.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
namespace Drupal\Tests\rdf_taxonomy\Kernel;

use Drupal\KernelTests\KernelTestBase;
use Drupal\Tests\sparql_entity_storage\Traits\SparqlConnectionTrait;
use Drupal\rdf_taxonomy\Entity\RdfTerm;
use Drupal\sparql_entity_storage\Entity\SparqlMapping;
use Drupal\taxonomy\Entity\Vocabulary;
use Drupal\Tests\sparql_entity_storage\Traits\SparqlConnectionTrait;

/**
* Tests the RdfTerm weight.
Expand Down
2 changes: 2 additions & 0 deletions rdf_entity.install
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
* Includes installation functions for the rdf_entity module.
*/

declare(strict_types = 1);

use Drupal\Core\Field\BaseFieldDefinition;
use Drupal\Core\Serialization\Yaml;
use Drupal\sparql_entity_storage\Entity\SparqlGraph;
Expand Down
2 changes: 2 additions & 0 deletions src/ContextProvider/RdfEntityRouteContext.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types = 1);

namespace Drupal\rdf_entity\ContextProvider;

use Drupal\Core\Cache\CacheableMetadata;
Expand Down
2 changes: 2 additions & 0 deletions src/Controller/RdfController.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types = 1);

namespace Drupal\rdf_entity\Controller;

use Drupal\Component\Utility\Xss;
Expand Down
6 changes: 4 additions & 2 deletions src/Entity/Controller/RdfTypeListBuilder.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types = 1);

namespace Drupal\rdf_entity\Entity\Controller;

use Drupal\Core\Config\Entity\ConfigEntityListBuilder;
Expand All @@ -17,9 +19,9 @@ class RdfTypeListBuilder extends ConfigEntityListBuilder {
* {@inheritdoc}
*/
public function buildHeader() {
$header['title'] = t('Name');
$header['title'] = $this->t('Name');
$header['description'] = [
'data' => t('Description'),
'data' => $this->t('Description'),
'class' => [RESPONSIVE_PRIORITY_MEDIUM],
];
return $header + parent::buildHeader();
Expand Down
10 changes: 6 additions & 4 deletions src/Entity/Rdf.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types = 1);

namespace Drupal\rdf_entity\Entity;

use Drupal\Core\Entity\ContentEntityBase;
Expand Down Expand Up @@ -268,14 +270,14 @@ public function isPublished() {
* {@inheritdoc}
*/
public function setPublished($published = NULL) {
// TODO: Implement setPublished() method.
// @todo Implement setPublished() method.
}

/**
* {@inheritdoc}
*/
public function setUnpublished() {
// TODO: Implement setUnpublished() method.
// @todo Implement setUnpublished() method.
}

/**
Expand Down Expand Up @@ -368,7 +370,7 @@ public function hasGraph($graph) {
/**
* {@inheritdoc}
*/
public static function load($id, array $graph_ids = NULL) {
public static function load($id, ?array $graph_ids = NULL) {
$entity_type_repository = \Drupal::service('entity_type.repository');
$entity_type_manager = \Drupal::entityTypeManager();
/** @var \Drupal\sparql_entity_storage\SparqlEntityStorageInterface $storage */
Expand All @@ -379,7 +381,7 @@ public static function load($id, array $graph_ids = NULL) {
/**
* {@inheritdoc}
*/
public static function loadMultiple(array $ids = NULL, array $graph_ids = NULL) {
public static function loadMultiple(?array $ids = NULL, ?array $graph_ids = NULL) {
$entity_type_repository = \Drupal::service('entity_type.repository');
$entity_type_manager = \Drupal::entityTypeManager();
/** @var \Drupal\sparql_entity_storage\SparqlEntityStorageInterface $storage */
Expand Down
Loading