You are here

class GeolocationGeometryGeometryTest in Geolocation Field 8.3

Tests the new entity API for the geolocation field type.

@group geolocation_geometry

Hierarchy

Expanded class hierarchy of GeolocationGeometryGeometryTest

File

modules/geolocation_geometry/tests/src/Kernel/GeolocationGeometryGeometryTest.php, line 14

Namespace

Drupal\Tests\geolocation_geometry\Kernel
View source
class GeolocationGeometryGeometryTest extends FieldKernelTestBase {

  /**
   * Modules to enable.
   *
   * @var array
   */
  public static $modules = [
    'geolocation',
    'geolocation_geometry',
  ];

  /**
   * {@inheritdoc}
   */
  protected function setUp() {
    parent::setUp();

    // Create a geolocation field storage and field for validation.
    FieldStorageConfig::create([
      'field_name' => 'field_geometry',
      'entity_type' => 'entity_test',
      'type' => 'geolocation_geometry_geometry',
    ])
      ->save();
    FieldConfig::create([
      'field_name' => 'field_geometry',
      'label' => 'Geolocation Geometry',
      'entity_type' => 'entity_test',
      'bundle' => 'entity_test',
    ])
      ->save();

    // Create a geolocation field storage and field for validation.
    FieldStorageConfig::create([
      'field_name' => 'field_polygon',
      'entity_type' => 'entity_test',
      'type' => 'geolocation_geometry_polygon',
    ])
      ->save();
    FieldConfig::create([
      'field_name' => 'field_polygon',
      'label' => 'Geolocation Polygon',
      'entity_type' => 'entity_test',
      'bundle' => 'entity_test',
    ])
      ->save();
  }

