Commit 71abbb92 authored by borisson_'s avatar borisson_ Committed by borisson_

Issue #2858326 by borisson_: Fix test failure

parent e1a1ad02
......@@ -11,7 +11,7 @@ use Drupal\Tests\BrowserTestBase;
/**
* Provides the base class for web tests for Core Search Facets.
*/
abstract class FacetsHooksTestBase extends BrowserTestBase {
abstract class CoreSearchFacetsTestBase extends BrowserTestBase {
use StringTranslationTrait;
use TestHelperTrait;
......@@ -78,14 +78,14 @@ abstract class FacetsHooksTestBase extends BrowserTestBase {
// the same value per nid and langcode.
$created_time_en = new \DateTime('February ' . $i . ' 2016 ' . str_pad($i, 2, STR_PAD_LEFT, 0) . 'PM');
$created_time_es = new \DateTime('March ' . $i . ' 2016 ' . str_pad($i, 2, STR_PAD_LEFT, 0) . 'PM');
$node = $this->drupalCreateNode(array(
$node = $this->drupalCreateNode([
'title' => 'test page' . $i . ' EN',
'body' => 'test page' . $i,
'type' => 'page',
'created' => $created_time_en->format('U'),
'changed' => $created_time_en->format('U'),
'langcode' => 'en',
));
]);
// Add Spanish translation to the node.
$node->addTranslation('es', [
......@@ -98,26 +98,26 @@ abstract class FacetsHooksTestBase extends BrowserTestBase {
}
$created_time = new \DateTime('March 9 2016 11PM');
$this->drupalCreateNode(array(
$this->drupalCreateNode([
'title' => 'test page 10 EN',
'body' => 'test page10',
'type' => 'page',
'created' => $created_time->format('U'),
'changed' => ((int) $created_time->format('U') + 250),
'langcode' => 'en',
));
]);
// Add 10 nodes of the type article.
for ($i = 1; $i <= 10; $i++) {
$created_time = new \DateTime('April ' . $i . ' 2016 ' . str_pad($i, 2, STR_PAD_LEFT, 0) . 'PM');
$this->drupalCreateNode(array(
$this->drupalCreateNode([
'title' => 'test article' . $i . ' EN',
'body' => 'test article' . $i,
'type' => 'article',
'created' => $created_time->format('U'),
'changed' => ((int) $created_time->format('U') + 250),
'langcode' => 'en',
));
]);
}
// Create the users used for the tests.
......
......@@ -10,16 +10,13 @@ use Drupal\field\Entity\FieldStorageConfig;
*
* @group facets
*/
class HooksTest extends FacetsHooksTestBase {
class TestCoreSearchBase extends CoreSearchFacetsTestBase {
/**
* {@inheritdoc}
*/
public static $modules = [
'node',
'search',
'core_search_facets_test_hooks',
'field',
];
/**
......@@ -65,7 +62,7 @@ class HooksTest extends FacetsHooksTestBase {
);
// The field appears as expected.
$this->assertText('Float Field Label', 'Float Field appears as expected');
$this->assertText('Float Field Label');
}
}
......@@ -10,7 +10,7 @@ use Drupal\node\Entity\Node;
*
* @group facets
*/
class IntegrationTest extends FacetsHooksTestBase {
class IntegrationTestCoreSearchBase extends CoreSearchFacetsTestBase {
use BlockTestTrait;
......@@ -157,12 +157,13 @@ class IntegrationTest extends FacetsHooksTestBase {
search_update_totals();
$this->drupalGet('search/node', ['query' => ['keys' => 'test']]);
$this->clickLink('2016 (21)');
$this->assertFacetLabel('June 2016 (1)');
$this->clickPartialLink('June 2016');
$this->assertResponse(200);
$this->assertSession()->statusCodeEquals(200);
$this->assertFacetLabel('June 3, 2016 (1)');
$this->clickPartialLink('June 3, 2016');
$this->assertResponse(200);
$this->assertSession()->statusCodeEquals(200);
}
/**
......
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