Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2696 from YOURLS/plugin_headers
More flexible plugin headers, and tests Fixes #2685
- Loading branch information
Showing
7 changed files
with
124 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<?php | ||
/** | ||
* Plugin Name: incomplete | ||
* Description: incomplete | ||
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<?php | ||
/** | ||
* Plugin Name | ||
* Description | ||
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<?php | ||
/* | ||
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<?php | ||
/** | ||
* Plugin Name: phpdoc | ||
* Plugin URI: phpdoc | ||
* Description: phpdoc | ||
* Version: phpdoc | ||
* Author: phpdoc | ||
* Author URI: phpdoc | ||
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<?php | ||
/* | ||
Plugin Name: regular | ||
Plugin URI: regular | ||
Description: regular | ||
Version: regular | ||
Author: regular | ||
Author URI: regular | ||
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
<?php | ||
|
||
/** | ||
* Header plugin functions | ||
* | ||
* @group plugins | ||
* @since 0.1 | ||
*/ | ||
class Plugin_Header_Tests extends PHPUnit_Framework_TestCase { | ||
|
||
/** | ||
* Regular header | ||
*/ | ||
public function test_regular_header() { | ||
$expected = array( | ||
'Plugin Name' => 'regular', | ||
'Plugin URI' => 'regular', | ||
'Description' => 'regular', | ||
'Version' => 'regular', | ||
'Author' => 'regular', | ||
'Author URI' => 'regular', | ||
); | ||
$this->assertEquals($expected, yourls_get_plugin_data( YOURLS_PLUGINDIR . '/headers/header_regular.php' ) ); | ||
} | ||
|
||
/** | ||
* PHPDoc header | ||
*/ | ||
public function test_phpdoc_header() { | ||
$expected = array( | ||
'Plugin Name' => 'phpdoc', | ||
'Description' => 'phpdoc', | ||
'Plugin URI' => 'phpdoc', | ||
'Version' => 'phpdoc', | ||
'Author' => 'phpdoc', | ||
'Author URI' => 'phpdoc', | ||
); | ||
$this->assertEquals($expected, yourls_get_plugin_data( YOURLS_PLUGINDIR . '/headers/header_phpdoc.php' ) ); | ||
} | ||
|
||
/** | ||
* Incomplete header | ||
*/ | ||
public function test_incomplete_header() { | ||
$expected = array( | ||
'Plugin Name' => 'incomplete', | ||
'Description' => 'incomplete', | ||
); | ||
$this->assertEquals($expected, yourls_get_plugin_data( YOURLS_PLUGINDIR . '/headers/header_incomplete.php' ) ); | ||
|
||
} | ||
|
||
/** | ||
* Incorrect header | ||
*/ | ||
public function test_incorrect_header() { | ||
$this->assertEquals( [] , yourls_get_plugin_data( YOURLS_PLUGINDIR . '/headers/header_incorrect.php' ) ); | ||
} | ||
|
||
/** | ||
* Missing header | ||
*/ | ||
public function test_missing_header() { | ||
$this->assertEquals( [] , yourls_get_plugin_data( YOURLS_PLUGINDIR . '/headers/header_missing.php' ) ); | ||
} | ||
|
||
} |