You are here

public function AddURLKernelTest::setUp in Search API 8

Performs setup tasks before each individual test method is run.

Installs commonly used schemas and sets up a search server and an index, with the specified processor enabled.

Parameters

string|null $processor: (optional) The plugin ID of the processor that should be set up for testing.

Overrides ProcessorTestBase::setUp

File

tests/src/Kernel/Processor/AddURLKernelTest.php, line 28

Class

AddURLKernelTest
Tests the "Add URL" processor at a higher level.

Namespace

Drupal\Tests\search_api\Kernel\Processor

Code

public function setUp($processor = NULL) {
  parent::setUp('add_url');
  $url_field = new Field($this->index, 'url');
  $url_field
    ->setType('string');
  $url_field
    ->setPropertyPath('search_api_url');
  $url_field
    ->setLabel('Item URL');
  $this->index
    ->addField($url_field);
  $this->index
    ->save();
  $this->nodes[0] = Node::create([
    'title' => 'Test',
    'type' => 'article',
  ]);
  $this->nodes[0]
    ->save();
}