You are here

XMLTestBase.php in GraphQL 8.4

File

tests/src/Kernel/DataProducer/XML/XMLTestBase.php
View source
<?php

namespace Drupal\Tests\graphql\Kernel\DataProducer\XML;

use Drupal\Tests\graphql\Kernel\GraphQLTestBase;

/**
 * Base class for XML data producer tests.
 *
 * @group graphql
 */
class XMLTestBase extends GraphQLTestBase {

  /**
   * Loads a test document.
   */
  public function loadDocument() : \DOMElement {
    $document = new \DOMDocument();
    libxml_use_internal_errors(TRUE);
    $document
      ->loadHTMLFile(drupal_get_path('module', 'graphql') . '/tests/files/xml/test.xml');
    return $document->documentElement;
  }

  /**
   * Returns the source of the test document.
   *
   * @return bool|string
   */
  public function getDocumentSource() {
    return file_get_contents(drupal_get_path('module', 'graphql') . '/tests/files/xml/test.xml');
  }

}

Classes

Namesort descending Description
XMLTestBase Base class for XML data producer tests.