Support » Developing with WordPress » Unit testing for my own plugin

  • Resolved ryotsun

    (@ryotsun)


    Hi, I’m working on developing wordpress plugin.
    It’s just a quick question about developing wp plugin.
    I’m considering how should I include WP_UnitTestCase class in tests directory in my own project.
    Could you give me some advice?

    current folder structure:

    
    .
    └── sample (project-root)
        ├── sample (plugin-root)
        │   ├── includes
        │   │   └── functions.php
        │   ├── languages
        │   │   ├── sample-ja.mo
        │   │   ├── sample-ja.po
        │   │   └── sample.pot
        │   ├── public
        │   └── sample.php
        └── tests (put unit test files here)
    
Viewing 2 replies - 1 through 2 (of 2 total)
  • Moderator bcworkz

    (@bcworkz)

    I’m not sure it matters too much. I’m assuming you are going to submit to the WP repository, otherwise it really doesn’t matter. Your Subversion folder in the repository has 4 folders by default. You will eventually have different versions under trunk and tags.

    What the core repository does is place tests with each different version. It makes sense for you to do the same.

    Disclaimer: I have nothing to do with the plugins review team. I could be completely wrong from their perspective.

    Thank you for your reply.
    I just wanted to know how to “generate” tests file, actually. ;;

    And I got the following link as a reference.
    https://make.wordpress.org/cli/handbook/plugin-unit-tests/

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Unit testing for my own plugin’ is closed to new replies.