Skip to content

Commit

Permalink
Issue #3085705 by jhedstrom: Fix deprecations
Browse files Browse the repository at this point in the history
  • Loading branch information
jhedstrom committed Oct 4, 2019
1 parent fc63486 commit ef11d65
Show file tree
Hide file tree
Showing 8 changed files with 21 additions and 16 deletions.
9 changes: 8 additions & 1 deletion message_subscribe_email/message_subscribe_email.install
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,14 @@
*/
function message_subscribe_email_install() {
// Add the `message_subscribe_email` field to the user form.
$display = entity_get_form_display('user', 'user', 'default');
/** @var \Drupal\Core\Entity\Display\EntityViewDisplayInterface $display */
if (method_exists(\Drupal::service('entity_display.repository'), 'getFormDisplay')) {
$display = \Drupal::service('entity_display.repository')->getFormDisplay('user', 'user');
}
else {
// Pre-Drupal 8.8.
$display = entity_get_form_display('user', 'user', 'default');
}
if (!$display->getComponent('message_subscribe_email')) {
$settings = [
'type' => 'boolean_checkbox',
Expand Down
2 changes: 1 addition & 1 deletion message_subscribe_email/message_subscribe_email.module
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ function message_subscribe_email_message_subscribe_get_subscribers_alter(array &
continue;
}

$query = db_select('flagging', 'f');
$query = \Drupal::database()->select('flagging', 'f');
$result = $query->fields('f', ['uid'])
->condition('flag_id', $flag_ids, 'IN')
->condition('uid', array_keys($uids), 'IN')
Expand Down
4 changes: 2 additions & 2 deletions message_subscribe_email/tests/src/Functional/ViewsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

namespace Drupal\Tests\message_subscribe_email\Functional;

use Drupal\simpletest\ContentTypeCreationTrait;
use Drupal\simpletest\NodeCreationTrait;
use Drupal\Tests\node\Traits\ContentTypeCreationTrait;
use Drupal\Tests\node\Traits\NodeCreationTrait;
use Drupal\Tests\BrowserTestBase;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@

namespace Drupal\Tests\message_subscribe_email\FunctionalJavascript;

use Drupal\FunctionalJavascriptTests\JavascriptTestBase;
use Drupal\FunctionalJavascriptTests\WebDriverTestBase;

/**
* Javascript tests for message subscribe email.
*
* @group message_subscribe_email
*/
class MessageSubscribeEmailTest extends JavascriptTestBase {
class MessageSubscribeEmailTest extends WebDriverTestBase {

/**
* {@inheritdoc}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
namespace Drupal\Tests\message_subscribe_ui\Functional;

use Drupal\entity_test\FieldStorageDefinition;
use Drupal\field\Tests\EntityReference\EntityReferenceTestTrait;
use Drupal\Tests\field\Traits\EntityReferenceTestTrait;
use Drupal\Tests\BrowserTestBase;
use Drupal\Tests\taxonomy\Functional\TaxonomyTestTrait;
use Drupal\Tests\taxonomy\Traits\TaxonomyTestTrait;

/**
* Tests for the advanced subscriptions block.
Expand Down
2 changes: 1 addition & 1 deletion tests/src/Kernel/ContextTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
use Drupal\comment\Entity\Comment;
use Drupal\comment\Tests\CommentTestTrait;
use Drupal\Core\Field\FieldStorageDefinitionInterface;
use Drupal\field\Tests\EntityReference\EntityReferenceTestTrait;
use Drupal\Tests\field\Traits\EntityReferenceTestTrait;
use Drupal\og\Og;
use Drupal\og\OgGroupAudienceHelper;
use Drupal\taxonomy\Entity\Term;
Expand Down
9 changes: 4 additions & 5 deletions tests/src/Kernel/MessageSubscribeTestBase.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,10 @@

namespace Drupal\Tests\message_subscribe\Kernel;

use Drupal\Component\Utility\Unicode;
use Drupal\KernelTests\KernelTestBase;
use Drupal\simpletest\ContentTypeCreationTrait;
use Drupal\simpletest\NodeCreationTrait;
use Drupal\simpletest\UserCreationTrait;
use Drupal\Tests\node\Traits\ContentTypeCreationTrait;
use Drupal\Tests\node\Traits\NodeCreationTrait;
use Drupal\Tests\user\Traits\UserCreationTrait;
use Drupal\Tests\message\Kernel\MessageTemplateCreateTrait;

/**
Expand Down Expand Up @@ -64,7 +63,7 @@ public function setUp() {
$this->installConfig(['field', 'filter', 'node', 'message_subscribe']);

// Add a message template.
$this->template = $this->createMessageTemplate(Unicode::strtolower($this->randomMachineName()), $this->randomString(), $this->randomString(), [$this->randomString()]);
$this->template = $this->createMessageTemplate(mb_strtolower($this->randomMachineName()), $this->randomString(), $this->randomString(), [$this->randomString()]);
}

}
3 changes: 1 addition & 2 deletions tests/src/Kernel/SubscribersTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

namespace Drupal\Tests\message_subscribe\Kernel;

use Drupal\Component\Utility\Unicode;
use Drupal\Core\Session\AccountInterface;
use Drupal\Core\Test\AssertMailTrait;
use Drupal\field\Entity\FieldConfig;
Expand Down Expand Up @@ -405,7 +404,7 @@ public function testNotifyEntityOwner() {
* @covers ::sendMessage
*/
public function testFieldedMessageBundles() {
$field_name = Unicode::strtolower($this->randomMachineName());
$field_name = mb_strtolower($this->randomMachineName());
$field_storage = FieldStorageConfig::create([
'field_name' => $field_name,
'entity_type' => 'message',
Expand Down

0 comments on commit ef11d65

Please sign in to comment.