Tag Info

Hot answers tagged

11

As an ex-software engineer building large business types who landed in an interactive agency let me give you a few thoughts on testing when developing for Wordpress: Your Unit Testing should test the smallest amount of behavior that a class can perform. Each class should be able to be tested independently of Wordpress. If you have a Wordpress dependency ...


11

There is a bit of personal philosophy that goes into a deployment workflow. It's not an easy question to answer outright without knowing your experience with servers and version control, your operating system, hosting, client's experience and tech culture, etc... Here's a similar question that has a lot of explanation. For content deployment, you can ...


8

Resources on how to use the WordPress unit-test: WordPress Automated Tests Trac Automated Testing in The Codex The Unit-Test README File The PHPUnit Manual Hakre/WP Unit-Tests Codex Page


7

I've not actually done it myself, but there is a testing environment for WordPress unit testing. It's meant for core testing, but it could be adapted to test plugins. More info here: http://codex.wordpress.org/Automated_Testing http://svn.automattic.com/wordpress-tests/


6

I just wrote this quick plugin and it seems to work. Let me know if there is a better way. <? /* Plugin Name: Theme Switch if Admin Description: Display different theme to user if logged in as admin Author: Kyle Barber */ add_filter('template', 'change_theme'); add_filter('option_template', 'change_theme'); add_filter('option_stylesheet', ...


5

You can use ShrimpTest for this. Basically, you need to reverse the test idea. You're making three separate posts, one of which will be displayed on the front page. That means that two others will not be displayed on the front page. So you're doing an exclusion. Say your three posts have id's of 101, 102, and 103. You'd set up a test and use the manual PHP ...


5

I would suggest you take a look at WP Dummy Content. You can easily extend this plugin or build a script to activate and run it. As suggested by @kaiser I would really record all the performance data I can to get in insights into this scale of operations.


4

Usually a plugin developed in WordPress version will run fine on several newer versions. What you need to care about is 'deprecated` features/apis in WordPress. Any API in WordPress is not removed overnight, rather it remains deprecated for several versions. You will get such a list here: http://codex.wordpress.org/Category:Deprecated_Functions When you ...


3

There is nothing stopping you from writing your own unit testing for themes/plugins using PHPUnit or some other testing platform. As for WordPress, it has an official Unit Tests here: http://unit-tests.svn.wordpress.org/trunk/ https://github.com/kurtpayne/wordpress-unit-tests (github mirror) There are several build scripts that can automate unit ...


3

Unit tests for WordPress are a tricky thing. If you need to test the code with a live database, etc. I would suggest using the official WordPress test suite. I've gotten unit tests running for a plugin using that method before, but it wasn't pretty, and was fairly unreliable. If you need to do it that way, though, I personally wouldn't think of doing it with ...


3

This isn't really a WordPress question - more a generic web development issue. These are some open source tools that can be used for scripting and testing a web browser session. Selenium Cucumber Watir


3

$user_id = $this->_make_user('author', 'user_login_name', 'password', 'test@test.com'); wp_set_current_user( $user_id ); as long as the class that you define the testcase in inherits from WPTestCase, then you can use the _make_user function. The function is found in this svn repository, and is defined in wp-testlib/base.php line 380. NEW: I switched ...


2

Your htaccess file seems to be a little off. I would suggest the first part of the file should look like the following... <IfModule mod_rewrite.c> RewriteEngine On RewriteBase /testsite/ RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /testsite/index.php [L] </IfModule> And that you store it in the ...


2

I don't think you need to worry about these things! WP Upgrades rarely change any function definitions, and if they do, WP_DEBUG = true will bring it to your notice. Just develop with WP_DEBUG set to true, and if a function is deprecated after a WP upgrade, replace it with its newer equivalent and release your plugin with a newer version. Well that's just ...


2

I sometimes use this plugin http://wordpress.org/extend/plugins/duplicator/ it works pretty well if your server enviroment meets it's requirements. Otherwise, it's the good ole, mysql dump route that the other guys explained.


2

I usually do this for just code (no HTML): add_action('template_redirect', 'test'); function test() { // code goes here die; } For dealing with HTML I prefer blank theme, set up for testing. If you want to test in context of existing theme create custom page template, add/remove elements according to your needs and assign to test page.


2

Upgrade to latest MU version first. If you run into problems with that, report your feedback and the bugs you encounter to the MU Project. Then Upgrade to WordPress 3.0. If you run into any problems with that step, report it to the WP Project. Update: As far as you're concerned for a quick test (not a mass test), you can do the test locally on a ...


2

I wrote the Travis-CI powered PHPunit testing library for Jigoshop and Easy Digital Downloads both of which are Ecommerce WP plugins developed on Github. The library employed could be easily converted to work for themes. The nice thing about the Travis-CI powered suite is that we can use it to quickly test multiple PHP and WP versions. If you're theme is a ...


2

Your easiest solution here is to keep everything in your cms folder. and follow this step found at http://codex.wordpress.org/Giving_WordPress_Its_Own_Directory This will keep all wordpress related files in the cms folder, but it will look like its running from the root, copy of index and some .htaccess wizardly as you call it :). enjoy Using a ...


1

I would be very hesitant in having the same database for staging and live as any changes to the database would affect both sites (especially when using software like Wordpress where there is configuration in the database). The only time that I would think of pointing to the live database would be if I was doing theme development and was not going to change ...


1

I don't think you will find any comprehensive or easy answer for this. I think the way you already broke down the various aspects of your installation is the key - i.e., thinking of changes to files as different from changes to the database. Most of the changes I make are at the file level - e.g., CSS, adding code for a hook, stuff like that. They are ...


1

This class is defined in includes/testcase.php. If you checkout the entire repo, you should have it. To check out the entire repo, you should be running something along the lines of: svn co https://unit-tests.svn.wordpress.org/trunk wordpress-tests


1

You need to be using one of these functions to display a list of tags associated with the post: the_tags() get_the_tag_list() get_the_term_list() Otherwise the check will fail. If you're building this theme for use with a project that doesn't need tags, don't bother adding support. If you're indenting to upload it to WordPress.org for review, then you ...


1

In this situation, I'd recommend the following: Dump your production database into your test database Install WP 3 and point it at your test DB Run the database upgrade Turn users loose on the test instance We used a similar process on a much larger installation, and it worked fairly well. Having the second instance made it possible to use our testing ...


1

Q: Are pingbacks sent immediately when a post is published, or are they scheduled as a cron job? If the later is correct, how often does the job run and can I trigger it manually? A: You can install core control (wordpress plugin) to find out more. Q: Are there any other terms for PBs to be sent besides having "Attempt to notify any blogs linked to from ...


1

New browser versions not only follow standards more closely but are very well coded for rendering almost anything. There are no real forward compatibility issues when it comes to styling (outside bugs). Modern browsers can render garbage code as though it was written by Tim Berners-Lee. If a template works in IE6 and IE7 you can rest assured it will ...


1

No. And even if there was, it would be probably useless anyway. You would get incorrect results, because a .php file might call slow functions from WordPress core files, and there are a lot of situations like this. You could try using the xdebug extension, it's pretty close to what you're looking for



Only top voted, non community-wiki answers of a minimum length are eligible