[ Index ]

PHP Cross Reference of GlotPress

title

Body

[close]

/tests/phpunit/includes/ -> constants.php (source)

   1  <?php
   2  /**
   3   * Defines constants needed by unit-tests.
   4   *
   5   * @package GlotPress
   6   * @subpackage Tests
   7   */
   8  
   9  if ( ! defined( 'GP_TESTS_DIR' ) ) {
  10      define( 'GP_TESTS_DIR', dirname( __DIR__ ) );
  11  }
  12  
  13  if ( ! defined( 'GP_DIR_TESTDATA' ) ) {
  14      define( 'GP_DIR_TESTDATA', GP_TESTS_DIR . '/data' );
  15  }
  16  
  17  /**
  18   * Determines where the WP test suite lives.
  19   *
  20   * - Define a WP_TESTS_DIR environment variable, which points to a checkout of
  21   *   WordPress test suite
  22   * - Assume that we are inside of a develop.svn.wordpress.org setup, and walk
  23   *   up the directory tree
  24   */
  25  if ( false !== getenv( 'WP_TESTS_DIR' ) ) {
  26      define( 'WP_TESTS_DIR', getenv( 'WP_TESTS_DIR' ) );
  27      define( 'WP_ROOT_DIR', WP_TESTS_DIR );
  28  } else {
  29      define( 'WP_ROOT_DIR', dirname( dirname( dirname( dirname( dirname( dirname( dirname( __DIR__ ) ) ) ) ) ) ) );
  30      define( 'WP_TESTS_DIR', WP_ROOT_DIR . '/tests/phpunit' );
  31  }
  32  
  33  // Based on the tests directory, look for a config file.
  34  if ( file_exists( WP_ROOT_DIR . '/wp-tests-config.php' ) ) {
  35      // Standard develop.svn.wordpress.org setup.
  36      define( 'WP_TESTS_CONFIG_PATH', WP_ROOT_DIR . '/wp-tests-config.php' );
  37  } elseif ( file_exists( dirname( dirname( WP_TESTS_DIR ) ) . '/wp-tests-config.php' ) ) {
  38      // Environment variable exists and points to tests/phpunit of develop.svn.wordpress.org setup.
  39      define( 'WP_TESTS_CONFIG_PATH', dirname( dirname( WP_TESTS_DIR ) ) . '/wp-tests-config.php' );
  40  } else {
  41      die( "wp-tests-config.php could not be found.\n" );
  42  }
  43  
  44  if ( ! defined( 'GP_TESTS_PERMALINK_STRUCTURE' ) ) {
  45      define( 'GP_TESTS_PERMALINK_STRUCTURE', '/%postname%' );
  46  }
  47  
  48  if ( ! defined( 'GP_TESTS_PERMALINK_STRUCTURE_WITH_TRAILING_SLASH' ) ) {
  49      define( 'GP_TESTS_PERMALINK_STRUCTURE_WITH_TRAILING_SLASH', '/%postname%/' );
  50  }


Generated: Fri Sep 25 01:01:51 2020 Cross-referenced by PHPXref 0.7.1