You are here

public function ShsTermTest::testChildren in Simple hierarchical select 2.0.x

Tests getting children of a specific term.

File

tests/src/Functional/ShsTermTest.php, line 53

Class

ShsTermTest
Test term functions in SHS.

Namespace

Drupal\Tests\shs\Functional

Code

public function testChildren() : void {
  $parent = $this->termIds['aaa 1'];
  $field_name = 'shs-' . strtr($this->fieldName, [
    '_' => '-',
  ]);
  $request_url = "shs-term-data/{$field_name}/{$this->vocabulary->id()}/{$parent}";

  // Request term data.
  $data = $this
    ->drupalGetJson($request_url);
  $this
    ->assertCount(4, $data, "JSON callback returned 4 result");
}