Changeset 52009
- Timestamp:
- 11/04/2021 01:15:33 PM (3 years ago)
- Location:
- trunk/tests/phpunit/includes
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/includes/bootstrap.php
r51828 r52009 341 341 class WP_PHPUnit_Util_Getopt { 342 342 343 function __construct( $argv ) {343 public function __construct( $argv ) { 344 344 $skipped_groups = array( 345 345 'ajax' => true, -
trunk/tests/phpunit/includes/mock-fs.php
r47122 r52009 14 14 public $method = 'MockFS'; 15 15 16 function __construct() {}17 18 function connect() {16 public function __construct() {} 17 18 public function connect() { 19 19 return true; 20 20 } 21 21 22 22 // Copy of core's function, but accepts a path. 23 function abspath( $path = false ) {23 public function abspath( $path = false ) { 24 24 if ( ! $path ) { 25 25 $path = ABSPATH; … … 41 41 * Can also be passed the initial filesystem to be setup which is passed to self::setfs() 42 42 */ 43 function init( $paths = '', $home_dir = '/' ) {43 public function init( $paths = '', $home_dir = '/' ) { 44 44 $this->fs = new MockFS_Directory_Node( '/' ); 45 45 $this->fs_map = array( … … 54 54 * "Bulk Loads" a filesystem into the internal virtual filesystem 55 55 */ 56 function setfs( $paths ) {56 public function setfs( $paths ) { 57 57 if ( ! is_array( $paths ) ) { 58 58 $paths = explode( "\n", $paths ); … … 94 94 // Here starteth the WP_Filesystem functions. 95 95 96 function mkdir( $path, /* Optional args are ignored */ $chmod = false, $chown = false, $chgrp = false ) {96 public function mkdir( $path, /* Optional args are ignored */ $chmod = false, $chown = false, $chgrp = false ) { 97 97 $path = trailingslashit( $path ); 98 98 … … 115 115 } 116 116 117 function put_contents( $path, $contents = '', $mode = null ) {117 public function put_contents( $path, $contents = '', $mode = null ) { 118 118 if ( ! $this->is_dir( dirname( $path ) ) ) { 119 119 $this->mkdir( dirname( $path ) ); … … 127 127 } 128 128 129 function get_contents( $file ) {129 public function get_contents( $file ) { 130 130 if ( ! $this->is_file( $file ) ) { 131 131 return false; … … 134 134 } 135 135 136 function cwd() {136 public function cwd() { 137 137 return $this->cwd->path; 138 138 } 139 139 140 function chdir( $path ) {140 public function chdir( $path ) { 141 141 if ( ! isset( $this->fs_map[ $path ] ) ) { 142 142 return false; … … 147 147 } 148 148 149 function exists( $path ) {149 public function exists( $path ) { 150 150 return isset( $this->fs_map[ $path ] ) || isset( $this->fs_map[ trailingslashit( $path ) ] ); 151 151 } 152 152 153 function is_file( $file ) {153 public function is_file( $file ) { 154 154 return isset( $this->fs_map[ $file ] ) && $this->fs_map[ $file ]->is_file(); 155 155 } 156 156 157 function is_dir( $path ) {157 public function is_dir( $path ) { 158 158 $path = trailingslashit( $path ); 159 159 … … 161 161 } 162 162 163 function dirlist( $path = '.', $include_hidden = true, $recursive = false ) {163 public function dirlist( $path = '.', $include_hidden = true, $recursive = false ) { 164 164 165 165 if ( empty( $path ) || '.' === $path ) { … … 215 215 public $path; // The full path to the entry. 216 216 217 function __construct( $path ) {217 public function __construct( $path ) { 218 218 $this->path = $path; 219 219 $this->name = basename( $path ); 220 220 } 221 221 222 function is_file() {222 public function is_file() { 223 223 return 'f' === $this->type; 224 224 } 225 225 226 function is_dir() {226 public function is_dir() { 227 227 return 'd' === $this->type; 228 228 } … … 238 238 public $contents = ''; // The contents of the file. 239 239 240 function __construct( $path, $contents = '' ) {240 public function __construct( $path, $contents = '' ) { 241 241 parent::__construct( $path ); 242 242 $this->contents = $contents; -
trunk/tests/phpunit/includes/mock-mailer.php
r50265 r52009 6 6 public $mock_sent = array(); 7 7 8 function preSend() {8 public function preSend() { 9 9 $this->Encoding = '8bit'; 10 10 return parent::preSend(); … … 14 14 * Override postSend() so mail isn't actually sent. 15 15 */ 16 function postSend() {16 public function postSend() { 17 17 $this->mock_sent[] = array( 18 18 'to' => $this->to, -
trunk/tests/phpunit/includes/testcase-xmlrpc.php
r51585 r52009 7 7 protected $myxmlrpcserver; 8 8 9 function set_up() {9 public function set_up() { 10 10 parent::set_up(); 11 11 … … 15 15 } 16 16 17 function tear_down() {17 public function tear_down() { 18 18 remove_filter( 'pre_option_enable_xmlrpc', '__return_true' ); 19 19 -
trunk/tests/phpunit/includes/utils.php
r51552 r52009 65 65 * PHP5 constructor. 66 66 */ 67 function __construct( $debug = 0 ) {67 public function __construct( $debug = 0 ) { 68 68 $this->reset(); 69 69 $this->debug = $debug; 70 70 } 71 71 72 function reset() {72 public function reset() { 73 73 $this->events = array(); 74 74 } 75 75 76 function current_filter() {76 public function current_filter() { 77 77 if ( is_callable( 'current_filter' ) ) { 78 78 return current_filter(); … … 82 82 } 83 83 84 function action( $arg ) {84 public function action( $arg ) { 85 85 if ( $this->debug ) { 86 86 dmp( __FUNCTION__, $this->current_filter() ); … … 95 95 } 96 96 97 function action2( $arg ) {97 public function action2( $arg ) { 98 98 if ( $this->debug ) { 99 99 dmp( __FUNCTION__, $this->current_filter() ); … … 109 109 } 110 110 111 function filter( $arg ) {111 public function filter( $arg ) { 112 112 if ( $this->debug ) { 113 113 dmp( __FUNCTION__, $this->current_filter() ); … … 123 123 } 124 124 125 function filter2( $arg ) {125 public function filter2( $arg ) { 126 126 if ( $this->debug ) { 127 127 dmp( __FUNCTION__, $this->current_filter() ); … … 137 137 } 138 138 139 function filter_append( $arg ) {139 public function filter_append( $arg ) { 140 140 if ( $this->debug ) { 141 141 dmp( __FUNCTION__, $this->current_filter() ); … … 151 151 } 152 152 153 function filterall( $tag, ...$args ) {153 public function filterall( $tag, ...$args ) { 154 154 // This one doesn't return the result, so it's safe to use with the new 'all' filter. 155 155 if ( $this->debug ) { … … 165 165 166 166 // Return a list of all the actions, tags and args. 167 function get_events() {167 public function get_events() { 168 168 return $this->events; 169 169 } 170 170 171 171 // Return a count of the number of times the action was called since the last reset. 172 function get_call_count( $tag = '' ) {172 public function get_call_count( $tag = '' ) { 173 173 if ( $tag ) { 174 174 $count = 0; … … 184 184 185 185 // Return an array of the tags that triggered calls to this action. 186 function get_tags() {186 public function get_tags() { 187 187 $out = array(); 188 188 foreach ( $this->events as $e ) { … … 193 193 194 194 // Return an array of args passed in calls to this action. 195 function get_args() {195 public function get_args() { 196 196 $out = array(); 197 197 foreach ( $this->events as $e ) { … … 211 211 * PHP5 constructor. 212 212 */ 213 function __construct( $in ) {213 public function __construct( $in ) { 214 214 $this->xml = xml_parser_create(); 215 215 xml_set_object( $this->xml, $this ); … … 220 220 } 221 221 222 function parse( $in ) {222 public function parse( $in ) { 223 223 $parse = xml_parse( $this->xml, $in, true ); 224 224 if ( ! $parse ) { … … 236 236 } 237 237 238 function start_handler( $parser, $name, $attributes ) {238 public function start_handler( $parser, $name, $attributes ) { 239 239 $data['name'] = $name; 240 240 if ( $attributes ) { … … 243 243 } 244 244 245 function data_handler( $parser, $data ) {245 public function data_handler( $parser, $data ) { 246 246 $index = count( $this->data ) - 1; 247 247 … … 252 252 } 253 253 254 function end_handler( $parser, $name ) {254 public function end_handler( $parser, $name ) { 255 255 if ( count( $this->data ) > 1 ) { 256 256 $data = array_pop( $this->data );
Note: See TracChangeset
for help on using the changeset viewer.