| 1 |
<?php |
| 2 |
/** |
| 3 |
* Tests to test that that testing framework is testing tests. Meta, huh? |
| 4 |
* @package wordpress-plugins-tests |
| 5 |
* @author mbijon |
| 6 |
*/ |
| 7 |
class WP_Test_Edit_Flow_Starter_Tests extends WP_UnitTestCase { |
| 8 |
|
| 9 |
/** |
| 10 |
* Run a simple test to ensure that the tests are running |
| 11 |
*/ |
| 12 |
function test_editflow_exists() { |
| 13 |
|
| 14 |
$this->assertTrue( class_exists( 'edit_flow' ) ); |
| 15 |
|
| 16 |
} |
| 17 |
|
| 18 |
/** |
| 19 |
* Verify a minimum version of WordPress is installed |
| 20 |
*/ |
| 21 |
function test_wp_version() { |
| 22 |
|
| 23 |
$minimum_version = '3.4.0'; |
| 24 |
$running_version = get_bloginfo( 'version' ); |
| 25 |
|
| 26 |
//trunk is always "master" in github terms, but WordPress has a specific way of describing it |
| 27 |
//grab the exact version number to verify that we're on trunk |
| 28 |
if ( $running_version == 'master' || $running_version == 'trunk' ) { |
| 29 |
$file = file_get_contents( 'https://raw.github.com/WordPress/WordPress/master/wp-includes/version.php' ); |
| 30 |
preg_match( '#\$wp_version = \'([^\']+)\';#', $file, $matches ); |
| 31 |
$running_version = $matches[1]; |
| 32 |
} |
| 33 |
|
| 34 |
$this->assertTrue( version_compare( $running_version, $minimum_version, '>=' ) ); |
| 35 |
|
| 36 |
} |
| 37 |
|
| 38 |
/** |
| 39 |
* Test modules loading |
| 40 |
*/ |
| 41 |
function test_editflow_register_module() { |
| 42 |
|
| 43 |
$EditFlow = EditFlow(); |
| 44 |
|
| 45 |
$module_real = strtolower( 'calendar' ); |
| 46 |
$module_args = array ( 'title' => $module_real ); |
| 47 |
$module_return = $EditFlow->register_module( $module_real, $module_args ); |
| 48 |
$this->assertTrue( $module_real == $module_return->name ); |
| 49 |
|
| 50 |
} |
| 51 |
|
| 52 |
} |