Skip to content
Snippets Groups Projects
Commit b85bc954 authored by Claudiu Cristea's avatar Claudiu Cristea
Browse files

ISAICP-9218: Re-synchonize terms for some tests.

parent 20c1d544
No related branches found
No related tags found
1 merge request!200Security release 2.0.4
@api @api @rdf_sync
Feature: Interoperable Europe Portal should be ADMS-AP compliant. Feature: Interoperable Europe Portal should be ADMS-AP compliant.
Scenario: Validate the entities in the published graph. Scenario: Validate the entities in the published graph.
......
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
use Behat\Gherkin\Node\TableNode; use Behat\Gherkin\Node\TableNode;
use Drupal\DrupalExtension\Context\RawDrupalContext; use Drupal\DrupalExtension\Context\RawDrupalContext;
use Drupal\rdf_sync\Model\SyncMethod;
use PHPUnit\Framework\Assert; use PHPUnit\Framework\Assert;
use PHPUnit\Framework\ExpectationFailedException; use PHPUnit\Framework\ExpectationFailedException;
use function PHPUnit\Framework\assertCount; use function PHPUnit\Framework\assertCount;
...@@ -235,6 +236,26 @@ public function assertValidPublishedGraph(): void { ...@@ -235,6 +236,26 @@ public function assertValidPublishedGraph(): void {
Assert::assertTrue($result->isSuccessful(), 'The published graph is not ADMS-AP compliant.'); Assert::assertTrue($result->isSuccessful(), 'The published graph is not ADMS-AP compliant.');
} }
/**
* Re-synchronizes terms.
*
* Used in Digit QA pipeline. The terms are installed and synchronized in
* clean-install job but are not preserved between jobs. Tests requiring RDF
* synchronized terms, should be tagged with @rdf_sync.
*
* @BeforeScenario @rdf_sync&&@api
*/
public function reSynchronizeTerms(): void {
$info = \Drupal::getContainer()->get('entity_type.bundle.info')->getBundleInfo('taxonomy_term');
$vids = array_filter($info, fn(array $bundle): bool => isset($bundle['rdf_sync']));
$tids = \Drupal::entityQuery('taxonomy_term')->accessCheck(FALSE)
->condition('vid', array_keys($vids), 'IN')
->execute();
/** @var \Drupal\taxonomy\TermInterface[] $terms */
$terms = \Drupal::entityTypeManager()->getStorage('taxonomy_term')->loadMultiple($tids);
\Drupal::getContainer()->get('rdf_sync.synchronizer')->synchronize(SyncMethod::UPDATE, $terms);
}
/** /**
* Updates an entity, given its RDF resource (URI). * Updates an entity, given its RDF resource (URI).
* *
......
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