  /**
   * Tests using entity fields of the geolocation field type.
   */
  public function testGeolocationItem() {
    $entityTestStorage = \Drupal::entityTypeManager()
      ->getStorage('entity_test');
    $kenya = [
      'wkt' => 'POLYGON((39.202 -4.676,39.604 -4.346,39.8 -3.681,40.121 -3.277,40.263 -2.573,40.637 -2.499,40.884 -2.082,41.585 -1.683,40.993 -0.858,40.981 2.784,41.855 3.918,41.171 3.91,40.768 4.257,39.854 3.838,39.55 3.422,38.892 3.5,38.671 3.616,38.436 3.588,38.12 3.598,36.855 4.447,36.159 4.447,35.817 4.776,35.817 5.338,35.298 5.506,34.62 4.847,34.005 4.249,34.479 3.555,34.596 3.053,35.035 1.905,34.672 1.176,34.18 0.515,33.893 0.109,33.903 -0.95,34.072 -1.059,37.698 -3.096,37.766 -3.677,39.202 -4.676))',
      'geojson' => '{"type": "Polygon", "coordinates": [[[39.202, -4.676], [39.604, -4.346], [39.8, -3.681], [40.121, -3.277], [40.263, -2.573], [40.637, -2.499], [40.884, -2.082], [41.585, -1.683], [40.993, -0.858], [40.981, 2.784], [41.855, 3.918], [41.171, 3.91], [40.768, 4.257], [39.854, 3.838], [39.55, 3.422], [38.892, 3.5], [38.671, 3.616], [38.436, 3.588], [38.12, 3.598], [36.855, 4.447], [36.159, 4.447], [35.817, 4.776], [35.817, 5.338], [35.298, 5.506], [34.62, 4.847], [34.005, 4.249], [34.479, 3.555], [34.596, 3.053], [35.035, 1.905], [34.672, 1.176], [34.18, 0.515], [33.893, 0.109], [33.903, -0.95], [34.072, -1.059], [37.698, -3.096], [37.766, -3.677], [39.202, -4.676]]]}',
    ];
    $chile = [
      'wkt' => 'MULTIPOLYGON(((-68.63401022758323 -52.63637045887449,-69.34564999999992 -52.518299999999954,-70.26747999999998 -52.93123000000003,-70.59177999999986 -53.61582999999996,-71.10773 -54.07432999999992,-72.43417999999997 -53.71539999999999,-73.8381 -53.04743000000002,-74.66253 -52.837489999999946,-73.28519999999997 -53.95751999999993,-72.26390000000004 -54.49513999999999,-71.00567999999998 -55.053830000000005,-69.95808999999997 -55.19843000000003,-69.2321 -55.49905999999993,-68.63999081081187 -55.58001799908692,-68.14862999999991 -55.61183,-67.29102999999992 -55.30123999999995,-66.95992000000001 -54.896810000000016,-67.56244 -54.87001,-68.63335000000001 -54.869499999999995,-68.63401022758323 -52.63637045887449)),((-69.59042375352405 -17.580011895419332,-69.85844356960587 -18.092693780187012,-70.37257239447771 -18.34797535570887,-70.16441972520605 -19.756468194256165,-70.09124589708074 -21.39331918710126,-70.40396582709502 -23.628996677344578,-70.72495398627599 -25.705924167587256,-70.90512386746161 -27.640379734001247,-71.48989437527645 -28.861442152625923,-71.37008256700773 -30.09568206148503,-71.66872066922247 -30.920644626592495,-71.4384504869299 -32.41889942803078,-71.86173214383263 -33.90909270603153,-72.55313696968174 -35.50884002049106,-73.1667170884993 -37.12378020604439,-73.58806087919109 -37.15628468195598,-73.50555945503712 -38.282882582351114,-73.21759253609065 -39.25868865331856,-73.67709937202999 -39.94221282324317,-74.0179571194272 -41.79481292090683,-74.33194312203261 -43.22495818458442,-73.70133561877488 -43.365776462579774,-73.38889990913822 -42.117532240569574,-72.7178039211798 -42.38335580827898,-73.24035600451522 -44.4549606259956,-74.35170935738425 -44.10304412208794,-74.69215369332312 -45.76397633238103,-75.64439531116545 -46.64764332457207,-74.1265809801047 -46.93925343199511,-75.18276974150216 -47.7119194476232,-75.60801510283198 -48.67377288187184,-75.47975419788355 -50.37837167745158,-74.97663245308988 -51.0433956846157,-75.2600260077785 -51.62935475037325,-74.94676347522517 -52.262753588419,-73.7027567206629 -52.835070076051494,-73.7027567206629 -52.835069268607235,-72.55794287788488 -53.53141000118449,-71.429794684521 -53.85645476030037,-71.00633216010525 -53.83325204220132,-70.8451016913546 -52.89920052852571,-69.9427795071062 -52.53793059037322,-69.46128434922667 -52.29195077266391,-68.57154537624133 -52.299443855346226,-69.49836218939609 -52.14276091263727,-71.91480383979638 -52.0090223058659,-72.32940385607407 -51.42595631287243,-72.30997351753234 -50.67700977966632,-72.97574683296469 -50.741450290734285,-73.32805091011453 -50.378785088909915,-73.4154357571201 -49.31843637471297,-72.64824744331494 -48.87861825947683,-72.33116085477201 -48.2442383766618,-72.44735531278027 -47.73853281025352,-71.91725847033024 -46.88483814879177,-71.55200944689128 -45.5607329241771,-71.65931555854536 -44.973688653341426,-71.22277889675976 -44.784242852559416,-71.32980078803622 -44.407521661151655,-71.79362260607193 -44.207172133156064,-71.46405615913051 -43.787611179378345,-71.91542395698389 -43.40856454851745,-72.14889807807856 -42.254888197601375,-71.7468037584155 -42.05138640723598,-71.91573401557763 -40.83233936947069,-71.68076127794649 -39.808164157878046,-71.41351660834906 -38.91602223079114,-70.81466427273469 -38.55299529394074,-71.11862504747549 -37.57682748794724,-71.12188066270987 -36.65812387466232,-70.36476925320164 -36.00508879978992,-70.38804948594913 -35.16968759535949,-69.81730912950152 -34.1935714657983,-69.81477698431922 -33.273886000299825,-70.0743993801536 -33.09120981214805,-70.53506893581951 -31.36501026787031,-69.91900834825194 -30.33633920666828,-70.01355038112992 -29.367922865518572,-69.65613033718317 -28.45914112723369,-69.00123491074825 -27.52121388113618,-68.29554155137043 -26.89933969493578,-68.59479977077268 -26.506908868111296,-68.38600114609736 -26.185016371365215,-68.41765296087614 -24.51855478281688,-67.32844295924417 -24.02530323659095,-66.9852339341777 -22.98634856536284,-67.1066735500636 -22.735924574476417,-67.82817989772273 -22.872918796482175,-68.21991309271128 -21.494346612231865,-68.75716712103375 -20.372657972904463,-68.44222510443092 -19.40506845467143,-68.96681840684187 -18.981683444904107,-69.10024695501949 -18.26012542081268,-69.59042375352405 -17.580011895419332)))',
      'geojson' => '{"type":"MultiPolygon","coordinates":[[[[-68.63401022758323,-52.63637045887449],[-69.34564999999992,-52.518299999999954],[-70.26747999999998,-52.93123000000003],[-70.59177999999986,-53.61582999999996],[-71.10773,-54.07432999999992],[-72.43417999999997,-53.71539999999999],[-73.8381,-53.04743000000002],[-74.66253,-52.837489999999946],[-73.28519999999997,-53.95751999999993],[-72.26390000000004,-54.49513999999999],[-71.00567999999998,-55.053830000000005],[-69.95808999999997,-55.19843000000003],[-69.2321,-55.49905999999993],[-68.63999081081187,-55.58001799908692],[-68.14862999999991,-55.61183],[-67.29102999999992,-55.30123999999995],[-66.95992000000001,-54.896810000000016],[-67.56244,-54.87001],[-68.63335000000001,-54.869499999999995],[-68.63401022758323,-52.63637045887449]]],[[[-69.59042375352405,-17.580011895419332],[-69.85844356960587,-18.092693780187012],[-70.37257239447771,-18.34797535570887],[-70.16441972520605,-19.756468194256165],[-70.09124589708074,-21.39331918710126],[-70.40396582709502,-23.628996677344574],[-70.72495398627599,-25.705924167587256],[-70.90512386746161,-27.640379734001247],[-71.48989437527645,-28.861442152625923],[-71.37008256700773,-30.09568206148503],[-71.66872066922247,-30.920644626592495],[-71.4384504869299,-32.41889942803078],[-71.86173214383263,-33.90909270603153],[-72.55313696968174,-35.50884002049106],[-73.1667170884993,-37.12378020604439],[-73.58806087919109,-37.15628468195598],[-73.50555945503712,-38.282882582351114],[-73.21759253609065,-39.25868865331856],[-73.67709937202999,-39.94221282324317],[-74.0179571194272,-41.79481292090683],[-74.33194312203261,-43.22495818458442],[-73.70133561877488,-43.365776462579774],[-73.38889990913822,-42.117532240569574],[-72.7178039211798,-42.38335580827898],[-73.24035600451522,-44.454960625995604],[-74.35170935738425,-44.10304412208794],[-74.69215369332312,-45.76397633238103],[-75.64439531116545,-46.64764332457207],[-74.1265809801047,-46.93925343199511],[-75.18276974150216,-47.7119194476232],[-75.60801510283198,-48.67377288187184],[-75.47975419788355,-50.37837167745158],[-74.97663245308988,-51.0433956846157],[-75.2600260077785,-51.62935475037325],[-74.94676347522517,-52.262753588419],[-73.7027567206629,-52.835070076051494],[-73.7027567206629,-52.835069268607235],[-72.55794287788488,-53.53141000118449],[-71.429794684521,-53.85645476030037],[-71.00633216010525,-53.83325204220132],[-70.8451016913546,-52.89920052852571],[-69.9427795071062,-52.53793059037322],[-69.46128434922667,-52.29195077266391],[-68.57154537624133,-52.299443855346226],[-69.49836218939609,-52.14276091263727],[-71.91480383979638,-52.0090223058659],[-72.32940385607407,-51.42595631287243],[-72.30997351753234,-50.67700977966632],[-72.97574683296469,-50.741450290734285],[-73.32805091011453,-50.378785088909915],[-73.4154357571201,-49.31843637471297],[-72.64824744331494,-48.87861825947683],[-72.33116085477201,-48.2442383766618],[-72.44735531278027,-47.73853281025352],[-71.91725847033024,-46.88483814879177],[-71.55200944689128,-45.5607329241771],[-71.65931555854536,-44.973688653341426],[-71.22277889675976,-44.784242852559416],[-71.32980078803622,-44.407521661151655],[-71.79362260607193,-44.207172133156064],[-71.46405615913051,-43.787611179378345],[-71.91542395698389,-43.40856454851745],[-72.14889807807856,-42.254888197601375],[-71.7468037584155,-42.05138640723598],[-71.91573401557763,-40.83233936947069],[-71.68076127794649,-39.808164157878046],[-71.41351660834906,-38.91602223079114],[-70.81466427273469,-38.55299529394074],[-71.11862504747549,-37.57682748794724],[-71.12188066270987,-36.65812387466232],[-70.36476925320164,-36.00508879978992],[-70.38804948594913,-35.16968759535949],[-69.81730912950152,-34.1935714657983],[-69.81477698431922,-33.273886000299825],[-70.0743993801536,-33.09120981214805],[-70.53506893581951,-31.36501026787031],[-69.91900834825194,-30.33633920666828],[-70.01355038112992,-29.367922865518572],[-69.65613033718317,-28.459141127233686],[-69.00123491074825,-27.52121388113618],[-68.29554155137043,-26.89933969493578],[-68.59479977077268,-26.506908868111296],[-68.38600114609736,-26.185016371365215],[-68.41765296087614,-24.51855478281688],[-67.32844295924417,-24.02530323659095],[-66.9852339341777,-22.98634856536284],[-67.1066735500636,-22.735924574476417],[-67.82817989772273,-22.872918796482175],[-68.21991309271128,-21.494346612231865],[-68.75716712103375,-20.372657972904463],[-68.44222510443092,-19.40506845467143],[-68.96681840684187,-18.981683444904107],[-69.10024695501949,-18.260125420812678],[-69.59042375352405,-17.580011895419332]]]]}',
    ];

    // Verify entity creation.
    $geometry = $entityTestStorage
      ->create([
      'title' => $this
        ->randomMachineName(),
      'field_geometry' => [
        'wkt' => $kenya['wkt'],
      ],
    ]);
    $geometry
      ->save();

    /** @var \Drupal\entity_test\Entity\EntityTest $geometry */
    $geometry = $entityTestStorage
      ->load($geometry
      ->id());
    $this
      ->assertEquals($geometry
      ->get('field_geometry')->wkt, $kenya['wkt'], "WKT are identical.");
    $this
      ->assertEquals($geometry
      ->get('field_geometry')->geojson, $kenya['geojson'], "GeoJSON correctly derived from WKT.");
    $geometry = $entityTestStorage
      ->create([
      'title' => $this
        ->randomMachineName(),
      'field_geometry' => [
        'geojson' => $kenya['geojson'],
      ],
    ]);
    $geometry
      ->save();

    /** @var \Drupal\entity_test\Entity\EntityTest $geometry */
    $geometry = $entityTestStorage
      ->load($geometry
      ->id());
    $this
      ->assertEquals($geometry
      ->get('field_geometry')->geojson, $kenya['geojson'], "GeoJSON are identical.");
    $this
      ->assertEquals($geometry
      ->get('field_geometry')->wkt, $kenya['wkt'], "WKT correctly derived from GeoJSON.");
    $exception_thrown = FALSE;
    try {
      $entity = $entityTestStorage
        ->create([
        'title' => $this
          ->randomMachineName(),
        'field_polygon' => [
          'wkt' => $chile['wkt'],
        ],
      ]);
      $entity
        ->save();
    } catch (\Exception $e) {
      $exception_thrown = TRUE;
      $this
        ->assertStringContainsString("Cannot get geometry object from data you send to the GEOMETRY field", $e
        ->getMessage(), "Mismatching geometry type, exception should be thrown.");
    }
    $this
      ->assertTrue($exception_thrown, "Exception for mismatching geometry was thrown.");
  }

}

