How to add an image for unit testing?

I’d take a look at how WordPress has constructed their attachment tests. You’ll find that tests/phpunit/tests/post/attachments.php they use this method: function _make_attachment( $upload, $parent_post_id = 0 ) { $type=””; if ( !empty($upload[‘type’]) ) { $type = $upload[‘type’]; } else { $mime = wp_check_filetype( $upload[‘file’] ); if ($mime) $type = $mime[‘type’]; } $attachment = array( ‘post_title’ … Read more

Sample — test — data for large WordPress install

Few built-in wp-cli generate commands from the docs: # Generate posts with fetched content. # See https://developer.wordpress.org/cli/commands/post/generate/ $ curl -N http://loripsum.net/api/5 | wp post generate –post_content –count=10 # Add meta to every generated term. # See https://developer.wordpress.org/cli/commands/term/generate/ $ wp term generate category –format=ids –count=3 | xargs -d ‘ ‘ -I % wp term meta add … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)