Changeset 53686 for trunk/tests/phpunit/tests/basic.php
- Timestamp:
- 07/07/2022 11:55:13 PM (2 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/basic.php
r53683 r53686 2 2 3 3 /** 4 * just make sure the test framework is working4 * Test the content in some root directory files. 5 5 * 6 * No Covers as this checks for content in files 7 * 8 * @group testsuite 6 * @group basic 9 7 */ 10 8 class Tests_Basic extends WP_UnitTestCase { … … 68 66 $this->assertArrayHasKey( 'node', $package_json['engines'] ); 69 67 } 70 71 /**72 * Test some helper utility functions.73 *74 * @coversNothing75 */76 public function test_strip_ws() {77 $this->assertSame( '', strip_ws( '' ) );78 $this->assertSame( 'foo', strip_ws( 'foo' ) );79 $this->assertSame( '', strip_ws( "\r\n\t \n\r\t" ) );80 81 $in = "asdf\n";82 $in .= "asdf asdf\n";83 $in .= "asdf asdf\n";84 $in .= "\tasdf\n";85 $in .= "\tasdf\t\n";86 $in .= "\t\tasdf\n";87 $in .= "foo bar\n\r\n";88 $in .= "foo\n";89 90 $expected = "asdf\n";91 $expected .= "asdf asdf\n";92 $expected .= "asdf asdf\n";93 $expected .= "asdf\n";94 $expected .= "asdf\n";95 $expected .= "asdf\n";96 $expected .= "foo bar\n";97 $expected .= 'foo';98 99 $this->assertSame( $expected, strip_ws( $in ) );100 101 }102 103 /**104 * @coversNothing105 */106 public function test_mask_input_value() {107 $in = <<<EOF108 <h2>Assign Authors</h2>109 <p>To make it easier for you to edit and save the imported posts and drafts, you may want to change the name of the author of the posts. For example, you may want to import all the entries as <code>admin</code>s entries.</p>110 <p>If a new user is created by WordPress, the password will be set, by default, to "changeme". Quite suggestive, eh? ;)</p>111 <ol id="authors"><form action="?import=wordpress&step=2&id=" method="post"><input type="hidden" name="_wpnonce" value="855ae98911" /><input type="hidden" name="_wp_http_referer" value="wp-test.php" /><li>Current author: <strong>Alex Shiels</strong><br />Create user <input type="text" value="Alex Shiels" name="user[]" maxlength="30"> <br /> or map to existing<select name="userselect[0]">112 EOF;113 // _wpnonce value should be replaced with 'xxx'.114 $expected = <<<EOF115 <h2>Assign Authors</h2>116 <p>To make it easier for you to edit and save the imported posts and drafts, you may want to change the name of the author of the posts. For example, you may want to import all the entries as <code>admin</code>s entries.</p>117 <p>If a new user is created by WordPress, the password will be set, by default, to "changeme". Quite suggestive, eh? ;)</p>118 <ol id="authors"><form action="?import=wordpress&step=2&id=" method="post"><input type="hidden" name="_wpnonce" value="***" /><input type="hidden" name="_wp_http_referer" value="wp-test.php" /><li>Current author: <strong>Alex Shiels</strong><br />Create user <input type="text" value="Alex Shiels" name="user[]" maxlength="30"> <br /> or map to existing<select name="userselect[0]">119 EOF;120 $this->assertSame( $expected, mask_input_value( $in ) );121 }122 68 }
Note: See TracChangeset
for help on using the changeset viewer.