Page 2 of 2 FirstFirst 12
Results 11 to 15 of 15

Thread: Do you have file to test WP stuff?

  1. #11
    BinaryMoon's Avatar
    BinaryMoon is offline Hello World
    Join Date
    Jun 2009
    Posts
    56

    Icon13

    Quote Originally Posted by Otto View Post
    Testing schmesting.

    I just write my code correctly the first time. Much easier.
    Whilst I agree that it's good to write good code first time (isn't that what everyone wants to do?) I do still think testing is worthwhile. There's no guarantee that features in WordPress won't change and then break your "correct code", likewise future features you add may inadvertently break things also.

    I'm becoming more and more a fan of automated testing - especially the automated part :)

    Rarst - thanks for the link, interesting stuff

    johnbintz - thanks for the plugins too - will "test" them myself later :)

  2. #12
    Ryan's Avatar
    Ryan is offline WordPress Legend
    Join Date
    Jan 2009
    Location
    New Zealand
    Posts
    2,797

    Default

    I guess I should start turning that on. I'm not sure what errors it could possibly turn up, but I guess I'll find out once I start using it :)

    PHP Code:
    define('WP_DEBUG'true); 

  3. #13
    Rarst's Avatar
    Rarst is offline Big Tipper
    Join Date
    Jul 2009
    Posts
    322

    Default

    On topic of debug. On my current hosts PHP errors were weirdly configured (or maybe I broke something) and logs where all over WP and, as I suspect, most of errors just never logged.

    So I went through my bookmarks and ended up with:
    1. configure PHP errors to specififed log file
    2. dashboard widget to show errors from that log

    Works like a charm. :) I had already caught some cryptic error in WP core (http.php) and now stalking it to figure out what it is triggered by.
    Rarst.net - cynical thoughts on software and web (and sometimes WP) | @Rarst | I seem to be non-GPL-compliant person. Beware my poisonous thoughts.

  4. #14
    Rarst's Avatar
    Rarst is offline Big Tipper
    Join Date
    Jul 2009
    Posts
    322

    Default

    @Ryan

    As far as I've read it does two things:
    1. sets settings to show all errors (my first command in that file is probably excessive now)
    2. tracks usage of deprecated functions and files, also something to do with hooks that fire when such are run

    Found one more debug option, should be used if editing scripts bundled with WP:
    PHP Code:
    define('SCRIPT_DEBUG'true); 
    Rarst.net - cynical thoughts on software and web (and sometimes WP) | @Rarst | I seem to be non-GPL-compliant person. Beware my poisonous thoughts.

  5. #15
    johnbintz is offline Hello World
    Join Date
    Oct 2009
    Location
    Baltimore, MD
    Posts
    2

    Beer

    Quote Originally Posted by BinaryMoon View Post
    There's no guarantee that features in WordPress won't change and then break your "correct code", likewise future features you add may inadvertently break things also.
    Don't forget refactoring your own code. Having a full set of tests to ensure I don't break already-fixed things as I'm refactoring gives me a lot of freedom to try new things during the refactoring. Then set up your SCM to run your tests pre-commit (git hooks are great for that) and you've got a good guarantee that you'll never commit bad code to your repository.

Page 2 of 2 FirstFirst 12

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •