Unverified Commit ab51b94d authored by Kingdutch's avatar Kingdutch Committed by Kingdutch

Issue #3149492 by Kingdutch, BramDriesen, _kom__: Automated Drupal 9 compatibility fixes

parent 5ff43515
......@@ -57,11 +57,12 @@ function drush_yoast_seo_yoastseo_prepare_uninstall() {
// 3) Purge field data.
do {
field_purge_batch(1000);
$properties = array(
'deleted' => TRUE,
'include_deleted' => TRUE,
);
$fields = entity_load_multiple_by_properties('field_config', $properties);
$fields = \Drupal::entityTypeManager()
->getStorage('field_config')
->loadByProperties([
'deleted' => TRUE,
'include_deleted' => TRUE,
]);
} while ($fields);
}
......@@ -138,7 +138,7 @@ class YoastSeoConfigForm extends FormBase {
}
}
drupal_set_message($this->t('Real-time SEO configuration by bundles has been saved successfully.'));
\Drupal::messenger()->addMessage($this->t('Real-time SEO configuration by bundles has been saved successfully.'));
}
/**
......
......@@ -2,14 +2,14 @@
namespace Drupal\yoast_seo\Tests;
use Drupal\simpletest\WebTestBase;
use Drupal\Tests\BrowserTestBase;
/**
* Ensures that the Yoast Seo works correctly.
*
* @group YoastSeo
*/
class YoastSeoTest extends WebTestBase {
class YoastSeoTest extends BrowserTestBase {
/**
* Admin user.
......@@ -70,7 +70,7 @@ class YoastSeoTest extends WebTestBase {
$this->drupalGet('admin/config/yoast_seo');
$edit = [$entity_type . '[' . $bundle . ']' => $bundle];
json_decode($this->drupalPostForm(NULL, $edit, t('Save')));
$this->assertFieldChecked('edit-node-page');
$this->assertSession()->checkboxChecked('edit-node-page');
}
/**
......@@ -81,7 +81,7 @@ class YoastSeoTest extends WebTestBase {
$this->drupalGet('admin/config/yoast_seo');
$edit = [$entity_type . '[' . $bundle . ']' => FALSE];
json_decode($this->drupalPostForm(NULL, $edit, t('Save')));
$this->assertNoFieldChecked('edit-node-page');
$this->assertSession()->checkboxNotChecked('edit-node-page');
}
/**
......@@ -106,21 +106,21 @@ class YoastSeoTest extends WebTestBase {
// When I am adding an Entity Test content.
$this->drupalGet('node/add/page');
// Then I should not see the Yoast SEO section active.
$this->assertNoText('Yoast SEO for drupal');
$this->assertSession()->pageTextNotContains('Yoast SEO for drupal');
// When I enable Yoast SEO for the page bundle.
$this->enableYoastSeo('node', 'page');
// And I am adding an Entity Test content.
$this->drupalGet('node/add/page');
// Then I should see the Yoast SEO section active.
$this->assertText('Real-time SEO for drupal');
$this->assertSession()->pageTextContains('Real-time SEO for drupal');
// When I disable Yoast SEO for the page bundle.
$this->disableYoastSeo('node', 'page');
// And I am adding an Entity Test content.
$this->drupalGet('node/add/page');
// Then I should not see the Yoast SEO section active.
$this->assertNoText('Real-time SEO for drupal');
$this->assertSession()->pageTextNotContains('Real-time SEO for drupal');
}
}
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