Skip to content

Commit

Permalink
EWPP-109: Replace deprecated rdf_entity code.
Browse files Browse the repository at this point in the history
  • Loading branch information
imanoleguskiza committed Oct 13, 2020
1 parent 623e865 commit 54a9863
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 9 deletions.
4 changes: 2 additions & 2 deletions tests/src/FunctionalJavascript/MessageFormTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
use Drupal\Component\Utility\Unicode;
use Drupal\Core\Test\AssertMailTrait;
use Drupal\node\Entity\Node;
use Drupal\Tests\rdf_entity\Traits\RdfDatabaseConnectionTrait;
use Drupal\Tests\sparql_entity_storage\Traits\SparqlConnectionTrait;
use Drupal\user\Entity\Role;
use Drupal\user\RoleInterface;

Expand All @@ -18,7 +18,7 @@
*/
class MessageFormTest extends WebDriverTestBase {

use RdfDatabaseConnectionTrait;
use SparqlConnectionTrait;

use AssertMailTrait {
getMails as drupalGetMails;
Expand Down
10 changes: 5 additions & 5 deletions tests/src/Kernel/AccessTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,10 @@ public function testContactFormAccess(): void {

// Assert user with "access corporate contact form" permission has access
// to contact_message entity.
$account1 = $this->createUser(['name' => 'test1', 'uid' => 2], ['access site-wide contact form', 'access corporate contact form']);
$account1 = $this->createUser(['access site-wide contact form', 'access corporate contact form'], NULL, FALSE, ['name' => 'test1', 'uid' => 2]);
$this->assertTrue($message_storage->getAccessControlHandler('contact_message')->createAccess($contact_form->id(), $account1));
// Assert user without "access corporate contact form" permission does not.
$account2 = $this->createUser(['name' => 'test2', 'uid' => 3], ['access site-wide contact form']);
$account2 = $this->createUser(['access site-wide contact form'], NULL, FALSE, ['name' => 'test2', 'uid' => 3]);
$this->assertFalse($message_storage->getAccessControlHandler('contact_message')->createAccess($contact_form->id(), $account2));

// Assert form without allow_canonical_url is forbidden.
Expand All @@ -55,7 +55,7 @@ public function testContactFormAccess(): void {
])->access($account1));
// Assert form without allow_canonical_url is allowed for users with
// 'administer contact forms' permission.
$account3 = $this->createUser(['name' => 'test3', 'uid' => 4], ['access site-wide contact form', 'administer contact forms']);
$account3 = $this->createUser(['access site-wide contact form', 'administer contact forms'], NULL, FALSE, ['name' => 'test3', 'uid' => 4]);
$this->assertTrue(Url::fromRoute('entity.contact_form.canonical', [
'contact_form' => $contact_form->id(),
])->access($account3));
Expand Down Expand Up @@ -135,10 +135,10 @@ public function testContactBlockAccess(): void {

// Assert user with "access corporate contact form" permission has access
// to contact form block.
$account1 = $this->createUser(['name' => 'test1'], ['access corporate contact form']);
$account1 = $this->createUser(['access corporate contact form'], 'test1');
$this->assertTrue($plugin->access($account1));
// Assert user without "access corporate contact form" permission does not.
$account2 = $this->createUser(['name' => 'test2'], ['access site-wide contact form']);
$account2 = $this->createUser(['access site-wide contact form'], 'test2');
$this->assertFalse($plugin->access($account2));

// Toggle the status of the contact form.
Expand Down
11 changes: 9 additions & 2 deletions tests/src/Kernel/ContactFormTestBase.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,24 @@

namespace Drupal\Tests\oe_contact_forms\Kernel;

use Drupal\Tests\rdf_entity\Kernel\RdfKernelTestBase;
use Drupal\Tests\sparql_entity_storage\Kernel\SparqlKernelTestBase;
use Drupal\Tests\user\Traits\UserCreationTrait;

/**
* Base test class for contact form kernel tests.
*/
class ContactFormTestBase extends RdfKernelTestBase {
class ContactFormTestBase extends SparqlKernelTestBase {

use UserCreationTrait;

/**
* {@inheritdoc}
*/
public static $modules = [
'path',
'options',
'user',
'system',
'telephone',
'contact',
'contact_storage',
Expand All @@ -32,6 +37,8 @@ protected function setUp(): void {
parent::setUp();
$this->installEntitySchema('path_alias');
$this->installEntitySchema('contact_message');
$this->installEntitySchema('user');
$this->installSchema('system', 'sequences');
}

}

0 comments on commit 54a9863

Please sign in to comment.