Commit e54eecc3 authored by john_a's avatar john_a Committed by john_a
Browse files

Issue #2974628 by john_a: Pareview changes to Dereferencer have broken the tests

parent 060bee93
......@@ -2,8 +2,8 @@
namespace Drupal\Tests\marketing_cloud_address\Functional;
use JsonGuard\Validator;
use JsonReference\Dereferencer;
use League\JsonGuard;
use League\JsonReference;
use Drupal\Tests\BrowserTestBase;
/**
......@@ -45,7 +45,9 @@ class MarketingCloudAddressTest extends BrowserTestBase {
->set('do_not_send', TRUE)
->save();
// Get schema validator.
$this->metaSchema = Dereferencer::draft6()->dereference('http://json-schema.org/draft-06/schema#');
$this->metaSchema = JsonReference\Dereferencer::draft6()->dereference('http://json-schema.org/draft-06/schema#');
$this->metaSchema = JsonReference\Dereferencer::draft6()->dereference('http://json-schema.org/draft-06/schema#');
// Create service.
$this->service = \Drupal::service('marketing_cloud_address.service');
// Get marketing_cloud_assets config object.
......@@ -61,7 +63,7 @@ class MarketingCloudAddressTest extends BrowserTestBase {
$this->assertNotEmpty($schema, "json schema for validate_email is empty.");
$schema = json_decode($schema);
$this->assertNotEmpty($schema, "json schema for validate_email is invalid json.");
$validator = new Validator($schema, $this->metaSchema);
$validator = new JsonGuard\Validator($schema, $this->metaSchema);
$this->assertNotFalse($validator->passes(), "schema validation failed for validate_email.");
// Test validateEmail against expected inputs.
$data = $this->validateEmailData();
......
......@@ -2,8 +2,8 @@
namespace Drupal\Tests\marketing_cloud_assets\Functional;
use JsonGuard\Validator;
use JsonReference\Dereferencer;
use League\JsonGuard;
use League\JsonReference;
use Drupal\Tests\BrowserTestBase;
/**
......@@ -45,7 +45,7 @@ class MarketingCloudAssetsTest extends BrowserTestBase {
->set('do_not_send', TRUE)
->save();
// Get schema validator.
$this->metaSchema = Dereferencer::draft6()->dereference('http://json-schema.org/draft-06/schema#');
$this->metaSchema = JsonReference\Dereferencer::draft6()->dereference('http://json-schema.org/draft-06/schema#');
// Create service.
$this->service = \Drupal::service('marketing_cloud_assets.service');
// Get marketing_cloud_assets config object.
......@@ -256,7 +256,7 @@ class MarketingCloudAssetsTest extends BrowserTestBase {
$this->assertNotEmpty($schema, "json schema for $machineName definition is empty.");
$schema = json_decode($schema);
$this->assertNotEmpty($schema, "json schema for $machineName definition is invalid json.");
$validator = new Validator($schema, $this->metaSchema);
$validator = new JsonGuard\Validator($schema, $this->metaSchema);
$this->assertNotFalse($validator->passes(), "schema validation failed for $machineName.");
}
......
......@@ -2,8 +2,8 @@
namespace Drupal\Tests\marketing_cloud_campaigns\Functional;
use JsonGuard\Validator;
use JsonReference\Dereferencer;
use League\JsonGuard;
use League\JsonReference;
use Drupal\Tests\BrowserTestBase;
/**
......@@ -45,7 +45,7 @@ class MarketingCloudCampaignsTest extends BrowserTestBase {
->set('do_not_send', TRUE)
->save();
// Get schema validator.
$this->metaSchema = Dereferencer::draft6()->dereference('http://json-schema.org/draft-06/schema#');
$this->metaSchema = JsonReference\Dereferencer::draft6()->dereference('http://json-schema.org/draft-06/schema#');
// Create service.
$this->service = \Drupal::service('marketing_cloud_campaigns.service');
// Get marketing_cloud_assets config object.
......@@ -249,7 +249,7 @@ class MarketingCloudCampaignsTest extends BrowserTestBase {
$this->assertNotEmpty($schema, "json schema for $machineName definition is empty.");
$schema = json_decode($schema);
$this->assertNotEmpty($schema, "json schema for $machineName definition is invalid json.");
$validator = new Validator($schema, $this->metaSchema);
$validator = new JsonGuard\Validator($schema, $this->metaSchema);
$this->assertNotFalse($validator->passes(), "schema validation failed for $machineName.");
}
......
......@@ -2,8 +2,8 @@
namespace Drupal\Tests\marketing_cloud_contacts\Functional;
use JsonGuard\Validator;
use JsonReference\Dereferencer;
use League\JsonGuard;
use League\JsonReference;
use Drupal\Tests\BrowserTestBase;
/**
......@@ -45,7 +45,7 @@ class MarketingCloudContactsTest extends BrowserTestBase {
->set('do_not_send', TRUE)
->save();
// Get schema validator.
$this->metaSchema = Dereferencer::draft6()->dereference('http://json-schema.org/draft-06/schema#');
$this->metaSchema = JsonReference\Dereferencer::draft6()->dereference('http://json-schema.org/draft-06/schema#');
// Create service.
$this->service = \Drupal::service('marketing_cloud_contacts.service');
// Get marketing_cloud_assets config object.
......@@ -656,7 +656,7 @@ class MarketingCloudContactsTest extends BrowserTestBase {
$this->assertNotEmpty($schema, "json schema for $machineName definition is empty.");
$schema = json_decode($schema);
$this->assertNotEmpty($schema, "json schema for $machineName definition is invalid json.");
$validator = new Validator($schema, $this->metaSchema);
$validator = new JsonGuard\Validator($schema, $this->metaSchema);
$this->assertNotFalse($validator->passes(), "schema validation failed for $machineName.");
}
......
......@@ -2,8 +2,8 @@
namespace Drupal\Tests\marketing_cloud_data_events\Functional;
use JsonGuard\Validator;
use JsonReference\Dereferencer;
use League\JsonGuard;
use League\JsonReference;
use Drupal\Tests\BrowserTestBase;
/**
......@@ -45,7 +45,7 @@ class MarketingCloudDataEventsTest extends BrowserTestBase {
->set('do_not_send', TRUE)
->save();
// Get schema validator.
$this->metaSchema = Dereferencer::draft6()->dereference('http://json-schema.org/draft-06/schema#');
$this->metaSchema = JsonReference\Dereferencer::draft6()->dereference('http://json-schema.org/draft-06/schema#');
// Create service.
$this->service = \Drupal::service('marketing_cloud_data_events.service');
// Get marketing_cloud_data_events config object.
......@@ -175,7 +175,7 @@ class MarketingCloudDataEventsTest extends BrowserTestBase {
$this->assertNotEmpty($schema, "json schema for $machineName definition is empty.");
$schema = json_decode($schema);
$this->assertNotEmpty($schema, "json schema for $machineName definition is invalid json.");
$validator = new Validator($schema, $this->metaSchema);
$validator = new JsonGuard\Validator($schema, $this->metaSchema);
$this->assertNotFalse($validator->passes(), "schema validation failed for $machineName.");
}
......
......@@ -2,8 +2,8 @@
namespace Drupal\Tests\marketing_cloud_interaction\Functional;
use JsonGuard\Validator;
use JsonReference\Dereferencer;
use League\JsonGuard;
use League\JsonReference;
use Drupal\Tests\BrowserTestBase;
/**
......@@ -45,7 +45,7 @@ class MarketingCloudInteractionTest extends BrowserTestBase {
->set('do_not_send', TRUE)
->save();
// Get schema validator.
$this->metaSchema = Dereferencer::draft6()->dereference('http://json-schema.org/draft-06/schema#');
$this->metaSchema = JsonReference\Dereferencer::draft6()->dereference('http://json-schema.org/draft-06/schema#');
// Create service.
$this->service = \Drupal::service('marketing_cloud_interaction.service');
// Get marketing_cloud_assets config object.
......@@ -324,7 +324,7 @@ class MarketingCloudInteractionTest extends BrowserTestBase {
$this->assertNotEmpty($schema, "json schema for $machineName definition is empty.");
$schema = json_decode($schema);
$this->assertNotEmpty($schema, "json schema for $machineName definition is invalid json.");
$validator = new Validator($schema, $this->metaSchema);
$validator = new JsonGuard\Validator($schema, $this->metaSchema);
$this->assertNotFalse($validator->passes(), "schema validation failed for $machineName.");
}
......
......@@ -2,8 +2,8 @@
namespace Drupal\Tests\marketing_cloud_messages\Functional;
use JsonGuard\Validator;
use JsonReference\Dereferencer;
use League\JsonGuard;
use League\JsonReference;
use Drupal\Tests\BrowserTestBase;
/**
......@@ -45,7 +45,7 @@ class MarketingCloudMessagesTest extends BrowserTestBase {
->set('do_not_send', TRUE)
->save();
// Get schema validator.
$this->metaSchema = Dereferencer::draft6()->dereference('http://json-schema.org/draft-06/schema#');
$this->metaSchema = JsonReference\Dereferencer::draft6()->dereference('http://json-schema.org/draft-06/schema#');
// Create service.
$this->service = \Drupal::service('marketing_cloud_messages.service');
// Get marketing_cloud_assets config object.
......@@ -129,7 +129,7 @@ class MarketingCloudMessagesTest extends BrowserTestBase {
$this->assertNotEmpty($schema, "json schema for $machineName definition is empty.");
$schema = json_decode($schema);
$this->assertNotEmpty($schema, "json schema for $machineName definition is invalid json.");
$validator = new Validator($schema, $this->metaSchema);
$validator = new JsonGuard\Validator($schema, $this->metaSchema);
$this->assertNotFalse($validator->passes(), "schema validation failed for $machineName.");
}
......
......@@ -2,8 +2,8 @@
namespace Drupal\Tests\marketing_cloud_platform\Functional;
use JsonGuard\Validator;
use JsonReference\Dereferencer;
use League\JsonGuard;
use League\JsonReference;
use Drupal\Tests\BrowserTestBase;
/**
......@@ -45,7 +45,7 @@ class MarketingCloudPlatformTest extends BrowserTestBase {
->set('do_not_send', TRUE)
->save();
// Get schema validator.
$this->metaSchema = Dereferencer::draft6()->dereference('http://json-schema.org/draft-06/schema#');
$this->metaSchema = JsonReference\Dereferencer::draft6()->dereference('http://json-schema.org/draft-06/schema#');
// Create service.
$this->service = \Drupal::service('marketing_cloud_platform.service');
// Get config object.
......@@ -121,7 +121,7 @@ class MarketingCloudPlatformTest extends BrowserTestBase {
$this->assertNotEmpty($schema, "json schema for $machineName definition is empty.");
$schema = json_decode($schema);
$this->assertNotEmpty($schema, "json schema for $machineName definition is invalid json.");
$validator = new Validator($schema, $this->metaSchema);
$validator = new JsonGuard\Validator($schema, $this->metaSchema);
$this->assertNotFalse($validator->passes(), "schema validation failed for $machineName.");
}
......
......@@ -2,8 +2,8 @@
namespace Drupal\Tests\marketing_cloud_push\Functional;
use JsonGuard\Validator;
use JsonReference\Dereferencer;
use League\JsonGuard;
use League\JsonReference;
use Drupal\Tests\BrowserTestBase;
/**
......@@ -45,7 +45,7 @@ class MarketingCloudPushTest extends BrowserTestBase {
->set('do_not_send', TRUE)
->save();
// Get schema validator.
$this->metaSchema = Dereferencer::draft6()->dereference('http://json-schema.org/draft-06/schema#');
$this->metaSchema = JsonReference\Dereferencer::draft6()->dereference('http://json-schema.org/draft-06/schema#');
// Create service.
$this->service = \Drupal::service('marketing_cloud_push.service');
// Get config object.
......@@ -683,7 +683,7 @@ class MarketingCloudPushTest extends BrowserTestBase {
$this->assertNotEmpty($schema, "json schema for $machineName definition is empty.");
$schema = json_decode($schema);
$this->assertNotEmpty($schema, "json schema for $machineName definition is invalid json.");
$validator = new Validator($schema, $this->metaSchema);
$validator = new JsonGuard\Validator($schema, $this->metaSchema);
$this->assertNotFalse($validator->passes(), "schema validation failed for $machineName.");
}
......
......@@ -2,8 +2,8 @@
namespace Drupal\Tests\marketing_cloud_sms\Functional;
use JsonGuard\Validator;
use JsonReference\Dereferencer;
use League\JsonGuard;
use League\JsonReference;
use Drupal\Tests\BrowserTestBase;
/**
......@@ -45,7 +45,7 @@ class MarketingCloudSMSTest extends BrowserTestBase {
->set('do_not_send', TRUE)
->save();
// Get schema validator.
$this->metaSchema = Dereferencer::draft6()->dereference('http://json-schema.org/draft-06/schema#');
$this->metaSchema = JsonReference\Dereferencer::draft6()->dereference('http://json-schema.org/draft-06/schema#');
// Create service.
$this->service = \Drupal::service('marketing_cloud_sms.service');
// Get config object.
......@@ -720,7 +720,7 @@ class MarketingCloudSMSTest extends BrowserTestBase {
$this->assertNotEmpty($schema, "json schema for $machineName definition is empty.");
$schema = json_decode($schema);
$this->assertNotEmpty($schema, "json schema for $machineName definition is invalid json.");
$validator = new Validator($schema, $this->metaSchema);
$validator = new JsonGuard\Validator($schema, $this->metaSchema);
$this->assertNotFalse($validator->passes(), "schema validation failed for $machineName.");
}
......
......@@ -2,8 +2,8 @@
namespace Drupal\marketing_cloud;
use JsonGuard\Validator;
use JsonReference\Dereferencer;
use League\JsonGuard;
use League\JsonReference;
use GuzzleHttp\Exception\RequestException;
use Drupal\Core\Config\ConfigFactoryInterface;
use Drupal\Core\Logger\LoggerChannelFactory;
......@@ -149,8 +149,8 @@ abstract class MarketingCloudService {
// Validate the schema.
if ($validateSchema) {
$metaSchema = Dereferencer::draft6()->dereference('http://json-schema.org/draft-06/schema#');
$validator = new Validator($schema, $metaSchema);
$metaSchema = JsonReference\Dereferencer::draft6()->dereference('http://json-schema.org/draft-06/schema#');
$validator = new JsonGuard\Validator($schema, $metaSchema);
if ($validator->fails()) {
$message = $this->t('Errors were found in the schema for %machine_name in %module_name. Please check the logs.', ['%machine_name' => $machineName, '%module_name' => $moduleName]);
drupal_set_message($message, 'error');
......@@ -172,7 +172,7 @@ abstract class MarketingCloudService {
// Validate input JSON against endpoint schema.
if ($validateJson) {
$validator = new Validator($data, $schema);
$validator = new JsonGuard\Validator($data, $schema);
if ($validator->fails()) {
$errors = $validator->errors();
foreach ($errors as $error) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment