Skip to content
Snippets Groups Projects
Commit 8cb280be authored by Aaron Bauman's avatar Aaron Bauman Committed by Aaron Bauman
Browse files

Issue #2975914 by AaronBauman: Allow Dynamic Entity Reference 1.x or 2.x

parents 26480900 a82e7a38
No related branches found
No related tags found
No related merge requests found
...@@ -3,8 +3,6 @@ ...@@ -3,8 +3,6 @@
namespace Drupal\Tests\salesforce_jwt\FunctionalJavascript; namespace Drupal\Tests\salesforce_jwt\FunctionalJavascript;
use Drupal\FunctionalJavascriptTests\WebDriverTestBase; use Drupal\FunctionalJavascriptTests\WebDriverTestBase;
use Drupal\key\Entity\Key;
use Drupal\Tests\key\Functional\KeyTestTrait;
/** /**
* Test JWT Auth. * Test JWT Auth.
...@@ -20,7 +18,12 @@ class SalesforceJwtTest extends WebDriverTestBase { ...@@ -20,7 +18,12 @@ class SalesforceJwtTest extends WebDriverTestBase {
*/ */
protected $defaultTheme = 'stark'; protected $defaultTheme = 'stark';
use KeyTestTrait; /**
* A key entity to use for testing.
*
* @var \Drupal\key\KeyInterface
*/
protected $testKey;
/** /**
* Modules. * Modules.
...@@ -56,7 +59,7 @@ class SalesforceJwtTest extends WebDriverTestBase { ...@@ -56,7 +59,7 @@ class SalesforceJwtTest extends WebDriverTestBase {
$this->adminUser = $this->drupalCreateUser(['authorize salesforce']); $this->adminUser = $this->drupalCreateUser(['authorize salesforce']);
$this->drupalLogin($this->adminUser); $this->drupalLogin($this->adminUser);
$this->createTestKey(self::KEY_ID, 'authentication', 'file'); $this->createTestKey(self::KEY_ID, 'authentication', 'file');
Key::load(self::KEY_ID) \Drupal\key\Entity\Key::load(self::KEY_ID)
->set('key_provider_settings', [ ->set('key_provider_settings', [
'file_location' => __DIR__ . '/testKey.pem', 'file_location' => __DIR__ . '/testKey.pem',
'strip_line_breaks' => FALSE, 'strip_line_breaks' => FALSE,
...@@ -104,4 +107,23 @@ class SalesforceJwtTest extends WebDriverTestBase { ...@@ -104,4 +107,23 @@ class SalesforceJwtTest extends WebDriverTestBase {
$assert_session->pageTextContainsOnce('Salesforce JWT OAuth'); $assert_session->pageTextContainsOnce('Salesforce JWT OAuth');
} }
/**
* Make a key for testing operations that require a key.
*/
protected function createTestKey($id, $type = NULL, $provider = NULL) {
$keyArgs = [
'id' => $id,
'label' => 'Test key',
];
if ($type != NULL) {
$keyArgs['key_type'] = $type;
}
if ($provider != NULL) {
$keyArgs['key_provider'] = $provider;
}
$this->testKey = \Drupal\key\Entity\Key::create($keyArgs);
$this->testKey->save();
return $this->testKey;
}
} }
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
], ],
"require": { "require": {
"php": ">=5.6.0", "php": ">=5.6.0",
"drupal/dynamic_entity_reference": "^2.0@alpha10", "drupal/dynamic_entity_reference": "^1.9 || ^2.0",
"drupal/typed_data": "^1.0-alpha5" "drupal/typed_data": "^1.0-alpha5"
}, },
"extra": { "extra": {
...@@ -20,4 +20,4 @@ ...@@ -20,4 +20,4 @@
} }
} }
} }
} }
\ No newline at end of file
...@@ -5,5 +5,5 @@ package: Salesforce ...@@ -5,5 +5,5 @@ package: Salesforce
core_version_requirement: ^8.7.7 || ^9 core_version_requirement: ^8.7.7 || ^9
dependencies: dependencies:
- salesforce:salesforce - salesforce:salesforce
- dynamic_entity_reference:dynamic_entity_reference (>= 2.0-alpha10) - dynamic_entity_reference:dynamic_entity_reference
- typed_data:typed_data (>= 1.0-alpha5) - typed_data:typed_data (>= 1.0-alpha5)
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