[ Index ]

PHP Cross Reference of YOURLS

title

Body

[close]

/tests/tests/themes/ -> themes.php (source)

   1  <?php
   2  
   3  /**
   4   * Themes functions
   5   *
   6   * @group themes
   7   */
   8  
   9  if( function_exists( 'yourls_activate_theme' ) ) :
  10  
  11  class Themes_Tests extends PHPUnit\Framework\TestCase {
  12  
  13      /**
  14       * Check that valid themes are found
  15       *
  16       * @since 0.1
  17       */
  18  	public function test_get_themes() {
  19          $themes = array_keys( yourls_get_themes() );
  20          $this->assertNotEmpty( $themes );
  21  
  22          // Pick one random theme
  23          $theme = $themes[ array_rand( $themes ) ];
  24          return dirname( $theme );
  25      }
  26  
  27      /**
  28       * Check that a random valid theme activates correctly
  29       *
  30       * @depends test_get_themes
  31       * @since 0.1
  32       */
  33  	public function test_theme_activate( $theme ) {
  34          $this->assertTrue( yourls_activate_theme( $theme ) );
  35          $this->assertTrue( yourls_load_theme( $theme ) );
  36          $this->assertTrue( yourls_is_style_queued( $theme ) );
  37          $this->assertEquals( $theme, yourls_get_active_theme() );
  38          return $theme;
  39      }
  40  
  41  }
  42  
  43  endif;


Generated: Wed Sep 28 05:10:02 2022 Cross-referenced by PHPXref 0.7.1