Members

Namesort descending Modifiers Type Description Overrides
AssertContentTrait::$content protected property The current raw content.
AssertContentTrait::$drupalSettings protected property The drupalSettings value from the current raw $content.
AssertContentTrait::$elements protected property The XML structure parsed from the current raw $content. 1
AssertContentTrait::$plainTextContent protected property The plain-text content of raw $content (text nodes).
AssertContentTrait::assertEscaped protected function Passes if the raw text IS found escaped on the loaded page, fail otherwise.
AssertContentTrait::assertField protected function Asserts that a field exists with the given name or ID.
AssertContentTrait::assertFieldById protected function Asserts that a field exists with the given ID and value.
AssertContentTrait::assertFieldByName protected function Asserts that a field exists with the given name and value.
AssertContentTrait::assertFieldByXPath protected function Asserts that a field exists in the current page by the given XPath.
AssertContentTrait::assertFieldChecked protected function Asserts that a checkbox field in the current page is checked.
AssertContentTrait::assertFieldsByValue protected function Asserts that a field exists in the current page with a given Xpath result.
AssertContentTrait::assertLink protected function Passes if a link with the specified label is found.
AssertContentTrait::assertLinkByHref protected function Passes if a link containing a given href (part) is found.
AssertContentTrait::assertNoDuplicateIds protected function Asserts that each HTML ID is used for just a single element.
AssertContentTrait::assertNoEscaped protected function Passes if the raw text IS NOT found escaped on the loaded page, fail otherwise.
AssertContentTrait::assertNoField protected function Asserts that a field does not exist with the given name or ID.
AssertContentTrait::assertNoFieldById protected function Asserts that a field does not exist with the given ID and value.
AssertContentTrait::assertNoFieldByName protected function Asserts that a field does not exist with the given name and value.
AssertContentTrait::assertNoFieldByXPath protected function Asserts that a field does not exist or its value does not match, by XPath.
AssertContentTrait::assertNoFieldChecked protected function Asserts that a checkbox field in the current page is not checked.
AssertContentTrait::assertNoLink protected function Passes if a link with the specified label is not found.
AssertContentTrait::assertNoLinkByHref protected function Passes if a link containing a given href (part) is not found.
AssertContentTrait::assertNoLinkByHrefInMainRegion protected function Passes if a link containing a given href is not found in the main region.
AssertContentTrait::assertNoOption protected function Asserts that a select option in the current page does not exist.
AssertContentTrait::assertNoOptionSelected protected function Asserts that a select option in the current page is not checked.
AssertContentTrait::assertNoPattern protected function Triggers a pass if the perl regex pattern is not found in raw content.
AssertContentTrait::assertNoRaw protected function Passes if the raw text is NOT found on the loaded page, fail otherwise.
AssertContentTrait::assertNoText protected function Passes if the page (with HTML stripped) does not contains the text.
AssertContentTrait::assertNoTitle protected function Pass if the page title is not the given string.
AssertContentTrait::assertNoUniqueText protected function Passes if the text is found MORE THAN ONCE on the text version of the page.
AssertContentTrait::assertOption protected function Asserts that a select option in the current page exists.
AssertContentTrait::assertOptionByText protected function Asserts that a select option with the visible text exists.
AssertContentTrait::assertOptionSelected protected function Asserts that a select option in the current page is checked.
AssertContentTrait::assertOptionSelectedWithDrupalSelector protected function Asserts that a select option in the current page is checked.
AssertContentTrait::assertOptionWithDrupalSelector protected function Asserts that a select option in the current page exists.
AssertContentTrait::assertPattern protected function Triggers a pass if the Perl regex pattern is found in the raw content.
AssertContentTrait::assertRaw protected function Passes if the raw text IS found on the loaded page, fail otherwise.
AssertContentTrait::assertText protected function Passes if the page (with HTML stripped) contains the text.
AssertContentTrait::assertTextHelper protected function Helper for assertText and assertNoText.
AssertContentTrait::assertTextPattern protected function Asserts that a Perl regex pattern is found in the plain-text content.
AssertContentTrait::assertThemeOutput protected function Asserts themed output.
AssertContentTrait::assertTitle protected function Pass if the page title is the given string.
AssertContentTrait::assertUniqueText protected function Passes if the text is found ONLY ONCE on the text version of the page.
AssertContentTrait::assertUniqueTextHelper protected function Helper for assertUniqueText and assertNoUniqueText.
AssertContentTrait::buildXPathQuery protected function Builds an XPath query.
AssertContentTrait::constructFieldXpath protected function Helper: Constructs an XPath for the given set of attributes and value.
AssertContentTrait::cssSelect protected function Searches elements using a CSS selector in the raw content.
AssertContentTrait::getAllOptions protected function Get all option elements, including nested options, in a select.
AssertContentTrait::getDrupalSettings protected function Gets the value of drupalSettings for the currently-loaded page.
AssertContentTrait::getRawContent protected function Gets the current raw content.
AssertContentTrait::getSelectedItem protected function Get the selected value from a select field.
AssertContentTrait::getTextContent protected function Retrieves the plain-text content from the current raw content.
AssertContentTrait::getUrl protected function Get the current URL from the cURL handler. 1
AssertContentTrait::parse protected function Parse content returned from curlExec using DOM and SimpleXML.
AssertContentTrait::removeWhiteSpace protected function Removes all white-space between HTML tags from the raw content.
AssertContentTrait::setDrupalSettings protected function Sets the value of drupalSettings for the currently-loaded page.
AssertContentTrait::setRawContent protected function Sets the raw content (e.g. HTML).
AssertContentTrait::xpath protected function Performs an xpath search on the contents of the internal browser.
AssertHelperTrait::castSafeStrings protected static function Casts MarkupInterface objects into strings.
AssertLegacyTrait::assert protected function Deprecated Scheduled for removal in Drupal 10.0.0. Use self::assertTrue() instead.
AssertLegacyTrait::assertEqual protected function Deprecated Scheduled for removal in Drupal 10.0.0. Use self::assertEquals() instead.
AssertLegacyTrait::assertIdentical protected function Deprecated Scheduled for removal in Drupal 10.0.0. Use self::assertSame() instead.
AssertLegacyTrait::assertIdenticalObject protected function Deprecated Scheduled for removal in Drupal 10.0.0. Use self::assertEquals() instead.
AssertLegacyTrait::assertNotEqual protected function Deprecated Scheduled for removal in Drupal 10.0.0. Use self::assertNotEquals() instead.
AssertLegacyTrait::assertNotIdentical protected function Deprecated Scheduled for removal in Drupal 10.0.0. Use self::assertNotSame() instead.
AssertLegacyTrait::pass protected function Deprecated Scheduled for removal in Drupal 10.0.0. Use self::assertTrue() instead.
AssertLegacyTrait::verbose protected function
ConfigTestTrait::configImporter protected function Returns a ConfigImporter object to import test configuration.
ConfigTestTrait::copyConfig protected function Copies configuration objects from source storage to target storage.
FieldKernelTestBase::$fieldTestData protected property Bag of created field storages and fields.
FieldKernelTestBase::assertFieldValues protected function Assert that a field has the expected values in an entity.
FieldKernelTestBase::createFieldWithStorage protected function Create a field and an associated field storage.
FieldKernelTestBase::entitySaveReload protected function Saves and reloads an entity.
FieldKernelTestBase::entityValidateAndSave protected function Validate and save entity. Fail if violations are found.
FieldKernelTestBase::_generateTestFieldValues protected function Generate random values for a field_test field.
GeolocationGeometryGeometryTest::$modules public static property Modules to enable. Overrides FieldKernelTestBase::$modules
GeolocationGeometryGeometryTest::setUp protected function Set the default field storage backend for fields created during tests. Overrides FieldKernelTestBase::setUp
GeolocationGeometryGeometryTest::testGeolocationItem public function Tests using entity fields of the geolocation field type.
KernelTestBase::$backupGlobals protected property Back up and restore any global variables that may be changed by tests.
KernelTestBase::$backupStaticAttributes protected property Back up and restore static class properties that may be changed by tests.
KernelTestBase::$backupStaticAttributesBlacklist protected property Contains a few static class properties for performance.
KernelTestBase::$classLoader protected property
KernelTestBase::$configImporter protected property @todo Move into Config test base class. 7
KernelTestBase::$configSchemaCheckerExclusions protected static property An array of config object names that are excluded from schema checking.
KernelTestBase::$container protected property
KernelTestBase::$databasePrefix protected property
KernelTestBase::$preserveGlobalState protected property Do not forward any global state from the parent process to the processes that run the actual tests.
KernelTestBase::$root protected property The app root.
KernelTestBase::$runTestInSeparateProcess protected property Kernel tests are run in separate processes because they allow autoloading of code from extensions. Running the test in a separate process isolates this behavior from other tests. Subclasses should not override this property.
KernelTestBase::$siteDirectory protected property
KernelTestBase::$strictConfigSchema protected property Set to TRUE to strict check all configuration saved. 6
KernelTestBase::$vfsRoot protected property The virtual filesystem root directory.
KernelTestBase::assertPostConditions protected function 1
KernelTestBase::bootEnvironment protected function Bootstraps a basic test environment.
KernelTestBase::bootKernel private function Bootstraps a kernel for a test.
KernelTestBase::config protected function Configuration accessor for tests. Returns non-overridden configuration.
KernelTestBase::disableModules protected function Disables modules for this test.
KernelTestBase::enableModules protected function Enables modules for this test.
KernelTestBase::getConfigSchemaExclusions protected function Gets the config schema exclusions for this test.
KernelTestBase::getDatabaseConnectionInfo protected function Returns the Database connection info to be used for this test. 1
KernelTestBase::getDatabasePrefix public function
KernelTestBase::getExtensionsForModules private function Returns Extension objects for $modules to enable.
KernelTestBase::getModulesToEnable private static function Returns the modules to enable for this test.
KernelTestBase::initFileCache protected function Initializes the FileCache component.
KernelTestBase::installConfig protected function Installs default configuration for a given list of modules.
KernelTestBase::installEntitySchema protected function Installs the storage schema for a specific entity type.
KernelTestBase::installSchema protected function Installs database tables from a module schema definition.
KernelTestBase::isTestInIsolation Deprecated protected function Returns whether the current test method is running in a separate process.
KernelTestBase::prepareTemplate protected function
KernelTestBase::register public function Registers test-specific services. Overrides ServiceProviderInterface::register 26
KernelTestBase::render protected function Renders a render array. 1
KernelTestBase::setInstallProfile protected function Sets the install profile and rebuilds the container to update it.
KernelTestBase::setSetting protected function Sets an in-memory Settings variable.
KernelTestBase::setUpBeforeClass public static function 1
KernelTestBase::setUpFilesystem protected function Sets up the filesystem, so things like the file directory. 2
KernelTestBase::stop protected function Stops test execution.
KernelTestBase::tearDown protected function 6
KernelTestBase::tearDownCloseDatabaseConnection public function @after
KernelTestBase::vfsDump protected function Dumps the current state of the virtual filesystem to STDOUT.
KernelTestBase::__get Deprecated public function BC: Automatically resolve former KernelTestBase class properties.
KernelTestBase::__sleep public function Prevents serializing any properties.
PhpunitCompatibilityTrait::getMock Deprecated public function Returns a mock object for the specified class using the available method.
PhpunitCompatibilityTrait::setExpectedException Deprecated public function Compatibility layer for PHPUnit 6 to support PHPUnit 4 code.
RandomGeneratorTrait::$randomGenerator protected property The random generator.
RandomGeneratorTrait::getRandomGenerator protected function Gets the random generator for the utility methods.
RandomGeneratorTrait::randomMachineName protected function Generates a unique random string containing letters and numbers. 1
RandomGeneratorTrait::randomObject public function Generates a random PHP object.
RandomGeneratorTrait::randomString public function Generates a pseudo-random string of ASCII characters of codes 32 to 126.
RandomGeneratorTrait::randomStringValidate public function Callback for random string validation.
StorageCopyTrait::replaceStorageContents protected static function Copy the configuration from one storage to another and remove stale items.
TestRequirementsTrait::checkModuleRequirements private function Checks missing module requirements.
TestRequirementsTrait::checkRequirements protected function Check module requirements for the Drupal use case. 1
TestRequirementsTrait::getDrupalRoot protected static function Returns the Drupal root directory.