Changeset 967 in tests for trunk/tests/ajax/Autosave.php
- Timestamp:
- 08/13/2012 09:07:27 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/ajax/Autosave.php
r904 r967 22 22 */ 23 23 protected $_post = null; 24 24 25 25 /** 26 26 * Set up the test fixture … … 37 37 */ 38 38 public function test_nopriv_autosave() { 39 39 40 40 // Log out 41 41 wp_logout(); 42 42 43 43 // Set up a default request 44 44 $_POST = array( … … 46 46 'autosave' => 1 47 47 ); 48 48 49 49 // Make the request 50 50 try { … … 67 67 */ 68 68 public function test_nopriv_no_postid() { 69 69 70 70 // Log out 71 71 wp_logout(); 72 72 73 73 // Set up a request 74 74 $_POST = array( 75 75 'autosave' => 1 76 76 ); 77 77 78 78 // Make the request 79 79 $this->setExpectedException( 'WPAjaxDieStopException', '-1' ); 80 80 $this->_handleAjax( 'nopriv_autosave' ); 81 81 } 82 82 83 83 /** 84 84 * Test autosaving a post … … 89 89 // Become an admin 90 90 $this->_setRole( 'administrator' ); 91 91 92 92 // Set up the $_POST request 93 93 $md5 = md5( uniqid() ); … … 105 105 unset( $e ); 106 106 } 107 107 108 108 // Get the response 109 109 $xml = simplexml_load_string( $this->_last_response, 'SimpleXMLElement', LIBXML_NOCDATA ); … … 112 112 $this->assertEquals( $this->_post->ID, (int) $xml->response[0]->autosave['id'] ); 113 113 $this->assertEquals( 'autosave_' . $this->_post->ID, (string) $xml->response['action']); 114 114 115 115 // Check that the edit happened 116 116 $post = get_post( $this->_post->ID) ; … … 123 123 */ 124 124 public function test_with_invalid_nonce( ) { 125 126 // Become an administrator 125 126 // Become an administrator 127 127 $this->_setRole( 'administrator' ); 128 128 … … 138 138 $this->_handleAjax( 'autosave' ); 139 139 } 140 140 141 141 /** 142 142 * Test with a bad post id … … 144 144 */ 145 145 public function test_with_invalid_post_id( ) { 146 147 // Become an administrator 146 147 // Become an administrator 148 148 $this->_setRole( 'administrator' ); 149 149 … … 159 159 $this->_handleAjax( 'autosave' ); 160 160 } 161 161 162 162 /** 163 163 * Test with a locked post … … 166 166 public function test_locked_post() { 167 167 168 // Become an administrator 169 $this->_setRole( 'administrator' ); 170 168 // Become an administrator 169 $this->_setRole( 'administrator' ); 170 171 171 // Lock the post 172 172 wp_set_post_lock( $this->_post->ID ); 173 173 174 174 // Become a different administrator 175 175 $this->_setRole( 'administrator' ); 176 176 177 177 // Set up the $_POST request 178 178 $_POST = array( … … 207 207 $login_grace_period = 1; 208 208 209 // Become an admnistrator 210 $this->_setRole( 'administrator' ); 211 209 // Become an admnistrator 210 $this->_setRole( 'administrator' ); 211 212 212 // Set up the $_POST request 213 213 $_POST = array(
Note: See TracChangeset
for help on using the changeset viewer.