Changeset 42343 for trunk/tests/phpunit/tests/admin/includesPlugin.php
- Timestamp:
- 11/30/2017 11:09:33 PM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/admin/includesPlugin.php
r41806 r42343 9 9 10 10 $default_headers = array( 11 'Name' => 'Hello Dolly',12 'Title' => '<a href="http://wordpress.org/#">Hello Dolly</a>',13 'PluginURI' => 'http://wordpress.org/#',11 'Name' => 'Hello Dolly', 12 'Title' => '<a href="http://wordpress.org/#">Hello Dolly</a>', 13 'PluginURI' => 'http://wordpress.org/#', 14 14 'Description' => 'This is not just a plugin, it symbolizes the hope and enthusiasm of an entire generation summed up in two words sung most famously by Louis Armstrong: Hello, Dolly. When activated you will randomly see a lyric from Hello, Dolly in the upper right of your admin screen on every page. <cite>By <a href="http://ma.tt/">Matt Mullenweg</a>.</cite>', 15 'Author' => '<a href="http://ma.tt/">Matt Mullenweg</a>',16 'AuthorURI' => 'http://ma.tt/',17 'Version' => '1.5.1',18 'TextDomain' => 'hello-dolly',19 'DomainPath' => ''15 'Author' => '<a href="http://ma.tt/">Matt Mullenweg</a>', 16 'AuthorURI' => 'http://ma.tt/', 17 'Version' => '1.5.1', 18 'TextDomain' => 'hello-dolly', 19 'DomainPath' => '', 20 20 ); 21 21 22 $this->assertTrue( is_array( $data) );23 24 foreach ( $default_headers as $name => $value) {25 $this->assertTrue( isset($data[$name]));26 $this->assertEquals( $value, $data[$name]);22 $this->assertTrue( is_array( $data ) ); 23 24 foreach ( $default_headers as $name => $value ) { 25 $this->assertTrue( isset( $data[ $name ] ) ); 26 $this->assertEquals( $value, $data[ $name ] ); 27 27 } 28 28 } … … 42 42 add_pages_page( 'Appending Query Arg', 'Test Pages', 'edit_pages', 'testpages', 'mt_pages_page' ); 43 43 44 $expected['testsettings'] = 'http://example.com/wp-admin/options-general.php?page=testsettings';45 $expected['testtools'] = 'http://example.com/wp-admin/tools.php?page=testtools';44 $expected['testsettings'] = 'http://example.com/wp-admin/options-general.php?page=testsettings'; 45 $expected['testtools'] = 'http://example.com/wp-admin/tools.php?page=testtools'; 46 46 $expected['mt-top-level-handle'] = 'http://example.com/wp-admin/admin.php?page=mt-top-level-handle'; 47 $expected['sub-page'] = 'http://example.com/wp-admin/admin.php?page=sub-page';48 $expected['sub-page2'] = 'http://example.com/wp-admin/admin.php?page=sub-page2';49 $expected['not_registered'] = '';50 $expected['With Spaces'] = 'http://example.com/wp-admin/themes.php?page=With%20Spaces';51 $expected['testpages'] = 'http://example.com/wp-admin/edit.php?post_type=page&page=testpages';52 53 foreach ( $expected as $name => $value) {47 $expected['sub-page'] = 'http://example.com/wp-admin/admin.php?page=sub-page'; 48 $expected['sub-page2'] = 'http://example.com/wp-admin/admin.php?page=sub-page2'; 49 $expected['not_registered'] = ''; 50 $expected['With Spaces'] = 'http://example.com/wp-admin/themes.php?page=With%20Spaces'; 51 $expected['testpages'] = 'http://example.com/wp-admin/edit.php?post_type=page&page=testpages'; 52 53 foreach ( $expected as $name => $value ) { 54 54 $this->assertEquals( $value, menu_page_url( $name, false ) ); 55 55 } … … 100 100 $plugin_dir = WP_PLUGIN_DIR . '/list_files_test_plugin'; 101 101 @mkdir( $plugin_dir ); 102 $plugin = $this->_create_plugin( null, 'list_files_test_plugin.php', $plugin_dir );102 $plugin = $this->_create_plugin( null, 'list_files_test_plugin.php', $plugin_dir ); 103 103 104 104 $sub_dir = trailingslashit( dirname( $plugin[1] ) ) . 'subdir'; … … 107 107 108 108 $plugin_files = get_plugin_files( plugin_basename( $plugin[1] ) ); 109 $expected = array(109 $expected = array( 110 110 'list_files_test_plugin/list_files_test_plugin.php', 111 111 'list_files_test_plugin/subdir/subfile.php', … … 321 321 $plugin = $this->_create_plugin(); 322 322 323 activate_plugin( $plugin[ 0] );324 unlink( $plugin[ 1] );323 activate_plugin( $plugin[0] ); 324 unlink( $plugin[1] ); 325 325 326 326 $result = validate_active_plugins(); 327 $this->assertTrue( isset( $result[ $plugin[ 0] ] ) );327 $this->assertTrue( isset( $result[ $plugin[0] ] ) ); 328 328 } 329 329 … … 348 348 $plugin = $this->_create_plugin(); 349 349 350 $uninstallable_plugins = (array) get_option( 'uninstall_plugins' );350 $uninstallable_plugins = (array) get_option( 'uninstall_plugins' ); 351 351 $uninstallable_plugins[ $plugin[0] ] = true; 352 352 update_option( 'uninstall_plugins', $uninstallable_plugins ); … … 431 431 */ 432 432 private function _restore_mu_plugins() { 433 $mu_bu_dir = WP_CONTENT_DIR . '/mu-plugin-backup';433 $mu_bu_dir = WP_CONTENT_DIR . '/mu-plugin-backup'; 434 434 $files_to_move = array(); 435 435 if ( is_dir( $mu_bu_dir ) && $mu_plugins = opendir( $mu_bu_dir ) ) { … … 465 465 } 466 466 467 foreach ( _get_dropins() as $file_to_move => $v ) {467 foreach ( _get_dropins() as $file_to_move => $v ) { 468 468 if ( file_exists( WP_CONTENT_DIR . '/' . $file_to_move ) ) { 469 469 rename( WP_CONTENT_DIR . '/' . $file_to_move, $di_bu_dir . '/' . $file_to_move ); … … 482 482 $di_bu_dir = WP_CONTENT_DIR . '/drop-ins-backup'; 483 483 484 foreach ( _get_dropins() as $file_to_move => $v ) {484 foreach ( _get_dropins() as $file_to_move => $v ) { 485 485 if ( file_exists( $di_bu_dir . '/' . $file_to_move ) ) { 486 486 rename( $di_bu_dir . '/' . $file_to_move, WP_CONTENT_DIR . '/' . $file_to_move );
Note: See TracChangeset
for help on using the changeset viewer.