You are here

function PatternsTestCase::loadPattern in Patterns 7.2

Same name and namespace in other branches
  1. 7 tests/patterns.test \PatternsTestCase::loadPattern()

Loads a pattern file into a string from a directory.

Parameters

mixed $filename The name of the pattern file:

mixed $dir The directory where the pattern file: is located.

3 calls to PatternsTestCase::loadPattern()
PatternsExportTestCase::testExportTaxonomy in tests/exporting/exporting.test
PatternsImportTestCase::testImportFileFromSource in tests/importing/importing.test
PatternsTestCase::runFile in tests/patterns.test
Loads a pattern file and runs it.

File

tests/patterns.test, line 238
The base of the Patterns Component tests.

Class

PatternsTestCase
Abstract base class for testing pattern component behavior.

Code

function loadPattern($filename, $dir) {
  if (!file_exists($dir) || !is_readable($dir)) {
    $this
      ->error(t('Directory not found or not readable: ' . $dir));
    return FALSE;
  }
  return file_get_contents($dir . $filename);
}