Commit a7a9665c authored by borisson_'s avatar borisson_ Committed by borisson_
Browse files

Issue #2737361 by borisson_, legovaer, svendecabooter: Move all tests from...

Issue #2737361 by borisson_, legovaer, svendecabooter: Move all tests from simpletest to BrowserTestBase
parent 4f3fec7a
<?php
namespace Drupal\core_search_facets\Tests;
namespace Drupal\Tests\core_search_facets\Functional;
use Drupal\Core\StringTranslation\StringTranslationTrait;
use Drupal\facets\Tests\TestHelperTrait;
use Drupal\Tests\facets\Functional\TestHelperTrait;
use Drupal\field\Entity\FieldStorageConfig;
use Drupal\language\Entity\ConfigurableLanguage;
use Drupal\simpletest\WebTestBase as SimpletestWebTestBase;
use Drupal\Tests\BrowserTestBase;
/**
* Provides the base class for web tests for Core Search Facets.
*/
abstract class WebTestBase extends SimpletestWebTestBase {
abstract class FacetsHooksTestBase extends BrowserTestBase {
use StringTranslationTrait;
use TestHelperTrait;
......
<?php
namespace Drupal\core_search_facets\Tests;
namespace Drupal\Tests\core_search_facets\Functional;
use Drupal\field\Entity\FieldConfig;
use Drupal\field\Entity\FieldStorageConfig;
......@@ -10,7 +10,7 @@ use Drupal\field\Entity\FieldStorageConfig;
*
* @group facets
*/
class HooksTest extends WebTestBase {
class HooksTest extends FacetsHooksTestBase {
/**
* {@inheritdoc}
......
<?php
namespace Drupal\core_search_facets\Tests;
namespace Drupal\Tests\core_search_facets\Functional;
use Drupal\facets\Tests\BlockTestTrait;
use Drupal\Tests\facets\Functional\BlockTestTrait;
use Drupal\node\Entity\Node;
/**
......@@ -10,7 +10,7 @@ use Drupal\node\Entity\Node;
*
* @group facets
*/
class IntegrationTest extends WebTestBase {
class IntegrationTest extends FacetsHooksTestBase {
use BlockTestTrait;
......
......@@ -2,7 +2,7 @@
namespace Drupal\facets_summary\Tests;
use Drupal\facets\Tests\WebTestBase as FacetTestBase;
use Drupal\Tests\facets\Functional\FacetsTestBase;
use Symfony\Component\DependencyInjection\ContainerInterface;
/**
......@@ -10,7 +10,7 @@ use Symfony\Component\DependencyInjection\ContainerInterface;
*
* @group facets
*/
class IntegrationTest extends FacetTestBase {
class IntegrationTest extends FacetsTestBase {
/**
* {@inheritdoc}
......
<?php
namespace Drupal\rest_facets\Tests;
namespace Drupal\Tests\rest_facets\Functional;
use Drupal\facets\Tests\WebTestBase;
use Drupal\Tests\facets\Functional\FacetsTestBase;
use Symfony\Component\DependencyInjection\ContainerInterface;
/**
......@@ -10,7 +10,7 @@ use Symfony\Component\DependencyInjection\ContainerInterface;
*
* @group facets
*/
class RestIntegrationTest extends WebTestBase {
class RestIntegrationTest extends FacetsTestBase {
/**
* {@inheritdoc}
......
<?php
namespace Drupal\facets\Tests;
namespace Drupal\Tests\facets\Functional;
/**
* Shared test methods for facet blocks.
......
<?php
namespace Drupal\facets\Tests;
namespace Drupal\Tests\facets\Functional;
use Drupal\search_api\Entity\Index;
......
<?php
namespace Drupal\facets\Tests;
namespace Drupal\Tests\facets\Functional;
/**
* Tests the functionality of the facet source config entity.
*
* @group facets
*/
class FacetSourceTest extends WebTestBase {
class FacetSourceTest extends FacetsTestBase {
/**
* {@inheritdoc}
......@@ -78,8 +78,9 @@ class FacetSourceTest extends WebTestBase {
// Test that saving worked and that the url processor has the new value.
$this->assertField('filter_key');
$this->assertField('url_processor');
/** @var \Behat\Mink\Element\NodeElement[] $elements */
$elements = $this->xpath('//input[@id=:id]', [':id' => 'edit-url-processor-dummy-query']);
$this->assertEqual('dummy_query', $elements[0]['value']);
$this->assertEquals('dummy_query', $elements[0]->getValue());
}
}
<?php
namespace Drupal\facets\Tests;
namespace Drupal\Tests\facets\Functional;
use Drupal\Core\StringTranslation\StringTranslationTrait;
use Drupal\search_api\Entity\Index;
use Drupal\search_api\Entity\Server;
use Drupal\simpletest\WebTestBase as SimpletestWebTestBase;
use Drupal\Tests\BrowserTestBase;
/**
* Provides the base class for web tests for Search API.
*/
abstract class WebTestBase extends SimpletestWebTestBase {
abstract class FacetsTestBase extends BrowserTestBase {
use StringTranslationTrait;
use ExampleContentTrait;
......
<?php
namespace Drupal\facets\Tests;
namespace Drupal\Tests\facets\Functional;
use Drupal\Component\Utility\Unicode;
use Drupal\Core\Language\LanguageInterface;
......@@ -15,7 +15,7 @@ use Drupal\field\Tests\EntityReference\EntityReferenceTestTrait;
*
* @group facets
*/
class HierarchicalFacetIntegrationTest extends WebTestBase {
class HierarchicalFacetIntegrationTest extends FacetsTestBase {
use TaxonomyTestTrait;
use EntityReferenceTestTrait;
......
<?php
namespace Drupal\facets\Tests;
namespace Drupal\Tests\facets\Functional;
use Drupal\Core\Url;
use Drupal\facets\Entity\Facet;
......@@ -12,7 +12,7 @@ use Symfony\Component\DependencyInjection\ContainerInterface;
*
* @group facets
*/
class IntegrationTest extends WebTestBase {
class IntegrationTest extends FacetsTestBase {
public static $modules = ['views_ui'];
......@@ -817,8 +817,8 @@ class IntegrationTest extends WebTestBase {
// Try to submit a facet with a duplicate machine name after form rebuilding
// via facet source submit using AJAX.
$this->drupalPostAjaxForm(NULL, $form_values, array('facet_source_configure' => 'Configure facet source'));
$this->drupalPostForm(NULL, $form_values + $facet_source_configs, 'Save');
$this->submitForm($form_values, 'Configure facet source');
$this->submitForm($form_values + $facet_source_configs, 'Save');
$this->assertText('The machine-readable name is already in use. It must be unique.');
}
......
<?php
namespace Drupal\facets\Tests;
namespace Drupal\Tests\facets\Functional;
use Drupal\language\Entity\ConfigurableLanguage;
......@@ -9,7 +9,7 @@ use Drupal\language\Entity\ConfigurableLanguage;
*
* @group facets
*/
class LanguageIntegrationTest extends WebTestBase {
class LanguageIntegrationTest extends FacetsTestBase {
/**
* {@inheritdoc}
......
<?php
namespace Drupal\facets\Tests;
namespace Drupal\Tests\facets\Functional;
use Symfony\Component\DependencyInjection\ContainerInterface;
......@@ -9,7 +9,7 @@ use Symfony\Component\DependencyInjection\ContainerInterface;
*
* @group facets
*/
class ProcessorIntegrationTest extends WebTestBase {
class ProcessorIntegrationTest extends FacetsTestBase {
/**
* The url of the edit form.
......
<?php
namespace Drupal\facets\Tests;
namespace Drupal\Tests\facets\Functional;
use Drupal\Component\Render\FormattableMarkup;
use Drupal\Core\Url;
......@@ -128,7 +128,11 @@ trait TestHelperTrait {
* The label of a link to click.
*/
protected function clickPartialLink($label) {
$this->clickLinkHelper($label, 0, '//a[starts-with(normalize-space(), :label)]');
$label = (string) $label;
$xpath = $this->assertSession()->buildXPathQuery('//a[starts-with(normalize-space(), :label)]', [':label' => $label]);
$links = $this->getSession()->getPage()->findAll('xpath', $xpath);
$links[0]->click();
}
/**
......
<?php
namespace Drupal\facets\Tests;
namespace Drupal\Tests\facets\Functional;
use Drupal\Core\Url;
use Drupal\facets\FacetInterface;
......@@ -13,7 +13,7 @@ use Symfony\Component\DependencyInjection\ContainerInterface;
*
* @group facets
*/
class UrlIntegrationTest extends WebTestBase {
class UrlIntegrationTest extends FacetsTestBase {
/**
* {@inheritdoc}
......
<?php
namespace Drupal\facets\Tests;
namespace Drupal\Tests\facets\Functional;
/**
* Tests the overall functionality of the Facets admin UI.
*
* @group facets
*/
class WidgetIntegrationTest extends WebTestBase {
class WidgetIntegrationTest extends FacetsTestBase {
/**
* {@inheritdoc}
......
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