[ Index ]

PHP Cross Reference of YOURLS

title

Body

[close]

/tests/tests/plugins/ -> headers.php (source)

   1  <?php
   2  
   3  /**
   4   * Header plugin functions
   5   *
   6   * @group plugins
   7   * @since 0.1
   8   */
   9  class Plugin_Header_Tests extends PHPUnit\Framework\TestCase {
  10  
  11      /**
  12       * Regular header
  13       */
  14  	public function test_regular_header() {
  15          $expected = array(
  16            'Plugin Name' => 'regular',
  17            'Plugin URI'  => 'regular',
  18            'Description' => 'regular',
  19            'Version'     => 'regular',
  20            'Author'      => 'regular',
  21            'Author URI'  => 'regular',
  22          );
  23          $this->assertEquals($expected, yourls_get_plugin_data( YOURLS_PLUGINDIR . '/headers/header_regular.php' ) );
  24      }
  25  
  26      /**
  27       * PHPDoc header
  28       */
  29  	public function test_phpdoc_header() {
  30          $expected = array(
  31            'Plugin Name' => 'phpdoc',
  32            'Description' => 'phpdoc',
  33            'Plugin URI'  => 'phpdoc',
  34            'Version'     => 'phpdoc',
  35            'Author'      => 'phpdoc',
  36            'Author URI'  => 'phpdoc',
  37          );
  38          $this->assertEquals($expected, yourls_get_plugin_data( YOURLS_PLUGINDIR . '/headers/header_phpdoc.php' ) );
  39      }
  40  
  41      /**
  42       * Incomplete header
  43       */
  44  	public function test_incomplete_header() {
  45          $expected = array(
  46            'Plugin Name' => 'incomplete',
  47            'Description' => 'incomplete',
  48          );
  49          $this->assertEquals($expected, yourls_get_plugin_data( YOURLS_PLUGINDIR . '/headers/header_incomplete.php' ) );
  50  
  51      }
  52  
  53      /**
  54       * Incorrect header
  55       */
  56  	public function test_incorrect_header() {
  57          $this->assertEquals( [] , yourls_get_plugin_data( YOURLS_PLUGINDIR . '/headers/header_incorrect.php' ) );
  58      }
  59  
  60      /**
  61       * Missing header
  62       */
  63  	public function test_missing_header() {
  64          $this->assertEquals( [] , yourls_get_plugin_data( YOURLS_PLUGINDIR . '/headers/header_missing.php' ) );
  65      }
  66  
  67      /**
  68       * Missing header - no comment at all
  69       */
  70  	public function test_missing_header_no_comment() {
  71          $this->assertEquals( [] , yourls_get_plugin_data( YOURLS_PLUGINDIR . '/headers/header_nocomment.php' ) );
  72      }
  73  
  74  }


Generated: Thu Sep 19 05:10:04 2024 Cross-referenced by PHPXref 0.7.1