Skip to content

Commit b5dbac6

Browse files
authored
Reduce dependency on getdkan/contracts (#4177)
1 parent 31f5342 commit b5dbac6

File tree

18 files changed

+39
-46
lines changed

18 files changed

+39
-46
lines changed

composer.json

+5-5
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,12 @@
2020
"ezyang/htmlpurifier": "^4.11",
2121
"fmizzell/maquina": "^1.1.1",
2222
"fylax/forceutf8": "^3.0",
23-
"getdkan/contracts": "^1.1.3",
24-
"getdkan/csv-parser": "^1.3.2",
25-
"getdkan/file-fetcher": "^5.0.4",
26-
"getdkan/harvest": "^1.0.4",
23+
"getdkan/contracts": "^1.2.0",
24+
"getdkan/csv-parser": "^1.3.3",
25+
"getdkan/file-fetcher": "^5.0.5",
26+
"getdkan/harvest": "^1.0.5",
2727
"getdkan/pdlt": "^0.1.7",
28-
"getdkan/procrastinator": "^5.0.2",
28+
"getdkan/procrastinator": "^5.0.3",
2929
"getdkan/rooted-json-data": "^0.2.2",
3030
"guzzlehttp/guzzle": "^6.5.8 || ^7.4.5",
3131
"ilbee/csv-response": "^1.2.0",

modules/common/src/Storage/DatabaseTableInterface.php

+9-4
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,22 @@
22

33
namespace Drupal\common\Storage;
44

5+
use Contracts\BulkRetrieverInterface;
6+
use Contracts\BulkStorerInterface;
57
use Contracts\RemoverInterface;
68
use Contracts\RetrieverInterface;
79
use Contracts\StorerInterface;
8-
use Contracts\BulkRetrieverInterface;
9-
use Contracts\BulkStorerInterface;
10-
use Contracts\CountableInterface;
1110

1211
/**
1312
* Databaset table interface.
1413
*/
15-
interface DatabaseTableInterface extends StorerInterface, RetrieverInterface, RemoverInterface, BulkStorerInterface, CountableInterface, BulkRetrieverInterface {
14+
interface DatabaseTableInterface extends
15+
BulkRetrieverInterface,
16+
BulkStorerInterface,
17+
\Countable,
18+
RemoverInterface,
19+
RetrieverInterface,
20+
StorerInterface {
1621

1722
/**
1823
* Remove the table from the database.

modules/common/src/Storage/Query.php

+8-5
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,22 @@
22

33
namespace Drupal\common\Storage;
44

5-
use Contracts\SorterInterface;
65
use Contracts\ConditionerInterface;
7-
use Contracts\OffsetterInterface;
86
use Contracts\LimiterInterface;
7+
use Contracts\OffsetterInterface;
8+
use Contracts\SorterInterface;
99

1010
/**
1111
* DKAN API Query data object.
12+
*
13+
* @todo Should we remove these external interfaces and only declare
14+
* QueryInterface?
1215
*/
1316
class Query implements
14-
SorterInterface,
1517
ConditionerInterface,
18+
LimiterInterface,
1619
OffsetterInterface,
17-
LimiterInterface {
20+
SorterInterface {
1821

1922
/**
2023
* The collection of records (usually, a database table) to query against.
@@ -135,7 +138,7 @@ public function filterByProperty($property) {
135138
* @param string $value
136139
* Property value to filter against.
137140
* @param bool $case
138-
* Case sensitive filter?
141+
* Case-sensitive filter?
139142
*/
140143
public function conditionByIsEqualTo(string $property, string $value, bool $case = FALSE) {
141144
$this->conditions[] = (object) [

modules/common/tests/src/Traits/CleanUp.php

-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
namespace Drupal\Tests\common\Traits;
44

55
use Drupal\node\Entity\Node;
6-
use FileFetcher\FileFetcher;
76

87
/**
98
* @deprecated Will be removed in a future version of DKAN.

modules/common/tests/src/Unit/DkanApiDocsGeneratorTest.php

-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
use Drupal\common\DkanApiDocsGenerator;
77
use Drupal\common\Plugin\DkanApiDocsBase;
88
use Drupal\common\Plugin\DkanApiDocsPluginManager;
9-
use Drupal\common\Plugin\OpenApiSpec;
109
use MockChain\Chain;
1110
use PHPUnit\Framework\TestCase;
1211

modules/data_dictionary_widget/data_dictionary_widget.module

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* @file
55
* Module for creating Data Dictionary Widget.
66
*/
7-
7+
use Drupal\Core\Entity\EntityFormInterface;
88
use Drupal\Core\Entity\Display\EntityFormDisplayInterface;
99
use Drupal\Core\Form\FormStateInterface;
1010
use Drupal\Core\Url;
@@ -77,7 +77,7 @@ function data_dictionary_widget_form_alter(&$form, &$form_state, $form_id) {
7777
$formObject = $form_state->getFormObject();
7878
$target_form_ids = ['node_data_edit_form', 'node_data_form'];
7979

80-
if ($formObject instanceof \Drupal\Core\Entity\EntityFormInterface && in_array($form_id, $target_form_ids)) {
80+
if ($formObject instanceof EntityFormInterface && in_array($form_id, $target_form_ids)) {
8181
$entity = $formObject->getEntity();
8282
$data_type = $entity->get('field_data_type')->value;
8383
if (isset($form["field_json_metadata"]["widget"][0]["dictionary_fields"])) {

modules/datastore/src/Plugin/QueueWorker/ImportJob.php

+4-4
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22

33
namespace Drupal\datastore\Plugin\QueueWorker;
44

5-
use Contracts\ParserInterface;
5+
use CsvParser\Parser\ParserInterface;
66
use Drupal\common\Storage\DatabaseTableInterface;
7+
use ForceUTF8\Encoding;
78
use Procrastinator\Job\AbstractPersistentJob;
89
use Procrastinator\Result;
9-
use ForceUTF8\Encoding;
1010

1111
/**
1212
* Procrastinator job for importing to the datastore.
@@ -82,7 +82,7 @@ class ImportJob extends AbstractPersistentJob {
8282
/**
8383
* Parser object.
8484
*
85-
* @var \Contracts\ParserInterface
85+
* @var \CsvParser\Parser\ParserInterface
8686
*/
8787
protected $parser;
8888

@@ -378,7 +378,7 @@ protected function assertUniqueHeaders(array $header) {
378378
/**
379379
* Get the parser object.
380380
*
381-
* @return \Contracts\ParserInterface
381+
* @return \CsvParser\Parser\ParserInterface
382382
* Parser object.
383383
*/
384384
public function getParser(): ParserInterface {

modules/datastore/tests/src/Kernel/Service/Info/ImportInfoListTest.php

-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
use Drupal\common\Storage\FileFetcherJobStoreFactory;
77
use Drupal\datastore\Plugin\QueueWorker\ImportJob;
88
use Drupal\common\Storage\JobStore;
9-
use Drupal\common\Storage\JobStoreFactory;
109
use Drupal\datastore\Service\Info\ImportInfo;
1110
use Drupal\KernelTests\KernelTestBase;
1211
use Drupal\metastore\ResourceMapper;

modules/datastore/tests/src/Unit/Plugin/QueueWorker/ImportJobTest.php

+4-4
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@
22

33
namespace Drupal\Tests\datastore\Unit\Plugin\QueueWorker;
44

5-
use Contracts\ParserInterface;
6-
use CsvParser\Parser\Csv;
75
use Contracts\Mock\Storage\Memory;
6+
use CsvParser\Parser\Csv;
7+
use CsvParser\Parser\ParserInterface;
8+
use Drupal\common\Storage\DatabaseTableInterface;
89
use Drupal\datastore\DatastoreResource;
910
use Drupal\datastore\Plugin\QueueWorker\ImportJob;
10-
use Drupal\common\Storage\DatabaseTableInterface;
11-
use Procrastinator\Result;
1211
use PHPUnit\Framework\TestCase;
12+
use Procrastinator\Result;
1313

1414
/**
1515
* Unit tests for Importer class.

modules/datastore/tests/src/Unit/Service/Info/ImportInfoTest.php

-8
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,13 @@
44

55
use Contracts\Mock\Storage\Memory;
66
use CsvParser\Parser\Csv;
7-
use Drupal\common\FileFetcher\FileFetcherFactory;
87
use Drupal\datastore\DatastoreResource;
98
use Drupal\datastore\Plugin\QueueWorker\ImportJob;
10-
use Drupal\common\Storage\JobStore;
11-
use Drupal\common\Storage\JobStoreFactory;
129
use Drupal\datastore\Service\Info\ImportInfo;
13-
use Drupal\datastore\Service\Info\ImportInfoList;
1410
use Drupal\Tests\datastore\Unit\Plugin\QueueWorker\TestMemStorage;
1511
use FileFetcher\FileFetcher;
16-
use MockChain\Chain;
17-
use MockChain\Options;
1812
use PHPUnit\Framework\TestCase;
1913
use Procrastinator\Job\Job;
20-
use Procrastinator\Result;
21-
use Symfony\Component\DependencyInjection\Container;
2214

2315
/**
2416
* @coversDefaultClass \Drupal\datastore\Service\Info\ImportInfo

modules/datastore/tests/src/Unit/Service/ResourceLocalizerTest.php

-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
use Drupal\common\FileFetcher\FileFetcherFactory;
88
use Drupal\common\Storage\DatabaseTableInterface;
99
use Drupal\common\Storage\FileFetcherJobStoreFactory;
10-
use Drupal\common\Storage\JobStoreFactory;
1110
use Drupal\common\Util\DrupalFiles;
1211
use Drupal\Core\DependencyInjection\Container;
1312
use Drupal\Core\File\FileSystem;

modules/datastore/tests/src/Unit/Storage/DatabaseTableFactoryTest.php

-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
use Drupal\datastore\DatastoreResource;
77
use Drupal\datastore\Storage\DatabaseTable;
88
use Drupal\datastore\Storage\DatabaseTableFactory;
9-
use Drupal\indexer\IndexManager;
109
use MockChain\Chain;
1110
use PHPUnit\Framework\TestCase;
1211
use Psr\Log\LoggerInterface;

modules/harvest/src/Storage/HarvestHashesEntityDatabaseTable.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ public function store($data, string $id = NULL) : string {
122122
* @param string $id
123123
* Dataset node UUID.
124124
*
125-
* @return \Contracts\HydratableInterface|string|null
125+
* @return \Procrastinator\HydratableInterface
126126
* JSON-encoded result of query.
127127
*/
128128
public function retrieve(string $id) {

modules/metastore/modules/metastore_search/tests/src/Unit/Plugin/search_api/datasource/DkanDatasetTest.php

-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
namespace Drupal\Tests\metastore_search\Unit\Plugin\search_api\datasource;
44

5-
use _PHPStan_7d6f0f6a4\Psr\Container\ContainerInterface;
65
use Drupal\Core\DependencyInjection\Container;
76
use Drupal\Core\Entity\EntityStorageInterface;
87
use Drupal\Core\Entity\EntityTypeManager;

modules/metastore/src/Controller/MetastoreRevisionController.php

+5-5
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@
22

33
namespace Drupal\metastore\Controller;
44

5-
use Contracts\FactoryInterface as ContractsFactoryInterface;
6-
use Drupal\common\JsonResponseTrait;
7-
use Symfony\Component\DependencyInjection\ContainerInterface;
5+
use Contracts\FactoryInterface;
86
use Drupal\Core\DependencyInjection\ContainerInjectionInterface;
97
use Drupal\Core\Entity\RevisionLogInterface;
8+
use Drupal\common\JsonResponseTrait;
109
use Drupal\metastore\Exception\MissingObjectException;
1110
use Drupal\metastore\MetastoreApiResponse;
1211
use Drupal\metastore\Storage\MetastoreEntityStorageInterface;
12+
use Symfony\Component\DependencyInjection\ContainerInterface;
1313
use Symfony\Component\HttpFoundation\Request;
1414

1515
/**
@@ -53,7 +53,7 @@ class MetastoreRevisionController implements ContainerInjectionInterface {
5353
*
5454
* @var \Contracts\FactoryInterface
5555
*/
56-
private ContractsFactoryInterface $storageFactory;
56+
private FactoryInterface $storageFactory;
5757

5858
/**
5959
* Inherited.
@@ -72,7 +72,7 @@ public static function create(ContainerInterface $container) {
7272
*/
7373
public function __construct(
7474
MetastoreApiResponse $apiResponse,
75-
ContractsFactoryInterface $storageFactory
75+
FactoryInterface $storageFactory
7676
) {
7777
$this->apiResponse = $apiResponse;
7878
$this->storageFactory = $storageFactory;

modules/metastore/tests/src/Unit/Commands/MetastoreCommandsTest.php

-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
namespace Drupal\Tests\metastore\Unit\Commands;
44

5-
use Drupal\Core\Logger\LoggerChannel;
65
use Drupal\metastore\Commands\MetastoreCommands;
76
use Drupal\metastore\Storage\Data;
87
use Drupal\metastore\Storage\DataFactory;

modules/metastore/tests/src/Unit/MetastoreSubscriberTest.php

-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99

1010
use Drupal\common\DataResource;
1111
use Drupal\common\Events\Event;
12-
use Drupal\common\Storage\JobStore;
1312
use Drupal\metastore\EventSubscriber\MetastoreSubscriber;
1413
use Drupal\metastore\MetastoreService;
1514
use Drupal\metastore\ReferenceLookupInterface;

phpunit.xml

+1
Original file line numberDiff line numberDiff line change
@@ -63,5 +63,6 @@
6363
<env name="SIMPLETEST_BASE_URL" value="http://web"/>
6464
<env name="SIMPLETEST_DB" value="mysql://drupal:123@db/drupal"/>
6565
<env name="SYMFONY_DEPRECATIONS_HELPER" value="disabled"/>
66+
<!-- env name="SYMFONY_DEPRECATIONS_HELPER" value="max[total]=0&amp;max[self]=0&amp;max[direct]=0"/ -->
6667
</php>
6768
</phpunit>

0 commit comments

Comments
 (0)