Skip to content
Snippets Groups Projects
Commit 4231865d authored by Bojan Živanović's avatar Bojan Živanović
Browse files

Issue #3116756 by bojanz: Get the tests closer to passing on D9

parent d52bbf27
No related branches found
Tags 8.x-2.17
No related merge requests found
......@@ -139,11 +139,13 @@ abstract class CommerceWebDriverTestBase extends WebDriverTestBase {
*/
protected function assertRenderedAddress(array $address, $container = 'profile') {
$page = $this->getSession()->getPage();
$address_text = $page->find('css', 'p.address')->getText();
foreach ($address as $property => $value) {
if ($property == 'country_code') {
$value = $this->countryList[$value];
}
$this->assertContains($value, $page->find('css', 'p.address')->getText());
// Can't use assertContains() while maintaining D9 compatibility.
$this->assertTrue(strpos($address_text, $value) !== FALSE);
$this->assertSession()->fieldNotExists($container . "[address][0][address][$property]");
}
$this->assertSession()->fieldNotExists($container . '[copy_to_address_book]');
......
......@@ -56,6 +56,12 @@ abstract class CommerceKernelTestBase extends EntityKernelTestBase {
$factory->register(new NumberComparator());
$factory->register(new PriceComparator());
// Drupal 8.8 installs path_alias automatically, but D9 doesn't.
// However, we can't add path_alias to modules until 8.7 support is dropped.
// @todo Clean up when Drupal 8.7 is no longer supported.
if (version_compare(\Drupal::VERSION, '9.0.0-alpha1') >= 0 || version_compare(\Drupal::VERSION, '9.0.0-dev') == 0) {
$this->enableModules(['path_alias']);
}
if (\Drupal::entityTypeManager()->hasDefinition('path_alias')) {
$this->installEntitySchema('path_alias');
}
......
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